diff options
author | Determinant <[email protected]> | 2020-08-20 00:03:12 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2020-08-20 00:03:12 -0400 |
commit | 0c417aaa02c5cc8bb6a9629ac2502e0c4d200071 (patch) | |
tree | 8aa8c257ed613872131527b7ec036e548da60128 /plugin/evm/vm.go | |
parent | 2d409cb9790e55fd014546222f448786bbefa46b (diff) |
impl state transfer for C-to-X Tx
Diffstat (limited to 'plugin/evm/vm.go')
-rw-r--r-- | plugin/evm/vm.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/plugin/evm/vm.go b/plugin/evm/vm.go index 53810ee..6155728 100644 --- a/plugin/evm/vm.go +++ b/plugin/evm/vm.go @@ -95,6 +95,7 @@ var ( errNoExportOutputs = errors.New("no export outputs") errOutputsNotSorted = errors.New("outputs not sorted") errOverflowExport = errors.New("overflow when computing export amount + txFee") + errInvalidNonce = errors.New("invalid nonce") ) func maxDuration(x, y time.Duration) time.Duration { @@ -721,3 +722,11 @@ func (vm *VM) GetSpendableCanonical(keys []*crypto.PrivateKeySECP256K1R, amount } return inputs, signers, nil } + +func (vm *VM) GetAcceptedNonce(address common.Address) (uint64, error) { + state, err := vm.chain.BlockState(vm.lastAccepted.ethBlock) + if err != nil { + return 0, err + } + return state.GetNonce(address), nil +} |