Avoid propagating InstantSend related old recovered sigs #3145
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements "truncating" of recovered sigs in the LLMQ DB. Truncating means that the sig itself is deleted from the DB, but the hash of it is left in the DB so that we won't re-request it later. It also avoids reprocessing of the sig when another node sends it to us after we've already got it from another node.
This fixes issues when other nodes are unable to keep up with the network. In this case requesting sigs from them will timeout and cause us to re-request from another node. When we then get the sig from the second node, we'll process and relay it. If an InstantSend lock comes in which uses that sig, the code in
CInstantSendManagercauses the recovered sig to be deleted by callingRemoveRecoveredSig. After some time, the first node might end up sending us the same sig again, causing us to re-process and re-propagate the recovered signature. Neighbor nodes will now get the same sig from us, even thought they also have seen it already, which makes them re-process and re-propagate it as well. This then continues until the whole network has seen and processed the sig twice.Changing the removal to "truncating" fixes this issue as it stops re-processing and re-propagation.