aboutsummaryrefslogtreecommitdiff
path: root/plugin/evm/vm.go
diff options
context:
space:
mode:
authorStephenButtolph <[email protected]>2020-08-20 09:42:06 -0400
committerStephenButtolph <[email protected]>2020-08-20 09:42:06 -0400
commit52c6ccd2f063a6cccc35f5b4380b22fb9dd0f102 (patch)
tree465d0b4981d28835483f56e19129b27e986494d6 /plugin/evm/vm.go
parent6febda1bc51f6658ab8f5cf705454e3f9c24a1f4 (diff)
implemented exportTx accept
Diffstat (limited to 'plugin/evm/vm.go')
-rw-r--r--plugin/evm/vm.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/plugin/evm/vm.go b/plugin/evm/vm.go
index 0910f6d..4ea3793 100644
--- a/plugin/evm/vm.go
+++ b/plugin/evm/vm.go
@@ -177,11 +177,10 @@ type VM struct {
}
func (vm *VM) getAtomicTx(block *types.Block) *Tx {
+ extdata := block.ExtraData()
atx := new(Tx)
- if extdata := block.ExtraData(); extdata != nil {
- if err := vm.codec.Unmarshal(extdata, atx); err != nil {
- panic(err)
- }
+ if err := vm.codec.Unmarshal(extdata, atx); err != nil {
+ return nil
}
atx.Sign(vm.codec, nil)
return atx
@@ -284,7 +283,11 @@ func (vm *VM) Initialize(
return vm.getLastAccepted().ethBlock
})
chain.SetOnExtraStateChange(func(block *types.Block, state *state.StateDB) error {
- return vm.getAtomicTx(block).UnsignedTx.(UnsignedAtomicTx).EVMStateTransfer(state)
+ tx := vm.getAtomicTx(block)
+ if tx == nil {
+ return nil
+ }
+ return tx.UnsignedTx.(UnsignedAtomicTx).EVMStateTransfer(state)
})
vm.blockCache = cache.LRU{Size: 2048}
vm.blockStatusCache = cache.LRU{Size: 1024}