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.
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".
Fee: 0 is perhaps confusing?
SelectCoinsMinConf behavior change sounds great.
@AdamISZ Joinmarket results in a lot of transactions like this, thoughts?
@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.
rebased after #8580
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
[wallet] Add IsAllFromMe: true if all inputs are from wallet
add wtx caching of IsAllFromMe
Replace calculation in IsTrusted
Only consider coins as mine for spending if all inputs are mine
Remove redundant check for IsFromMe
Only calculate fee in gettransaction if we are sure we can
inline last case of wtx.IsFromMe and remove function
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.
@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