aboutsummaryrefslogtreecommitdiffstats
path: root/xeth
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-06-04 04:22:20 +0800
committerobscuren <geffobscura@gmail.com>2015-06-04 04:43:23 +0800
commitd09a6e54215bef8b1ac16a99f0b1d75a8a92a6a8 (patch)
treeec8f89f562417a379c45c25d58b5de9b45bc0b04 /xeth
parent5197aed7dbba2ac19d99221efe33fede82007f5d (diff)
downloaddexon-d09a6e54215bef8b1ac16a99f0b1d75a8a92a6a8.tar
dexon-d09a6e54215bef8b1ac16a99f0b1d75a8a92a6a8.tar.gz
dexon-d09a6e54215bef8b1ac16a99f0b1d75a8a92a6a8.tar.bz2
dexon-d09a6e54215bef8b1ac16a99f0b1d75a8a92a6a8.tar.lz
dexon-d09a6e54215bef8b1ac16a99f0b1d75a8a92a6a8.tar.xz
dexon-d09a6e54215bef8b1ac16a99f0b1d75a8a92a6a8.tar.zst
dexon-d09a6e54215bef8b1ac16a99f0b1d75a8a92a6a8.zip
core, eth, miner: moved nonce management to tx pool.
Removed the managed tx state from the chain manager to the transaction pool where it's much easier to keep track of nonces (and manage them). The transaction pool now also uses the queue and pending txs differently where queued txs are now moved over to the pending queue (i.e. txs ready for processing and propagation).
Diffstat (limited to 'xeth')
-rw-r--r--xeth/xeth.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/xeth/xeth.go b/xeth/xeth.go
index 157fe76c7..187892a49 100644
--- a/xeth/xeth.go
+++ b/xeth/xeth.go
@@ -936,22 +936,22 @@ func (self *XEth) Transact(fromStr, toStr, nonceStr, valueStr, gasStr, gasPriceS
tx = types.NewTransactionMessage(to, value, gas, price, data)
}
- state := self.backend.ChainManager().TxState()
+ state := self.backend.TxPool().State()
var nonce uint64
if len(nonceStr) != 0 {
nonce = common.Big(nonceStr).Uint64()
} else {
- nonce = state.NewNonce(from)
+ nonce = state.GetNonce(from) + 1 //state.NewNonce(from)
}
tx.SetNonce(nonce)
if err := self.sign(tx, from, false); err != nil {
- state.RemoveNonce(from, tx.Nonce())
+ //state.RemoveNonce(from, tx.Nonce())
return "", err
}
if err := self.backend.TxPool().Add(tx); err != nil {
- state.RemoveNonce(from, tx.Nonce())
+ //state.RemoveNonce(from, tx.Nonce())
return "", err
}