nethermind
nethermind copied to clipboard
TxPool: fix overly aggressive tx locking
https://github.com/NethermindEth/nethermind/blob/master/src/Nethermind/Nethermind.Blockchain/Spec/ChainHeadSpecProvider.cs#L44
This could have been implemented better. We are locking transactions in the TxPool for releaseSpec, which changes only once per year. We should also investigate whether this introduces any race-condition issues.
cc: @benaadams
Picking this up. Replaced the lock + paired field updates with an immutable (Number, Spec) record published via Volatile.Read/Volatile.Write. Last-writer-wins is safe because GetSpec(header) is deterministic per (number, header). PR follows.