Backport: Fix orphan pool issue for long pending tx #4208
Merged
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.
What problem does this PR solve?
Project Godwoken found that some
tx
will stay inpending
for a long time. After analyzing the log(at most 4 hours), we foundtx
may unexpectedly stay inorphan pool
for the scenario transaction chain. For example,tx1 -> tx2
, aftertx1
is submittedtx2
stayed inpending
for a long time, actuallytx2
wasn't submitted intotxpool
.Problem Summary:
What is changed and how it works?
Fix the issues in
process_orphan_tx
which may forget some txs inorphan pool
. There are 3 issues this PR targeted to resolve:find_by_previous
was only returning onetx
by searching with input(because thetx
in orphan pool may have conflicts), which may cause issue when there are multiple childtx
for one parenttx
,process_orphan_tx
may can not process all of them.2 * max_block_interval
, which is96
seconds, this is too short for the delay of networking, and we didn't sendReject
to filter, which may make the node don't broadcast them later.tx
scenario, since we can not resolve all inputs inorphan pool
, we can not addReplace-by-fee
checking rules for them, so I change the code to useHashMap<OutPoint, HashSet<ProposalShortId>>
, so we don't handle the conflict inorphan pool
.What's Changed:
Related changes
owner/repo
:Check List
Tests
Side effects
Release note