diff options
author | Determinant <[email protected]> | 2019-08-14 23:55:12 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2019-08-14 23:55:12 -0400 |
commit | 03513e267d25b5086b3f905b6d1bc5635fcda845 (patch) | |
tree | d2c800a6d04f7def64b4061ceb97f5faa13cf8ea /consensus/dummy | |
parent | 63fc17f85121f84d597742a49b99ab3d022aa6bd (diff) |
...
Diffstat (limited to 'consensus/dummy')
-rw-r--r-- | consensus/dummy/consensus.go | 14 |
1 files changed, 12 insertions, 2 deletions
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 } |