-
Notifications
You must be signed in to change notification settings - Fork 37.8k
Fixes for when listtransactions encounters non-standard outputs #1850
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
Needs to be addressed: when the address is unavailable, should the "address" key be absent, null, or something else? Current code here does the "absent" option. |
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/1a5eb4636d038fdf623924c0d236c915ddcb9bdb for binaries and test log. |
static void MaybePushAddress(Object & entry, const CTxDestination &dest) | ||
{ | ||
CBitcoinAddress addr; | ||
if (!addr.Set(dest)) |
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: if (addr.Set(dest)) entry.push_back() would be clearer logic.
This is high risk for breaking existing applications; in addition to careful code review I would really like there to be a test plan, or, even better, until tests that fully exercise all of the code paths in CWalletTx::GetAmounts. |
I hope no application depends on the random data being produced, so I think this should be treated as a bugfix. |
if (nDebit > 0) | ||
listSent.push_back(make_pair(address, txout.nValue)); | ||
|
||
if (pwallet->IsMine(txout)) | ||
if (fIsMine) |
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.
This if is redundant, if fIsMine is false, we already bailed out.
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.
It shouldn't be, thanks for noticing the bug :)
Fixed the bug @sipa found, and commented CWalletTx::GetAmounts better so the flow is more understandable. I'll get to tests later. |
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/d2233dbcf4bf520370ffbd59b1a42718e4f68d27 for binaries and test log. |
Looks like just code movement to me (except the address = CNoDestination()), ACK. I haven't tested though. |
Needs a test plan; see https://github.com/bitcoin/QA for a test plan skeleton. |
…Tx::GetAmounts This fixes a warning when an output we aren't concerned with can't be parsed.
…ation isn't recognized Previously, it would pass corrupt/random through base58.
Fixed @gavinandresen 's nit and a bug I thought @jgarzik reported with it (though it seems to have vanished here...), and rebased. I am not sure how to create a test plan for these particular fixes. I believe the conditions to trigger the bug can only occur when some other (eg, newer) client has accepted wallet transactions that the currently running version does not understand. |
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/cc6cfab38fcdd4ec3e4784e01c4407a129289f77 for binaries and test log. |
Is this the last version and rebased to current master? If yes I'm going to try if this fixes my problem in #3006. |
@luke-jr Can you please rebase this or is it mergable? |
CTxDestination address; | ||
vector<unsigned char> vchPubKey; | ||
if (!ExtractDestination(txout.scriptPubKey, address)) | ||
{ | ||
printf("CWalletTx::GetAmounts: Unknown transaction type found, txid %s\n", |
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.
This creates a merge-conflict ^^.
@luke-jr Are you still around here or don't you participate anymore? |
This is on my list of old pulls to get resolved. After reviewing the code again, I'm planning on:
|
Pulled (after testing using https://bitcoincore.org/~gavin/createpaymentrequest.php and fixing the trivial merge conflict). |
…oins selection flow removed. 5935497 Making CPivStake immutable. (furszy) af1bf37 wallet::CreateCoinStake set missing pindeFrom in stakeInput. (furszy) f935801 wallet: Implement a slightly different StakeableCoins, initializing and returning CStakeableOutput. (furszy) bbc7d77 wallet: CheckTXAvailability returning the block index if is requested. (furszy) d8dbf49 CPivStake: Introducing SetIndexFrom method. (furszy) 9a5c090 wallet: Introducing StakeableOutput class. (furszy) f9edbd5 wallet: AvailableCoins using the new CheckOutputAvailability method. (furszy) 7212f79 Wallet: new CheckOutputAvailability method implemented. Decoupling and cleaning the output availability checks from AvailableCoins (furszy) 1128da0 CPivStake: make pindexFrom member const (furszy) 3c27c3d CPivStake: removing unreachable code from GetIndexFrom(). (furszy) a5c759c CPivStake: store only the needed CTxOut and COutPoint data and not the entire transaction. (furszy) 0cd01a4 CStakeInput: remove unused GetTxFrom method. (furszy) Pull request description: Essentially, this work is removing an unneeded `GetTransaction` call from `CPivStake::GetIndexFrom` for every stakeable output during each cycle of the staking process. As `GetTransaction` is a direct access to disk (txindex), this means faster staking. Future work, the methods `StakeableCoins` and `AvailableCoins` can be abstracted even more. They are sharing almost the same code with an specific distinction that makes this change possible without introducing an extra blockIndex set into `AvailableCoins`. ACKs for top commit: random-zebra: But these are just styling changes, so if you're not happy making them, I'm fine with the PR as is. Tested ACK 5935497 Fuzzbawls: ACK 5935497 Tree-SHA512: cc34443c16f678c51529a5e3cf682ab5c8edadb9c0c307130a93f9f5d1cc0707121cbb278c86197d595c679e479b7850c21180334a196d7e72d064feac267525
Bugfix: Avoid trying to parse outputs that aren't relevant to CWalletTx::GetAmounts
Bugfix: Supress "address" key in transaction details, when the destination isn't recognized
Fixes #779 and #1848.