core/mempool: fix AddBlock and tx pooling concurrency issues

Eliminate races between tx checks and adding them to the mempool, ensure the
chain doesn't change while we're working with the new tx. Ensure only one
block addition attempt could be in progress.
This commit is contained in:
Roman Khimov 2020-02-04 18:43:21 +03:00
parent f0bb886be3
commit 70b3839fd0
7 changed files with 120 additions and 29 deletions

View file

@ -40,6 +40,7 @@ type Blockchainer interface {
GetUnspentCoinState(util.Uint256) *UnspentCoinState
References(t *transaction.Transaction) map[transaction.Input]*transaction.Output
mempool.Feer // fee interface
PoolTx(*transaction.Transaction) error
VerifyTx(*transaction.Transaction, *block.Block) error
GetMemPool() *mempool.Pool
}