From 315ad2c63fa4879e5a91c3aa013c93f8f4969362 Mon Sep 17 00:00:00 2001 From: Determinant Date: Wed, 19 Aug 2020 11:16:35 -0400 Subject: finish the block verification impl --- plugin/evm/vm.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'plugin/evm/vm.go') 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 } -- cgit v1.2.3