aboutsummaryrefslogtreecommitdiffstats
path: root/core/blockchain.go
diff options
context:
space:
mode:
authorbojie <bojie@dexon.org>2018-12-03 16:30:53 +0800
committerWei-Ning Huang <w@dexon.org>2019-03-12 12:19:09 +0800
commitc7f9479a5c1fa013598da59cc56f60aa4d3bd5cb (patch)
treecb83a48c10489e93e66cb3a3258fe3346252b89d /core/blockchain.go
parentc334a14b56c5a9239e9839c8bf870cb2425dc08f (diff)
downloaddexon-c7f9479a5c1fa013598da59cc56f60aa4d3bd5cb.tar
dexon-c7f9479a5c1fa013598da59cc56f60aa4d3bd5cb.tar.gz
dexon-c7f9479a5c1fa013598da59cc56f60aa4d3bd5cb.tar.bz2
dexon-c7f9479a5c1fa013598da59cc56f60aa4d3bd5cb.tar.lz
dexon-c7f9479a5c1fa013598da59cc56f60aa4d3bd5cb.tar.xz
dexon-c7f9479a5c1fa013598da59cc56f60aa4d3bd5cb.tar.zst
dexon-c7f9479a5c1fa013598da59cc56f60aa4d3bd5cb.zip
app: add app test case and benchmark (#66)
Diffstat (limited to 'core/blockchain.go')
-rw-r--r--core/blockchain.go16
1 files changed, 14 insertions, 2 deletions
diff --git a/core/blockchain.go b/core/blockchain.go
index 878ed0a56..2adad1d74 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()