-
Notifications
You must be signed in to change notification settings - Fork 38.7k
[RPC] Expose ancestor/descendant information over RPC #7292
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
Conversation
|
Concept ACK |
|
Concept ACK. |
1ff8f47 to
7ed3383
Compare
|
Updated to remove dead code I inadvertently left in |
|
Here's an example of a tool that would benefit from the getdescendants function: This is a script that takes two txid's (that are signaling opt-in RBF) and combines them down to one -- consolidating duplicate output addresses (if any) and removing pay-to-self outputs, assumed for demo purposes to be change outputs -- and paying for all fees including those of descendants. The main idea is that this avoids over-paying for descendants -- it calls getdescendants on each transaction and takes the union of the two sets so that each descendant is paid for once. I don't know any simple or straightforward way to do this without this new RPC call. There are similar benefits to having getancestors, such as if you wanted to understand why a stuck transaction wasn't confirming, then getancestors would give you the set of unconfirmed parents to look at (and you could write a replace-by-fee-tool that was smart enough to drop an input coming from a stuck unconfirmed parent, when possible, to replace a transaction with one likely to confirm sooner; or better still, replace such a stuck parent instead if possible). |
|
Ultra nit before reading the code: it's not obvious from the RPC names that
it's about the mempool.
|
7ed3383 to
2807329
Compare
|
Updated with new RPC names ( |
|
Any reason not to just add the ancestors/descendants info to getrawmempool (and also the getmempoolentry)? |
|
The goal was to avoid having to dump the entire mempool if you were only interested in a very small subset of it. But I suppose there's no reason we couldn't also show the txid's of ancestors and descendants when you call (edited) |
|
@luke-jr On further thought, the downside to that is that doing the calculation could cause The other possibility would be to add a new option to |
|
Concept ACK |
|
Needs rebase. |
2807329 to
bc9020c
Compare
|
Rebased. There weren't any actual conflicts though, so not sure why github thought it wouldn't merge cleanly? |
|
Thanks! |
Github-Pull: bitcoin#7292 Rebased-From: bf4fbe814df537e69d5b1092565efb6f8bb618b9
Github-Pull: bitcoin#7292 Rebased-From: 2409317c8ba1ea11b0bb519121f8c441439a71db
Github-Pull: bitcoin#7292 Rebased-From: 9644106526eea536cf056b4058a40b0dbbdbe32f
Github-Pull: bitcoin#7292 Rebased-From: 31ef9d5c649beea8812d2ba92f779d639e1c8b2c
Github-Pull: bitcoin#7292 Rebased-From: bc9020c1ab30ea9527ef63d4df4df10513f8756f
|
Rebase needed. |
|
Rebased. Also added a commit that extends the mempool entry output to include the ancestor state (added by #7594), as well as a brief update to the release notes. |
|
Unit tests are now failing on linux. I'll see if I can reproduce locally. |
|
Oh, I suppose it could be this: #8069 (comment) |
|
Looks like the travis issue was fixed by #8070, so I think this is ready now. |
|
reACK 5379307 |
|
utACK 5379307 |
|
Can one of the admins verify this patch? |
|
utACK 5379307a23177c33b5a869513d1d1d09790b0269 |
|
Is there anything holding this up? |
|
Can you squash the typo? |
67adf93 to
176e19b
Compare
|
@sipa done |
|
utACK 176e19b (same tree as before) |
176e19b Mention new RPC's in release notes (Suhas Daftuar) 7f6eda8 Add ancestor statistics to mempool entry RPC output (Suhas Daftuar) a9b8390 Add test coverage for new RPC calls (Suhas Daftuar) b09b813 Add getmempoolentry RPC call (Suhas Daftuar) 0dfd869 Add getmempooldescendants RPC call (Suhas Daftuar) 8f7b5dc Add getmempoolancestors RPC call (Suhas Daftuar) 5ec0cde Refactor logic for converting mempool entries to JSON (Suhas Daftuar)
… RPC 176e19b Mention new RPC's in release notes (Suhas Daftuar) 7f6eda8 Add ancestor statistics to mempool entry RPC output (Suhas Daftuar) a9b8390 Add test coverage for new RPC calls (Suhas Daftuar) b09b813 Add getmempoolentry RPC call (Suhas Daftuar) 0dfd869 Add getmempooldescendants RPC call (Suhas Daftuar) 8f7b5dc Add getmempoolancestors RPC call (Suhas Daftuar) 5ec0cde Refactor logic for converting mempool entries to JSON (Suhas Daftuar)
… RPC 176e19b Mention new RPC's in release notes (Suhas Daftuar) 7f6eda8 Add ancestor statistics to mempool entry RPC output (Suhas Daftuar) a9b8390 Add test coverage for new RPC calls (Suhas Daftuar) b09b813 Add getmempoolentry RPC call (Suhas Daftuar) 0dfd869 Add getmempooldescendants RPC call (Suhas Daftuar) 8f7b5dc Add getmempoolancestors RPC call (Suhas Daftuar) 5ec0cde Refactor logic for converting mempool entries to JSON (Suhas Daftuar)
This adds 3 new RPC calls (
getancestorsgetmempoolancestors,getdescendantsgetmempooldescendants, getmempoolentry) to expose more mempool information over RPC.Now that we have policy rules that are tied to transaction chains (including limits on the number of in-mempool ancestors and in-mempool descendants, and mempool eviction and RBF policies that depend on fees of descendants), it seems helpful to be able to expose more information about the chains a given tx is part of over RPC.
This is motivated by the discussion in #7222. @petertodd You mentioned wanting to see specific use-cases for this information; I think there are clear improvements to the fee-bumping tools in your replace-by-fee repo that could be made if we had these functions (the first two tools I looked at just now don't seem to consider transaction chains at all in fee calculations?). I'll try to post a link in this PR to specific proposed improvements when I have something to share that will demonstrate this more clearly.