From 03bb88dec0163abd99d0fd6c86ab5852c59669cb Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 5 May 2015 23:08:52 +0200 Subject: xeth, rpc: added nonce setting through RPC and xeth transact --- xeth/xeth.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'xeth/xeth.go') 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 { -- cgit