diff options
author | Determinant <[email protected]> | 2020-08-03 17:16:53 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2020-08-03 17:16:53 -0400 |
commit | c73ba009031126e16da6999468851b33f93e8005 (patch) | |
tree | 961111c84794cf3807946d073bcef36ec8ba6025 /consensus/dummy/consensus.go | |
parent | 746a107e2a7bb1f66049240d320e29d0a0536eae (diff) |
allow using extra binary data in a block for state transition
Diffstat (limited to 'consensus/dummy/consensus.go')
-rw-r--r-- | consensus/dummy/consensus.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/consensus/dummy/consensus.go b/consensus/dummy/consensus.go index adc85fe..9d8db1e 100644 --- a/consensus/dummy/consensus.go +++ b/consensus/dummy/consensus.go @@ -21,6 +21,7 @@ import ( type OnFinalizeCallbackType = func(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header) type OnFinalizeAndAssembleCallbackType = func(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt) type OnAPIsCallbackType = func(consensus.ChainReader) []rpc.API +type OnExtraStateChangeType = func(block *types.Block, statedb *state.StateDB) error type ConsensusCallbacks struct { OnSeal func(*types.Block) error @@ -28,6 +29,7 @@ type ConsensusCallbacks struct { OnAPIs OnAPIsCallbackType OnFinalize OnFinalizeCallbackType OnFinalizeAndAssemble OnFinalizeAndAssembleCallbackType + OnExtraStateChange OnExtraStateChangeType } type DummyEngine struct { @@ -322,3 +324,10 @@ func (self *DummyEngine) APIs(chain consensus.ChainReader) (res []rpc.API) { func (self *DummyEngine) Close() error { return nil } + +func (self *DummyEngine) ExtraStateChange(block *types.Block, statedb *state.StateDB) error { + if self.cb.OnExtraStateChange != nil { + return self.cb.OnExtraStateChange(block, statedb) + } + return nil +} |