diff options
author | bojie <bojie@dexon.org> | 2018-12-12 15:32:27 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-03-12 12:19:09 +0800 |
commit | d0389bce893b8ad5ab9b018e9be06bf6295dd05a (patch) | |
tree | 0d3f368c6653cb5dfedce32e5c432d4f8343f038 | |
parent | be142423b10aa06cf9446b89dca7dd02bff5878c (diff) | |
download | dexon-d0389bce893b8ad5ab9b018e9be06bf6295dd05a.tar.gz dexon-d0389bce893b8ad5ab9b018e9be06bf6295dd05a.tar.zst dexon-d0389bce893b8ad5ab9b018e9be06bf6295dd05a.zip |
app: remove unnecessary code (#86)
-rw-r--r-- | dex/app.go | 6 | ||||
-rw-r--r-- | dex/app_test.go | 12 |
2 files changed, 3 insertions, 15 deletions
diff --git a/dex/app.go b/dex/app.go index 5ce34668c..8da00d07b 100644 --- a/dex/app.go +++ b/dex/app.go @@ -47,8 +47,7 @@ type DexconApp struct { finalizedBlockFeed event.Feed scope event.SubscriptionScope - chainLocks sync.Map - chainLatestRoot sync.Map + chainLocks sync.Map } type witnessData struct { @@ -486,12 +485,11 @@ func (d *DexconApp) BlockDelivered( }, txs, nil, nil) h := d.blockchain.CurrentBlock().NumberU64() + 1 - root, err := d.blockchain.ProcessPendingBlock(newBlock, &block.Witness) + _, err = d.blockchain.ProcessPendingBlock(newBlock, &block.Witness) if err != nil { log.Error("Failed to process pending block", "error", err) panic(err) } - d.chainLatestRoot.Store(block.Position.ChainID, root) d.blockchain.RemoveConfirmedBlock(chainID, blockHash) diff --git a/dex/app_test.go b/dex/app_test.go index cbd29d0dc..abe83b92a 100644 --- a/dex/app_test.go +++ b/dex/app_test.go @@ -417,17 +417,7 @@ func TestBlockDelivered(t *testing.T) { Height: 1, }) - pendingBlock, pendingState := dex.blockchain.GetPending() - - r, ok := dex.app.chainLatestRoot.Load(firstBlocksInfo[0].Block.Position.ChainID) - if !ok { - t.Errorf("lastest root cache not exist") - } - - if *r.(*common.Hash) != pendingBlock.Root() { - t.Errorf("incorrect pending root") - } - + _, pendingState := dex.blockchain.GetPending() currentBlock := dex.blockchain.CurrentBlock() if currentBlock.NumberU64() != 0 { t.Errorf("unexpected current block number %v", currentBlock.NumberU64()) |