diff options
author | bojie <bojie@dexon.org> | 2018-12-03 16:30:53 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-12 17:27:19 +0800 |
commit | 88ef6b9a6749e0ec1697107ff21422f314e69f9b (patch) | |
tree | 56055152d60c4b5540fe5eeed00afc7d300f024c /core/blockchain.go | |
parent | 3088974300d177d9e5324359801f4373c24cc9d9 (diff) | |
download | go-tangerine-88ef6b9a6749e0ec1697107ff21422f314e69f9b.tar go-tangerine-88ef6b9a6749e0ec1697107ff21422f314e69f9b.tar.gz go-tangerine-88ef6b9a6749e0ec1697107ff21422f314e69f9b.tar.bz2 go-tangerine-88ef6b9a6749e0ec1697107ff21422f314e69f9b.tar.lz go-tangerine-88ef6b9a6749e0ec1697107ff21422f314e69f9b.tar.xz go-tangerine-88ef6b9a6749e0ec1697107ff21422f314e69f9b.tar.zst go-tangerine-88ef6b9a6749e0ec1697107ff21422f314e69f9b.zip |
app: add app test case and benchmark (#66)
Diffstat (limited to 'core/blockchain.go')
-rw-r--r-- | core/blockchain.go | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/core/blockchain.go b/core/blockchain.go index b22da28ab..470f7ae28 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -356,6 +356,18 @@ func (bc *BlockChain) GetChainLastConfirmedHeight(chainID uint32) uint64 { return val.(uint64) } +func (bc *BlockChain) GetAddressInfo(chainID uint32, address common.Address) ( + info struct { + Nonce uint64 + Cost *big.Int + Counter uint64 + }) { + info.Nonce = bc.addressNonce[chainID][address] + info.Cost = bc.addressCost[chainID][address] + info.Counter = bc.addressCounter[chainID][address] + return +} + // loadLastState loads the last known chain state from the database. This method // assumes that the chain manager mutex is held. func (bc *BlockChain) loadLastState() error { @@ -1775,11 +1787,11 @@ func (bc *BlockChain) processPendingBlock( var witnessData types.WitnessData if err := rlp.Decode(bytes.NewReader(witness.Data), &witnessData); err != nil { log.Error("Witness rlp decode failed", "error", err) - panic(err) + return nil, nil, nil, fmt.Errorf("rlp decode fail: %v", err) } if err := bc.Validator().ValidateWitnessData(witness.Height, witnessData); err != nil { - return nil, nil, nil, fmt.Errorf("valiadte witness data error: %v", err) + return nil, nil, nil, fmt.Errorf("validate witness data error: %v", err) } currentBlock := bc.CurrentBlock() |