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

rpc: Add min_conf option to fund transaction calls #14641

Open
wants to merge 4 commits into
base: master
from

Conversation

Projects
None yet
9 participants
@promag
Copy link
Member

promag commented Nov 2, 2018

This PR adds min_conf option to fundrawtransaction and walletcreatefundedpsbt RPC.

Fixes #14542.

@DrahtBot

This comment has been minimized.

Copy link
Contributor

DrahtBot commented Nov 2, 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:

  • #14918 (RPCHelpMan: Check default values are given at compile-time by MarcoFalke)
  • #14582 (wallet: try -avoidpartialspends mode and use its result if fees do not change by kallewoof)

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.

@promag

This comment has been minimized.

Copy link
Member

promag commented Nov 2, 2018

Will add release notes and tests after some concept ACK.

@gmaxwell

This comment has been minimized.

Copy link
Member

gmaxwell commented Nov 3, 2018

What is the max_conf for?

@promag

This comment has been minimized.

Copy link
Member

promag commented Nov 3, 2018

@gmaxwell just followed listunspent options.

"listunspent ( minconf maxconf [\"addresses\",...] [include_unsafe] [query_options])\n"
"\nReturns array of unspent transaction outputs\n"
"with between minconf and maxconf (inclusive) confirmations.\n"
"Optionally filter to only include txouts paid to specified addresses.\n"
"\nArguments:\n"
"1. minconf (numeric, optional, default=1) The minimum confirmations to filter\n"
"2. maxconf (numeric, optional, default=9999999) The maximum confirmations to filter\n"

@jonasschnelli

This comment has been minimized.

Copy link
Member

jonasschnelli commented Nov 4, 2018

Concept ACK.
The max_conf usefulness ist doubtable,... but maybe acceptable to be consistent with listunspent (and it's a argument based option-object even in non-argument based RPC calls).

@promag

This comment has been minimized.

Copy link
Member

promag commented Nov 4, 2018

Is it reasonable to add these options to coin control?

@conscott
Copy link
Contributor

conscott left a comment

Concept ACK

Maybe you can add some test cases to the rpc_fundrawtransaction.py as well to make sure coin selection fails if conditions are not met?

Nevermind, I see the note about tests.

@gmaxwell

This comment has been minimized.

Copy link
Member

gmaxwell commented Nov 6, 2018

I believe the max exists for listunspent so that with the other flags you can see only unconfirmed outputs, which wouldn't apply here, I think.

The maximum argument turns out to be a severe nuisance on listunspent because 99.99999% of the time you want it set to maximum and 'maximum' is some arbitrary big number but too big and the rpc is rejected (and that threshold even changed once, breaking all my spending automation). ... but there it's not an optional argument, so I think the same nuisance wouldn't apply here.

Still, we're left with functionality being added where no one can articulate a reason. I don't think that is acceptable, esp where if it ever became useful it could be added without breaking compatibility.

@promag

This comment has been minimized.

Copy link
Member

promag commented Nov 7, 2018

@gmaxwell I'm happy to remove max_conf here, as it isn't required for #14542. However it can be acceptable to create a transaction with fresh inputs, especially with 0 confirmations?

@MeshCollider

This comment has been minimized.

Copy link
Member

MeshCollider commented Nov 8, 2018

@promag I think in such a specific case they can manually pick the inputs to fund the transaction with, I agree with the comments above and think max_conf is probably not the most useful

@promag promag force-pushed the promag:2018-11-fundrawtransaction branch from d5e1b6c to d430696 Nov 12, 2018

@promag promag changed the title RPC: Add min/max confirmation options to fund transaction calls rpc: Add min_conf option to fund transaction calls Nov 12, 2018

@promag

This comment has been minimized.

Copy link
Member

promag commented Nov 12, 2018

Rebased and removed max_conf option. Please concept ACK to add release note and tests.

@DrahtBot DrahtBot removed the Needs rebase label Nov 12, 2018

@promag promag force-pushed the promag:2018-11-fundrawtransaction branch from d430696 to 235bd74 Nov 12, 2018

@promag
Copy link
Member

promag left a comment

Current default for min_conf is 0.

Show resolved Hide resolved src/wallet/rpcwallet.cpp Outdated
Show resolved Hide resolved src/wallet/rpcwallet.cpp Outdated
@MeshCollider

This comment has been minimized.

Copy link
Member

MeshCollider commented Nov 22, 2018

Concept ACK

1 similar comment
@laanwj

This comment has been minimized.

Copy link
Member

laanwj commented Nov 23, 2018

Concept ACK

@promag promag force-pushed the promag:2018-11-fundrawtransaction branch 2 times, most recently from 0c328a4 to 2b11f02 Dec 4, 2018

@promag

This comment has been minimized.

Copy link
Member

promag commented Dec 4, 2018

Added tests and release notes. Is this useful for 0.17 branch (after 0.17.1)?

@promag promag force-pushed the promag:2018-11-fundrawtransaction branch from 2b11f02 to 493047a Dec 5, 2018

Show resolved Hide resolved src/wallet/rpcwallet.cpp Outdated

@DrahtBot DrahtBot removed the Needs rebase label Dec 5, 2018

@promag promag force-pushed the promag:2018-11-fundrawtransaction branch from 493047a to 3831c98 Dec 6, 2018

@promag promag force-pushed the promag:2018-11-fundrawtransaction branch from 3831c98 to 78c9eef Dec 11, 2018

@promag

This comment has been minimized.

Copy link
Member

promag commented Dec 11, 2018

Rebased.

@gmaxwell

This comment has been minimized.

Copy link
Member

gmaxwell commented Dec 12, 2018

:( I hate to say it, but I think this runs into the problems resolving #14602. In short, you almost never want to spend coins that come from third parties without confirmation (as they could be doublespent, causing you to double spend someone) but you almost always do want to be willing to use your own change unconfirmed if its required to get enough funds-- otherwise you'll have seemingly inexplicable failures due to coins being tied up by other unconfirmed transactions.

@promag

This comment has been minimized.

Copy link
Member

promag commented Dec 17, 2018

@gmaxwell I think it's reasonable to have both ways to filter unspents?

@luke-jr

This comment has been minimized.

Copy link
Member

luke-jr commented Dec 20, 2018

utACK (despite the issue @gmaxwell points out, I think this is still an improvement..)

@promag

This comment has been minimized.

Copy link
Member

promag commented Jan 18, 2019

Ping @gmaxwell.

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