-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Add RPC call abandontransaction #7312
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
|
This is way too late for 0.12... |
|
@luke-jr I don't think we can release 0.12 without this. With mempool eviction combined with the new behaviour that unconfirmed txs still tie up the coins they spend even if the txs are not in the mempool, users may end up with permanently unspendable coins frequently. We discussed making this change in conjunction with the other changes back in November, but it appears to have slipped through the cracks. |
|
This situation isn't really any worse than the status quo from older versions... |
src/wallet/wallet.cpp
Outdated
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.
CMerkleTx::GetDepthInMainChain() is slightly expansive (and IsSpent() gets called a lot). Would caching mit->second.GetDepthInMainChain() make sense? Or do we expect the compiler does it internally (I don't think so)?
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.
sure can fix
|
Concept ACK. Would be nice to see some tests (especially when we tag this for 0.12). |
|
Addressed @jonasschnelli's comment (thanks for quick review!) and reordered commits for simpler reading. |
|
oops, i didn't mean to push that RPC test yet, it was still in progress, but might as well leave it there for now... |
src/wallet/rpcwallet.cpp
Outdated
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.
consistency nit: all the other fHelp messages use "transaction" and "transactions" instead of "tx" and "txs".
|
I think a name like "abandonlocaltransaction" or "abandonunconfirmedtransaction" could help to minimize ambiguity. But I would consider this a very low priority suggestion, because this RPC call is only available when the wallet is enabled. |
How would you type that without any typos? I'd rather make the rpc short ("abandontx") and the documentation/GUI verbose. |
|
Concept ACK 6d74a63154cca756d698d6022c694b21e7f43ac5 |
|
Thanks for the review. |
qa/pull-tester/rpc-tests.py
Outdated
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.
abandonconflicts.py: No such file or directory
|
Reviewed-tests ACK 21702ff @morcos Please fix the travis issue (file not found) |
|
oops sorry. |
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.
Shouldn't resendwallettransactions do the same? I get the empty array on resendwallettransactions.
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.
I thought it made sense that abandoned transactions would not be automatically resent.
That way when you restart a bitcoind with transactions that you've tried to abandon, it wouldn't automatically try to send them all again
|
QT-tested ACK d716866 |
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.
I think here we also need a NotifyTransactionChanged(this, wtx.GetHash(), CT_UPDATED); Otherwise the signal listeners (UI) can't recalculate the balance.
|
Tested ACK (also ack on a 0.12 bp, because it's a wallet only change)
|
|
Addressed the nits and a cosmetic change for GUI in: morcos#6 |
|
@jonasschnelli , thanks! I added your notify commit. I left the other changes for a separate pull. |
|
Ok updated after speaking to @jonasschnelli |
|
Does https://github.com/bitcoin/bitcoin/blob/master/contrib/bitcoind.bash-completion need to get updated with this change? |
|
@PRabahy sure, but I don't think this is part of this pull. |
Unconfirmed transactions that are not in your mempool either due to eviction or other means may be unlikely to be mined. abandontransaction gives the wallet a way to no longer consider as spent the coins that are inputs to such a transaction. All dependent transactions in the wallet will also be marked as abandoned.
|
Addressed @laanwj's concern about clearly identifying constant |
- Make wallet descendant searching more efficient - Add new rpc call: abandontransaction Unconfirmed transactions that are not in your mempool either due to eviction or other means may be unlikely to be mined. abandontransaction gives the wallet a way to no longer consider as spent the coins that are inputs to such a transaction. All dependent transactions in the wallet will also be marked as abandoned. - Add RPC test for abandoned and conflicted transactions. - [Wallet] Call notification signal when a transaction is abandoned Github-Pull: #7312 Rebased-From: 9e69717 01e06d1 df0e222 d11fc16
- Make wallet descendant searching more efficient - Add new rpc call: abandontransaction Unconfirmed transactions that are not in your mempool either due to eviction or other means may be unlikely to be mined. abandontransaction gives the wallet a way to no longer consider as spent the coins that are inputs to such a transaction. All dependent transactions in the wallet will also be marked as abandoned. - Add RPC test for abandoned and conflicted transactions. - [Wallet] Call notification signal when a transaction is abandoned Github-Pull: bitcoin#7312 Rebased-From: 9e69717 01e06d1 df0e222 d11fc16
91b48c7 [Build] Add new merkle files to CMake lists (warrows) 48a3aff [Wallet] Ignore coinbase and zc tx "conflicts" (warrows) 3572354 [Wallet] Fix an error in tx depth computation (warrows) 6928369 [Tests] Enable abandonconflict functional test (warrows) 34cd496 Fix that CWallet::AbandonTransaction would only traverse one level (Ben Woosley) aba5b75 Fix calculation of balances and available coins. (Alex Morcos) 48d705f Remove stale wallet transactions on initial load. (presstab) 12985ae Flush wallet after abandontransaction (Alex Morcos) 8f87956 [Wallet] sort pending wallet transactions before reaccepting (dexX7) 9c2f445 [Wallet] Call notification signal when a transaction is abandoned (Jonas Schnelli) 778ebf3 Add new rpc call: abandontransaction (Alex Morcos) 0e86c3e Make wallet descendant searching more efficient (Alex Morcos) d0083a8 Make sure conflicted wallet tx's update balances (Alex Morcos) 6a50e03 [Wallet] Keep track of explicit wallet conflicts instead of using mempool (warrows) 7ccb2b5 [Wallet] Do not flush the wallet in AddToWalletIfInvolvingMe(..) (warrows) 47345be [Refactor] Move wallet functions out of header (warrows) ab9efb8 [Wallet] Switch to a constant-space Merkle root/branch algorithm (warrows) 5447622 [Wallet] Do not store Merkle branches in the wallet (warrows) Pull request description: This pull request is a happy melting pot of improvements regarding transactions handling. Most of them are backports from bitcoin. I advise reviewers to check the code of the different commits independently to understand them more easily. However, testing is probably better done all at once. I am making a single pull request because these changes are all entangled and introducing some of them without others would probably introduce temporary bugs. ## Commits details ## - 6c3e2ac backport of bitcoin#6550 - 5304fdf backport of bitcoin#6508 - c3eeeac simple code move from the header to the cpp file. It contains no functional change. - 6cc4d37 backport of bitcoin#4805 - 10be1db backport of bitcoin#7105 - 8a34c32 backport of bitcoin#7306 - 3caf123, 9e17178 and 240f5b4 are the backport for bitcoin#7312 - ad6d0b1 backport of bitcoin#5511 - fcc07c3562 backport of bitcoin#9311 - 5ed5e266794 is an update of #825 - 392d504 backport of bitcoin#7715 - 7199f3a backport of bitcoin#13652 - f09d999 enables and fixes the test from bitcoin#7312 - 4fd43c5 fixes an oversight in bitcoin#7105 backport ACKs for top commit: random-zebra: ACK 91b48c7 Fuzzbawls: ACK 91b48c7 Tree-SHA512: 2628cebe98805b8048b920b51ee26fd4f0c53643d78da9b8cb265aede52dfe1d40c8c19d34293c232c5c35be7f1ab89ff5b4a07073a4b27c371ea70eb8708669

Unconfirmed transactions that are not in your mempool either due to eviction or other means may be unlikely to be mined. abandontransaction gives the wallet a way to no longer consider as spent the coins that are inputs to such a transaction. All dependent transactions in the wallet will also be marked as abandoned.
@laanwj also for 0.12
This is the basic functionality.
There are more things to add though. I have an RPC test in progress, but if anyone else wants to work on the remaining items, please do:
I built this off of #7306 to make sure the tests would work correctly.