aboutsummaryrefslogtreecommitdiffstats
path: root/xeth/xeth.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-05-06 05:08:52 +0800
committerobscuren <geffobscura@gmail.com>2015-05-07 00:30:55 +0800
commit03bb88dec0163abd99d0fd6c86ab5852c59669cb (patch)
treeb6c00cb55db2912fdb1c86416204aa59ab9298b5 /xeth/xeth.go
parentaa884c052ddf7c5e8f673972b34681982de1cd52 (diff)
downloadgo-tangerine-03bb88dec0163abd99d0fd6c86ab5852c59669cb.tar
go-tangerine-03bb88dec0163abd99d0fd6c86ab5852c59669cb.tar.gz
go-tangerine-03bb88dec0163abd99d0fd6c86ab5852c59669cb.tar.bz2
go-tangerine-03bb88dec0163abd99d0fd6c86ab5852c59669cb.tar.lz
go-tangerine-03bb88dec0163abd99d0fd6c86ab5852c59669cb.tar.xz
go-tangerine-03bb88dec0163abd99d0fd6c86ab5852c59669cb.tar.zst
go-tangerine-03bb88dec0163abd99d0fd6c86ab5852c59669cb.zip
xeth, rpc: added nonce setting through RPC and xeth transact
Diffstat (limited to 'xeth/xeth.go')
-rw-r--r--xeth/xeth.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/xeth/xeth.go b/xeth/xeth.go
index 692fb338c..ac59069d5 100644
--- a/xeth/xeth.go
+++ b/xeth/xeth.go
@@ -648,7 +648,7 @@ func (self *XEth) ConfirmTransaction(tx string) bool {
}
-func (self *XEth) Transact(fromStr, toStr, valueStr, gasStr, gasPriceStr, codeStr string) (string, error) {
+func (self *XEth) Transact(fromStr, toStr, nonceStr, valueStr, gasStr, gasPriceStr, codeStr string) (string, error) {
var (
from = common.HexToAddress(fromStr)
to = common.HexToAddress(toStr)
@@ -704,7 +704,13 @@ func (self *XEth) Transact(fromStr, toStr, valueStr, gasStr, gasPriceStr, codeSt
}
state := self.backend.ChainManager().TxState()
- nonce := state.NewNonce(from)
+
+ var nonce uint64
+ if len(nonceStr) != 0 {
+ nonce = common.Big(nonceStr).Uint64()
+ } else {
+ nonce = state.NewNonce(from)
+ }
tx.SetNonce(nonce)
if err := self.sign(tx, from, false); err != nil {