From aedd4b46cdc0a48c1b06a3e920bf57f8c28d401d Mon Sep 17 00:00:00 2001 From: Determinant Date: Thu, 17 Sep 2020 03:08:39 -0400 Subject: fix the block completion race --- coreth.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'coreth.go') diff --git a/coreth.go b/coreth.go index 4d0c2ee..1d6b92e 100644 --- a/coreth.go +++ b/coreth.go @@ -17,6 +17,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethdb" + "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/trie" //"github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/log" @@ -85,6 +86,10 @@ func (self *ETHChain) GenBlock() { self.backend.Miner().GenBlock() } +func (self *ETHChain) SubscribeNewMinedBlockEvent() *event.TypeMuxSubscription { + return self.backend.Miner().GetWorkerMux().Subscribe(core.NewMinedBlockEvent{}) +} + func (self *ETHChain) VerifyBlock(block *types.Block) bool { txnHash := types.DeriveSha(block.Transactions(), new(trie.Trie)) uncleHash := types.CalcUncleHash(block.Uncles()) -- cgit v1.2.3