core: drop stale transactions from the mempool

They're no longer valid if `ValidUntilBlock == curheight`.
This commit is contained in:
Roman Khimov 2020-10-12 14:58:40 +03:00
parent 6025c13a6d
commit a154481860

View file

@ -1305,7 +1305,11 @@ func (bc *Blockchain) verifyTxAttributes(tx *transaction.Transaction) error {
// correctness, presence in blocks before the new one, etc. // correctness, presence in blocks before the new one, etc.
func (bc *Blockchain) isTxStillRelevant(t *transaction.Transaction, txpool *mempool.Pool) bool { func (bc *Blockchain) isTxStillRelevant(t *transaction.Transaction, txpool *mempool.Pool) bool {
var recheckWitness bool var recheckWitness bool
var curheight = bc.BlockHeight()
if t.ValidUntilBlock <= curheight {
return false
}
if txpool == nil { if txpool == nil {
if bc.dao.HasTransaction(t.Hash()) { if bc.dao.HasTransaction(t.Hash()) {
return false return false