-
Notifications
You must be signed in to change notification settings - Fork 724
[net_processing] Improve/upgrade orphan transactions handling #2301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[net_processing] Improve/upgrade orphan transactions handling #2301
Conversation
random-zebra
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice PR (big thumb up for 94af4c9 and 0db5343).
Code review ACK, with only a minor concern over the maximum orphan size.
Would be good to cherry-pick another two simple commits from upstream (bitcoin#14626 and bitcoin/bitcoin@4c0731f from 19596), which are strictly related to these changes, but we can do it in a follow-up PR too.
|
Updated per zebra's feedback, adding bitcoin#14626 and bitcoin/bitcoin@4c0731f . Plus the max orphan tx size change to support large shield transactions. |
This prevents higher order orphans and other junk from holding positions in the orphan map. Parents delayed twenty minutes are more are unlikely to ever arrive. The freed space will improve the orphan matching success rate for other transactions.
…ted. An orphan whos parents were rejected is never going to connect, so there is little utility in keeping it. Orphans also helpfully tell us what we're missing, so go ahead and treat it as INVed.
Although this increases node memory usage in the worst case by perhaps 30MB, the current behavior causes severe issues with dependent tx relay.
This is another violation of the one definition rule, as the type for mapOrphanTransactionsByPrev did not match the one in net_processing.cpp anymore. As it now depends on a custom Iterator, it seems too much hassle to correctly expose it to the tests. Instead, this commit just removes the one test it was referenced in.
add8c14 to
97c6a03
Compare
|
Rebased on master due conflicts. Ready to go. |
… connected. Eliminating a leak that causes the orphan map to always grow to its maximum size. Extra information: I have skipped several PRs from upstream, this was first inside ConnectBlock, then was moved to ActivateBestChain and finally ended up moving it to net_processing under the SyncTransaction slot that we don't have anymore because we are much more updated.
This should (marginally) speed up validationinterface queue draining by avoiding a cs_main lock in one client.
The previous code was biased towards evicting transactions whose txid has a larger gap (lexicographically) with the previous txid in the orphan pool.
In the logic for requesting missing parents of orphan transactions, parent transactions with multiple outputs being spent by the given orphan were being processed multiple times. Fix this by deduplicating the set of missing parent txids first.
Accepting them up to the max supported size.
97c6a03 to
57221af
Compare
random-zebra
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 57221af
Fuzzbawls
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 57221af
The nit i mentioned i think would be better suited for a followup PR, as there are other log output lines around here that have similar leading whitespace.
| if (ptx->ContainsZerocoins()) { | ||
| // Don't even try to check zerocoins at all. | ||
| Misbehaving(pfrom->GetId(), 100); | ||
| LogPrint(BCLog::NET, " misbehaving peer, received a zc transaction, peer: %s\n", pfrom->GetAddrName()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: un-necessary whitespace in log output
Upgraded the orphan transactions management process, getting us much closer to upstream. Skipped several intermediate PRs because our code is way too far ahead of them in some areas like the validation interface and block processing after #2209. Plus added a net_processing zc cleanup.
Important changes:
cs_mainlock for accessingmapOrphanTransactionsandmapOrphanTransactionsByPrev.