aboutsummaryrefslogtreecommitdiff
path: root/plugin/evm/vm.go
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2020-08-19 11:16:35 -0400
committerDeterminant <[email protected]>2020-08-19 11:16:35 -0400
commit315ad2c63fa4879e5a91c3aa013c93f8f4969362 (patch)
treeec625529150a06865221d30daab3e141b0a1d0e3 /plugin/evm/vm.go
parent0844c8c6919f6d98ebe8a9501360ef5bc362dff3 (diff)
finish the block verification impl
Diffstat (limited to 'plugin/evm/vm.go')
-rw-r--r--plugin/evm/vm.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/plugin/evm/vm.go b/plugin/evm/vm.go
index 4fe4cc0..7a310bf 100644
--- a/plugin/evm/vm.go
+++ b/plugin/evm/vm.go
@@ -134,6 +134,7 @@ type VM struct {
genlock sync.Mutex
txSubmitChan <-chan struct{}
+ atomicTxSubmitChan chan struct{}
codec codec.Codec
clock timer.Clock
avaxAssetID ids.ID
@@ -211,6 +212,7 @@ func (vm *VM) Initialize(
case atx := <-vm.pendingAtomicTxs:
raw, _ := vm.codec.Marshal(atx)
block.SetExtraData(raw)
+ // TODO: make sure the atomic Tx is valid
}
return nil
})
@@ -313,6 +315,9 @@ func (vm *VM) Initialize(
case <-vm.txSubmitChan:
vm.ctx.Log.Verbo("New tx detected, trying to generate a block")
vm.tryBlockGen()
+ case <-vm.atomicTxSubmitChan:
+ vm.ctx.Log.Verbo("New atomic Tx detected, trying to generate a block")
+ vm.tryBlockGen()
case <-time.After(5 * time.Second):
vm.tryBlockGen()
}
@@ -628,6 +633,7 @@ func (vm *VM) FormatAddress(addr common.Address) (string, error) {
func (vm *VM) issueTx(tx *Tx) error {
select {
case vm.pendingAtomicTxs <- tx:
+ vm.atomicTxSubmitChan <- struct{}{}
default:
return errTooManyAtomicTx
}