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).
This commit is contained in:
@ -214,19 +214,6 @@ func (self *ChainManager) TransState() *state.StateDB {
|
||||
return self.transState
|
||||
}
|
||||
|
||||
func (self *ChainManager) TxState() *state.ManagedState {
|
||||
self.tsmu.RLock()
|
||||
defer self.tsmu.RUnlock()
|
||||
|
||||
return self.txState
|
||||
}
|
||||
|
||||
func (self *ChainManager) setTxState(statedb *state.StateDB) {
|
||||
self.tsmu.Lock()
|
||||
defer self.tsmu.Unlock()
|
||||
self.txState = state.ManageState(statedb)
|
||||
}
|
||||
|
||||
func (self *ChainManager) setTransState(statedb *state.StateDB) {
|
||||
self.transState = statedb
|
||||
}
|
||||
@ -751,7 +738,7 @@ out:
|
||||
case ev := <-events.Chan():
|
||||
switch ev := ev.(type) {
|
||||
case queueEvent:
|
||||
for i, event := range ev.queue {
|
||||
for _, event := range ev.queue {
|
||||
switch event := event.(type) {
|
||||
case ChainEvent:
|
||||
// We need some control over the mining operation. Acquiring locks and waiting for the miner to create new block takes too long
|
||||
@ -760,12 +747,6 @@ out:
|
||||
self.currentGasLimit = CalcGasLimit(event.Block)
|
||||
self.eventMux.Post(ChainHeadEvent{event.Block})
|
||||
}
|
||||
case ChainSplitEvent:
|
||||
// On chain splits we need to reset the transaction state. We can't be sure whether the actual
|
||||
// state of the accounts are still valid.
|
||||
if i == ev.splitCount {
|
||||
self.setTxState(state.New(event.Block.Root(), self.stateDb))
|
||||
}
|
||||
}
|
||||
|
||||
self.eventMux.Post(event)
|
||||
|
Reference in New Issue
Block a user