Skip to content

Blockproducer Explorer feature including Transaction type encode/decode improvements #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 38 commits into from
Oct 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
4671243
Refactor cql-utils and add adapterconfgen
Oct 15, 2018
87bdbf7
Complete adapterconfgen
Oct 16, 2018
ed941af
Refine doc of adapter
Oct 16, 2018
5c24043
Fix mysql-adapter bug on initial use database statement
Oct 16, 2018
79657d3
Support database id quoted with backtick in mysql-adapter
Oct 16, 2018
f6db8b5
Update mysql-adapter to support libmysql trivial case
Oct 16, 2018
6a3605a
Add blockproducer rpc to cql-utils and refactor msgpack utils to use …
Oct 17, 2018
5ae7b35
Add check interval argument for explorer
Oct 17, 2018
8106512
Refactor observer use cas in stopped condition test
Oct 17, 2018
3b7dd7a
Add TransactionWrapper for transaction to decode/encode using msgpack
Oct 17, 2018
b5b964f
Add txs from pool
leventeliu Oct 18, 2018
7aa9b58
Add missing rpc method declarations
Oct 18, 2018
991a979
Refactor existing rpc call
Oct 18, 2018
d13de30
Unify all rpc service name to route package
Oct 18, 2018
890753d
Swallow data on unknown fields during msgpack decode
Oct 18, 2018
67889d1
Remove unused TxType of TxBilling structure
Oct 18, 2018
5b2fe88
Remove accountAddress field in BillingResponse structure
Oct 18, 2018
2a74c79
Add TransactionTypeMixin for Transaction type heuristic
Oct 18, 2018
c0d38b7
Fix typo of transactions
Oct 18, 2018
b895f14
Move AdviseBillingReq/Resp to sqlchain/types package
Oct 18, 2018
ee46afd
Fix race condition in dht consistent ring
Oct 18, 2018
a96fb52
Refactor billing/signature, support sending request requires entity s…
Oct 19, 2018
d5739a4
Refactor TxBilling and re-generate MarshalHash functions
Oct 19, 2018
31e94bb
Rename BillingRequest filename
Oct 19, 2018
47eb5eb
Rename TxBilling to Billing type transaction
Oct 19, 2018
4663499
Rename txsqlchainbilling to billing filename
Oct 19, 2018
14e99e8
Refactor transaction using DefaultHashSignVerifierImpl
Oct 19, 2018
a6f1da9
Complete transaction type awareness encode/decoder
Oct 19, 2018
f88a734
Add more test case for serialize and deserialize of transaction
Oct 19, 2018
b7a8bd4
Unify msgpack encode/decode
Oct 19, 2018
e19e172
Fix some bugs in blockproducer chain
Oct 20, 2018
6e06b84
Remove AddTxTransfer rpc, use unified AddTx instead
Oct 22, 2018
14a9363
Refactor chain functions in blockproducer chain
Oct 22, 2018
93f64d9
Count block nodes using count field in blockNode
Oct 22, 2018
275ca69
Update go-mysql dep to github.com/CovenantSQL/go-mysql
Oct 22, 2018
5e5f2c2
Complete explorer refactor
Oct 23, 2018
c5c62d9
Fix nil transactions bug in explorer
Oct 23, 2018
43d9acf
Add explorer README and transaction type pretty formatting
Oct 23, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 19 additions & 18 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@
name = "github.com/CovenantSQL/xurls"
branch = "master"

[[override]]
name = "github.com/siddontang/go-mysql"
source = "github.com/CovenantSQL/go-mysql"
branch = "master"

[prune]
go-tests = true
unused-packages = true
Expand Down
3 changes: 3 additions & 0 deletions bin/docker-entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,8 @@ cli)
faucet)
exec /app/cql-faucet -config ${COVENANT_CONF} "${@}"
;;
explorer)
exec /app/cql-explorer -config ${COVENANT_CONF} "${@}"
;;
esac

20 changes: 16 additions & 4 deletions blockproducer/blockindex.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ func newBlockNode(h uint32, block *types.Block, parent *blockNode) *blockNode {
var count uint32

if parent != nil {
count = parent.height + 1
count = parent.count + 1
} else {
count = 0
}
bn := &blockNode{
hash: block.SignedHeader.BlockHash,
hash: *block.BlockHash(),
parent: parent,
height: h,
count: count,
Expand Down Expand Up @@ -79,6 +79,18 @@ func (bn *blockNode) ancestor(h uint32) *blockNode {
return ancestor
}

func (bn *blockNode) ancestorByCount(c uint32) *blockNode {
if c > bn.count {
return nil
}

ancestor := bn
for ancestor != nil && ancestor.count != c {
ancestor = ancestor.parent
}
return ancestor
}

type blockIndex struct {
mu sync.RWMutex
index map[hash.Hash]*blockNode
Expand Down Expand Up @@ -107,9 +119,9 @@ func (bi *blockIndex) hasBlock(h hash.Hash) bool {
return has
}

func (bi *blockIndex) lookupBlock(h hash.Hash) *blockNode {
func (bi *blockIndex) lookupNode(h *hash.Hash) *blockNode {
bi.mu.RLock()
defer bi.mu.RUnlock()

return bi.index[h]
return bi.index[*h]
}
2 changes: 1 addition & 1 deletion blockproducer/blockindex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func TestIndexBlock(t *testing.T) {
t.Fatalf("lack of block index: %v", bn1)
}

bn3 := bi.lookupBlock(bn0.hash)
bn3 := bi.lookupNode(&bn0.hash)
if !reflect.DeepEqual(bn0, bn3) {
t.Fatalf("two values should be equal: \n\tv0=%+v\n\tv1=%+v", bn0, bn3)
}
Expand Down
Loading