aboutsummaryrefslogtreecommitdiff
path: root/consensus/dummy/consensus.go
diff options
context:
space:
mode:
authorStephen Buttolph <[email protected]>2020-08-25 13:49:24 -0400
committerGitHub <[email protected]>2020-08-25 13:49:24 -0400
commit5f9c76b5f4eb5bb08b8d3e3125b223f3737631d3 (patch)
tree9de0af77831340eb38c28c613849f1e7b65f3a54 /consensus/dummy/consensus.go
parent1bb314f767785fe617c3c5efeca1a64127339506 (diff)
parentb05d11d451fb73843abcf6bd5fc8664b069433a4 (diff)
Merge pull request #11 from ava-labs/TS_fix_gasv0.2.13
Fix gas handling
Diffstat (limited to 'consensus/dummy/consensus.go')
-rw-r--r--consensus/dummy/consensus.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/consensus/dummy/consensus.go b/consensus/dummy/consensus.go
index 9d8db1e..494e4be 100644
--- a/consensus/dummy/consensus.go
+++ b/consensus/dummy/consensus.go
@@ -19,7 +19,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 OnFinalizeAndAssembleCallbackType = func(state *state.StateDB, txs []*types.Transaction) ([]byte, error)
type OnAPIsCallbackType = func(consensus.ChainReader) []rpc.API
type OnExtraStateChangeType = func(block *types.Block, statedb *state.StateDB) error
@@ -261,14 +261,19 @@ func (self *DummyEngine) Finalize(
func (self *DummyEngine) FinalizeAndAssemble(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction,
uncles []*types.Header, receipts []*types.Receipt) (*types.Block, error) {
+ var extdata []byte
if self.cb.OnFinalizeAndAssemble != nil {
- self.cb.OnFinalizeAndAssemble(chain, header, state, txs, uncles, receipts)
+ ret, err := self.cb.OnFinalizeAndAssemble(state, txs)
+ extdata = ret
+ if err != nil {
+ return nil, err
+ }
}
// commit the final state root
header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number))
// Header seems complete, assemble into a block and return
- return types.NewBlock(header, txs, uncles, receipts), nil
+ return types.NewBlock(header, txs, uncles, receipts, extdata), nil
}
func (self *DummyEngine) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) (err error) {