core: remove transactions from MemPool when they're stored in block

Extend MemPool with Remove() and use it. Fixes #446.
This commit is contained in:
Roman Khimov 2019-10-24 12:29:55 +03:00
parent 184d8a0180
commit 45cac07643
3 changed files with 100 additions and 0 deletions

View file

@ -467,6 +467,9 @@ func (bc *Blockchain) storeBlock(block *Block) error {
}
atomic.StoreUint32(&bc.blockHeight, block.Index)
for _, tx := range block.Transactions {
bc.memPool.Remove(tx.Hash())
}
return nil
}