From 03513e267d25b5086b3f905b6d1bc5635fcda845 Mon Sep 17 00:00:00 2001 From: Determinant Date: Wed, 14 Aug 2019 23:55:12 -0400 Subject: ... --- consensus/dummy/consensus.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'consensus') diff --git a/consensus/dummy/consensus.go b/consensus/dummy/consensus.go index 6b03844..0086581 100644 --- a/consensus/dummy/consensus.go +++ b/consensus/dummy/consensus.go @@ -17,7 +17,16 @@ import ( "github.com/ethereum/go-ethereum/rpc" ) +type ConsensusCallbacks struct { + OnSeal func(*types.Block) +} + type DummyEngine struct { + cb *ConsensusCallbacks +} + +func NewDummyEngine(cb *ConsensusCallbacks) *DummyEngine { + return &DummyEngine { cb: cb } } var ( @@ -192,8 +201,9 @@ uncles []*types.Header, receipts []*types.Receipt) (*types.Block, error) { } func (self *DummyEngine) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error { - //time.Sleep(1000 * time.Millisecond) - fmt.Printf("sealed %s\n", block.ParentHash().String()) + if self.cb.OnSeal != nil { + self.cb.OnSeal(block) + } results <- block return nil } -- cgit v1.2.3