Skip to content

fix tpool locking bug

Luke Champine requested to merge hubris into master

There are two things going on here:

  • ConsensusChange now has a TryTransactionSet field, which is an unexported (i.e. unlocked) version of the consensus set's TryTransactionSet function. This allows the transaction pool to call TryTransactionSet even under lock, namely during ProcessConsensusChange.
  • The consensus set now has an exported method called LockedTryTransactionSet, which read-locks the consensus set and calls the supplied function, passing it an unlocked version of TryTransactionSet. However, this function is not part of the ConsensusSet interface. This allows the transaction pool to call TryTransactionSet multiple times without unlocking the consensus set. More importantly, it means the transaction pool can lock the consensus set first, before locking itself. This prevents a deadlock.

The effect of this is that the defrag test now passes. We may also see less NDFs.

Merge request reports