diff options
author | Wei-Ning Huang <w@dexon.org> | 2018-11-01 18:01:22 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-12 17:27:17 +0800 |
commit | 05cdd58111500b1b40caa9feffbea6c58f277a48 (patch) | |
tree | ff7c0b521b29a558a23f8fe8735502cb4810d00b /core | |
parent | 7cd4ecd047ee297e10753ff642ad4893418ace48 (diff) | |
download | go-tangerine-05cdd58111500b1b40caa9feffbea6c58f277a48.tar.gz go-tangerine-05cdd58111500b1b40caa9feffbea6c58f277a48.tar.zst go-tangerine-05cdd58111500b1b40caa9feffbea6c58f277a48.zip |
dex: minor refactor
Diffstat (limited to 'core')
-rw-r--r-- | core/blockchain.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/core/blockchain.go b/core/blockchain.go index 1a60805a1..8b5670081 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -244,7 +244,7 @@ func (bc *BlockChain) GetVMConfig() *vm.Config { } type blockInfo struct { - addresses map[common.Address]interface{} + addresses map[common.Address]struct{} block *coreTypes.Block } @@ -258,23 +258,22 @@ func (bc *BlockChain) AddConfirmedBlock(block *coreTypes.Block) error { return err } - addressMap := map[common.Address]interface{}{} + addressMap := map[common.Address]struct{}{} for _, tx := range transactions { msg, err := tx.AsMessage(types.MakeSigner(bc.Config(), new(big.Int))) if err != nil { return err } - addressMap[msg.From()] = nil + addressMap[msg.From()] = struct{}{} // get latest nonce in block bc.addressNonce[msg.From()] = msg.Nonce() // calculate max cost in confirmed blocks if bc.addressCost[msg.From()] == nil { - bc.addressCost[msg.From()] = tx.Cost() - } else { - bc.addressCost[msg.From()] = new(big.Int).Add(bc.addressCost[msg.From()], tx.Cost()) + bc.addressCost[msg.From()] = big.NewInt(0) } + bc.addressCost[msg.From()] = new(big.Int).Add(bc.addressCost[msg.From()], tx.Cost()) } for addr := range addressMap { |