mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-05 18:42:19 +00:00
txpool - removed mined transactions if they were missed by state stream (#213)
* Copy rlp for stream, remove txs * Fix low nonce removal Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
This commit is contained in:
parent
d79d43f908
commit
8d06531e4e
@ -520,7 +520,7 @@ func (p *TxPool) GetRlp(tx kv.Tx, hash []byte) ([]byte, error) {
|
|||||||
p.lock.RLock()
|
p.lock.RLock()
|
||||||
defer p.lock.RUnlock()
|
defer p.lock.RUnlock()
|
||||||
rlpTx, _, _, err := p.getRlpLocked(tx, hash)
|
rlpTx, _, _, err := p.getRlpLocked(tx, hash)
|
||||||
return rlpTx, err
|
return common.Copy(rlpTx), err
|
||||||
}
|
}
|
||||||
func (p *TxPool) AppendLocalHashes(buf []byte) []byte {
|
func (p *TxPool) AppendLocalHashes(buf []byte) []byte {
|
||||||
p.lock.RLock()
|
p.lock.RLock()
|
||||||
@ -1048,6 +1048,9 @@ func removeMined(byNonce *BySenderAndNonce, minedTxs []*TxSlot, pending *Pending
|
|||||||
if mt.Tx.nonce > nonce {
|
if mt.Tx.nonce > nonce {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if mt.Tx.traced {
|
||||||
|
log.Info(fmt.Sprintf("TX TRACING: removeMined idHash=%x senderId=%d, currentSubPool=%s", mt.Tx.IdHash, mt.Tx.senderID, mt.currentSubPool))
|
||||||
|
}
|
||||||
toDel = append(toDel, mt)
|
toDel = append(toDel, mt)
|
||||||
// del from sub-pool
|
// del from sub-pool
|
||||||
switch mt.currentSubPool {
|
switch mt.currentSubPool {
|
||||||
@ -1105,7 +1108,24 @@ func onSenderStateChange(senderID uint64, senderNonce uint64, senderBalance uint
|
|||||||
minTip := uint64(math.MaxUint64)
|
minTip := uint64(math.MaxUint64)
|
||||||
byNonce.ascend(senderID, func(mt *metaTx) bool {
|
byNonce.ascend(senderID, func(mt *metaTx) bool {
|
||||||
if mt.Tx.traced {
|
if mt.Tx.traced {
|
||||||
log.Info(fmt.Sprintf("TX TRACING: onSenderStateChange loop iteration idHash=%x senderID=%d, senderNonce=%d, txn.nonce=%d, currentSubPool=%b", mt.Tx.IdHash, senderID, senderNonce, mt.Tx.nonce, mt.currentSubPool))
|
log.Info(fmt.Sprintf("TX TRACING: onSenderStateChange loop iteration idHash=%x senderID=%d, senderNonce=%d, txn.nonce=%d, currentSubPool=%s", mt.Tx.IdHash, senderID, senderNonce, mt.Tx.nonce, mt.currentSubPool))
|
||||||
|
}
|
||||||
|
if senderNonce > mt.Tx.nonce {
|
||||||
|
if mt.Tx.traced {
|
||||||
|
log.Info(fmt.Sprintf("TX TRACING: removing due to low nonce for idHash=%x senderID=%d, senderNonce=%d, txn.nonce=%d, currentSubPool=%s", mt.Tx.IdHash, senderID, senderNonce, mt.Tx.nonce, mt.currentSubPool))
|
||||||
|
}
|
||||||
|
// del from sub-pool
|
||||||
|
switch mt.currentSubPool {
|
||||||
|
case PendingSubPool:
|
||||||
|
pending.UnsafeRemove(mt)
|
||||||
|
case BaseFeeSubPool:
|
||||||
|
baseFee.UnsafeRemove(mt)
|
||||||
|
case QueuedSubPool:
|
||||||
|
queued.UnsafeRemove(mt)
|
||||||
|
default:
|
||||||
|
//already removed
|
||||||
|
}
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
minFeeCap = min(minFeeCap, mt.Tx.feeCap)
|
minFeeCap = min(minFeeCap, mt.Tx.feeCap)
|
||||||
mt.minFeeCap = minFeeCap
|
mt.minFeeCap = minFeeCap
|
||||||
|
Loading…
Reference in New Issue
Block a user