From c4ee0ef189bc00661c7ca8c1d3e94e929aa5eee1 Mon Sep 17 00:00:00 2001 From: bojie Date: Mon, 3 Dec 2018 16:30:53 +0800 Subject: app: add app test case and benchmark (#66) --- core/blockchain.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'core/blockchain.go') 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() -- cgit v1.2.3