Skip to content

Conversation

@morcos
Copy link
Contributor

@morcos morcos commented Jan 7, 2016

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:

  • Return abandoned status in listtransactions
  • Return abandoned status in GUI
  • Fix any issues with how abandoned txs should sort
  • Add a way to abandon transactions from GUI

I built this off of #7306 to make sure the tests would work correctly.

@luke-jr
Copy link
Member

luke-jr commented Jan 7, 2016

This is way too late for 0.12...

@morcos
Copy link
Contributor Author

morcos commented Jan 7, 2016

@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.

@luke-jr
Copy link
Member

luke-jr commented Jan 7, 2016

This situation isn't really any worse than the status quo from older versions...

Copy link
Contributor

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)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure can fix

@jonasschnelli
Copy link
Contributor

Concept ACK.
I agree it late for 0.12,... but I don't take a position on this (if it's saver to go with or without a such feature).

Would be nice to see some tests (especially when we tag this for 0.12).

@morcos
Copy link
Contributor Author

morcos commented Jan 7, 2016

Addressed @jonasschnelli's comment (thanks for quick review!) and reordered commits for simpler reading.

@morcos
Copy link
Contributor Author

morcos commented Jan 8, 2016

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...

Copy link
Contributor

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".

@kanzure
Copy link
Contributor

kanzure commented Jan 8, 2016

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.

@maflcko
Copy link
Member

maflcko commented Jan 8, 2016

abandonunconfirmedtransaction

How would you type that without any typos? I'd rather make the rpc short ("abandontx") and the documentation/GUI verbose.

@maflcko
Copy link
Member

maflcko commented Jan 8, 2016

Concept ACK 6d74a63154cca756d698d6022c694b21e7f43ac5

@laanwj laanwj added this to the 0.12.0 milestone Jan 8, 2016
@morcos
Copy link
Contributor Author

morcos commented Jan 8, 2016

Thanks for the review.
Addressed nits in RPC help and finalized the RPC test

Copy link
Member

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

@maflcko
Copy link
Member

maflcko commented Jan 8, 2016

Reviewed-tests ACK 21702ff

@morcos Please fix the travis issue (file not found)

@morcos
Copy link
Contributor Author

morcos commented Jan 8, 2016

oops sorry.
fixed typo and removed bitcoind argument from rpc test.

Copy link
Member

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.

Copy link
Contributor Author

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

@maflcko
Copy link
Member

maflcko commented Jan 8, 2016

QT-tested ACK d716866

screenshot from 2016-01-08 20-41-15
Nit: Qt balance != getwalletinfo

Copy link
Contributor

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.

@jonasschnelli
Copy link
Contributor

Tested ACK (also ack on a 0.12 bp, because it's a wallet only change)
Nits:

  • missing update signal (see above)
  • missing flag in listtransactions.

@jonasschnelli
Copy link
Contributor

Addressed the nits and a cosmetic change for GUI in: morcos#6

@morcos
Copy link
Contributor Author

morcos commented Jan 11, 2016

@jonasschnelli , thanks! I added your notify commit. I left the other changes for a separate pull.

@morcos
Copy link
Contributor Author

morcos commented Jan 11, 2016

Ok updated after speaking to @jonasschnelli
I think this is good now

@PRabahy
Copy link
Contributor

PRabahy commented Jan 12, 2016

@maflcko
Copy link
Member

maflcko commented Jan 12, 2016

@PRabahy sure, but I don't think this is part of this pull.

morcos and others added 3 commits January 13, 2016 08:42
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.
@morcos
Copy link
Contributor Author

morcos commented Jan 13, 2016

Addressed @laanwj's concern about clearly identifying constant

@laanwj laanwj merged commit d11fc16 into bitcoin:master Jan 13, 2016
laanwj added a commit that referenced this pull request Jan 13, 2016
d11fc16 [Wallet] Call notification signal when a transaction is abandoned (Jonas Schnelli)
df0e222 Add RPC test for abandoned and conflicted transactions. (Alex Morcos)
01e06d1 Add new rpc call: abandontransaction (Alex Morcos)
9e69717 Make wallet descendant searching more efficient (Alex Morcos)
laanwj pushed a commit that referenced this pull request Jan 13, 2016
- 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
morcos added a commit to morcos/bitcoin that referenced this pull request Jan 13, 2016
- 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
@laanwj laanwj mentioned this pull request Jan 13, 2016
random-zebra added a commit to PIVX-Project/PIVX that referenced this pull request Oct 9, 2019
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
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants