IsAllFromMe #9167

Open
wants to merge 7 commits into
from

Projects

None yet

5 participants

@morcos
Contributor
morcos commented Nov 15, 2016 edited

Created a new wallet and walletTx function IsAllFromMe which correctly computes whether all the inputs to a transaction match the requested IsMine filter.

This will be useful for the bumpfee rpc command.

  • Commits 1, 2, and 7 add the new function and remove the old walletTx IsFromMe.
  • Commit 3 update IsTrusted to use the new function. No change in behavior as long as vin.size() > 0. Open question as to whether this should be changed to use ISMINE_ALL?
  • Commit 5 remove code that was already redundant because of call to IsTrusted
  • Commit 4 make a small change to SelectCoinsMinConf to only consider new outputs spendable quickly if all the inputs were ours, not just at least one.
  • Commit 6 changes the output in gettransaction for mixed debit transactions where some inputs were ours and some weren't. It'll report the correct fee if possible, otherwise 0. Note that the fee reported in the details and any other function which depends on ListTransactions is not changed as getbalance("*") depends on having incorrect negative fees calculated on mixed debit transactions in order to track the right balances.

Note that there are other places in the code such as AddToWalletIfInvolvingMe which ideally would be updated to distinguish between 0 satoshi prevouts that are "MINE" and prevouts that aren't "MINE".

@fanquake fanquake added the Wallet label Nov 16, 2016
@jonasschnelli
Member

Concept ACK

@gmaxwell
Member

Fee: 0 is perhaps confusing?

SelectCoinsMinConf behavior change sounds great.

@AdamISZ Joinmarket results in a lot of transactions like this, thoughts?

@morcos
Contributor
morcos commented Nov 29, 2016 edited

@gmaxwell I think that was just a mistake in my description, it looks like it doesn't report anything for the fee unless it has the correct fee. If it can't calculate the fee it doesn't subtract anything when reporting the amount.

@morcos
Contributor
morcos commented Dec 5, 2016

rebased after #8580

@gmaxwell
Member
gmaxwell commented Dec 9, 2016

I expected this to leave out the fee field on coinjoins in listtransactions and gettransaction but find it isn't:

$ ./bitcoin-cli gettransaction 14947302eab0608fb2650a05f13f6f30b27a0a314c41250000f77ed904475dbb | grep fee
"fee": 50000.31337000,

@morcos
Contributor
morcos commented Dec 13, 2016

I replaced the first commit with a different formulation by @sdaftuar that I like better. The functionality is the same and all the other commits are unchanged.

@morcos
Contributor
morcos commented Jan 4, 2017

@gmaxwell from IRC in regards to listtransactions and gettransaction:

14:01:01 < morcos> if you ran that same command on the old code your grep would find fee twice
14:01:26 < morcos> it prints an overall fee for the transaction and it prints a fee for each accounting entry
14:02:15 < morcos> it was already the case that if it didn't think the tx was from you (meaning none of it was from you) it would leave off the overall fee for the tx
14:02:42 < gmaxwell> ah, I see. what the heck is the fee for the accounting entries for?
14:02:43 < morcos> i changed that logic to be whether all of it was from you
14:02:52 < morcos> don't get me started on that
14:03:23 < morcos> getbalance("*") uses those random incorrect negative fees to offset other errors in tracking balances
14:03:29 < morcos> so it was not possible to fix those
14:03:49 < morcos> i suppose we could not print them, but that seems like an api change
@gmaxwell
Member
gmaxwell commented Jan 4, 2017

ACK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment