Skip to content
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

IsAllFromMe #12508

Closed
wants to merge 7 commits into from
Closed

IsAllFromMe #12508

wants to merge 7 commits into from

Conversation

kallewoof
Copy link
Member

@kallewoof kallewoof commented Feb 22, 2018

Rebases #9167 by @morcos on master.

Why do this: this is mostly a refactor which fixes some bugs, e.g. fee in gettransaction for mixed owner inputs.

@ken2812221
Copy link
Contributor

What's the purpose of changing coding style?

@kallewoof
Copy link
Member Author

@ken2812221 To abide by the coding style conventions (see contributing on main page).

@laanwj laanwj added the Wallet label Feb 22, 2018
@morcos morcos mentioned this pull request Feb 22, 2018
@jnewbery
Copy link
Contributor

jnewbery commented Apr 4, 2018

Needs rebase

@kallewoof
Copy link
Member Author

kallewoof commented Apr 9, 2018

So, the new IsAllFromMe code does not check if GetDebit(ISMINE_ALL) > 0, which IsMine does. The result is that the existing code will say 'not eligible' and the new code will say 'eligible', for many of the coin selector test cases. I think adding a check for GetDebit to IsAllFromMe is the right approach, but I believe @morcos removed this part for a reason in #9167.

Ping @morcos. Still investigating the issue, so this may become irrelevant.

Edit: It seems this:

CTransaction(hash=777c42d727, ver=2, vin.size=0, vout.size=1, nLockTime=0)
    CTxOut(nValue=0.01000000, scriptPubKey=)

is considered all mine. Which technically speaking is correct, but CWalletTx::GetDebit explicitly returns 0 (i.e. not mine) for vin.empty(), so I might adapt that logic in IsAllFromMe as well.

@kallewoof
Copy link
Member Author

kallewoof commented Apr 9, 2018

I believe fdb1d59 (count 0-vin transactions as not mine in IsAllFromMe) and 5073476 (consider coinbase transaction as all mine in CWallet) address the problems, but I'm not sure the latter is entirely correct in all cases. If a random person checks a coinbase transaction, I think it will claim it is theirs now. I think adding a 'can spend' check should suffice here.

Edit: CWallet::IsAllFromMe is only used in the feebumper, and since coinbase transactions can't be fee-bumped anyway, 5073476 should be fine. To clarify: the IsFromMe code already behaves this way (i.e. consider coinbase transactions as from me, if in miner wallet); it may be worth it to fall back to IsFromMe style check of GetDebit(..) > 0 though.

@kallewoof kallewoof force-pushed the feature-isallfromme branch 2 times, most recently from 809ee29 to ee25bc5 Compare May 10, 2018 07:01
@Empact
Copy link
Member

Empact commented May 17, 2018

utACK ee25bc5

@sipa
Copy link
Member

sipa commented May 17, 2018

Can you add a PR description? It's unclear what this is trying to solve without reading the code (the same is true for the original PR, which lists the changes but not the goal).

@kallewoof
Copy link
Member Author

@sipa From my understanding (and I could be wrong), it's mostly a refactor which fixes some bugs, e.g. fee in gettransaction for mixed owner inputs. Am I missing something, @morcos? If not, I'll update the PR description.

@Empact
Copy link
Member

Empact commented May 18, 2018

@kallewoof I would draw from the commit messages, it's fairly clear if you interpret them in aggregate.

@kallewoof
Copy link
Member Author

@Empact That was what I intended with the above description. Did I miss anything?

@Empact
Copy link
Member

Empact commented May 21, 2018

Here's my interpretation of the commits:

  • Change OutputEligibleForSpending to only consider outputs trusted / mine if all their inputs are mine, rather than just one of them.
  • Change gettransaction rpc to only include fee information if all inputs pass the relevant filter, rather than just one.
  • Change CWallet::IsAllFromMeto consider coinbase transactions mine.

@kallewoof
Copy link
Member Author

@Empact That's a description of what is done, not what the purpose is, which is kinda what the original PR did. I think @sipa wants a description of why not what.

@DrahtBot DrahtBot closed this Jul 22, 2018
@DrahtBot
Copy link
Contributor

The last travis run for this pull request was 73 days ago and is thus outdated. To trigger a fresh travis build, this pull request should be closed and re-opened.

morcos and others added 6 commits September 10, 2018 10:13
Change coin selection in SelectCoinsMinConf to only consider coins mine for spending at the fewer required confirmations if all inputs being spent are mine instead of requiring at least one.
No change in behavior.  IsTrusted was already a stricter check.
Fee is now only displayed if all inputs meet the required filter, so if displayed the fee will always be correct.  Unusual fees may still be displayed in details.
@DrahtBot
Copy link
Contributor

DrahtBot commented Sep 21, 2018

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #14437 (Refactor: Start to separate wallet from node by ryanofsky)
  • #13756 (wallet: "avoid_reuse" wallet flag for improved privacy by kallewoof)
  • #12297 (Improve CWallet::IsAllFromMe for false results by promag)
  • #10973 (Refactor: separate wallet from node by ryanofsky)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@DrahtBot
Copy link
Contributor

DrahtBot commented Nov 9, 2018

Needs rebase

@kallewoof
Copy link
Member Author

Apologies for picking this up and then dropping the ball, but I don't feel comfortable in my understanding of this code enough to keep rebasing this beyond this point. I suggest reopening the original PR #9167 (marked up for grabs) and ignoring my work on top of it.

@kallewoof kallewoof closed this Nov 12, 2018
@kallewoof kallewoof deleted the feature-isallfromme branch November 12, 2018 04:56
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 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