Describe the bug
There two write operations in MemPool.TryRemoveUnVerified, and this function called by Blockchain.OnFillMemoryPool and MemPool.UpdatePoolForBlockPersisted.
Write operations triggered by MemPool.UpdatePoolForBlockPersisted is protected by _txRwLock, but by Blockchain.OnFillMemoryPool is not.
internal bool TryRemoveUnVerified(UInt256 hash, [MaybeNullWhen(false)] out PoolItem? item)
{
if (!_unverifiedTransactions.TryGetValue(hash, out item))
return false;
_unverifiedTransactions.Remove(hash);
_unverifiedSortedTransactions.Remove(item);
return true;
}
According to comments of _txRwLock, write operations should acquire write lock of _txRwLock.
Describe the bug
There two write operations in
MemPool.TryRemoveUnVerified, and this function called byBlockchain.OnFillMemoryPoolandMemPool.UpdatePoolForBlockPersisted.Write operations triggered by
MemPool.UpdatePoolForBlockPersistedis protected by_txRwLock, but byBlockchain.OnFillMemoryPoolis not.According to comments of
_txRwLock, write operations should acquire write lock of_txRwLock.