-
Notifications
You must be signed in to change notification settings - Fork 38.8k
[RPC] fundrawtransaction #5503
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] fundrawtransaction #5503
Conversation
62ef48e to
88de6ee
Compare
|
As |
src/rpcrawtransaction.cpp
Outdated
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.
s/exiting/existing
|
ACK the idea. It seems useful. |
|
Sweet. This should have a mechenism to also include watchonly coins. |
|
It should support existing VINs, which are useful if you want to specifically spend a particular coin, but need more inputs to complete the txn. One reason you may want to do this is to achieve mutual exclusion with a prior transaction. If the existing vins are adequate it shouldn't add any more. |
|
Also, not to pile on too much, but a "fundmany" would be neat as well (in addition to watchonly support in fundrawtransaction). This would be useful for batch coin selection, offline signing, and coinjoin. Plus, fundmany is not a huge jump from sendmany. Also, gmaxwell proposed on IRC a limit=N parameter on fundrawtransaction? |
e1ea764 to
db8b682
Compare
|
Added support for existing VINs. @gmaxwell the proposed |
db8b682 to
a271e54
Compare
a271e54 to
3ab9e72
Compare
|
Just fixed an issue in |
Support watchonly in fundrawtransaction, CreateTransaction, SelectCoins and coin selection in general. Coin selection is exposed over RPC through fundrawtransaction, and watchonly can be enabled by passing includeWatching true (defaults to false). fundrawtransaction will first attempt to fund a transaction without using watchonly, even when includeWatching is enabled. When this fails, an includeWatching attempt is made. When an includeWatching attempt at coin selection is performed (in CreateTransaction), and all watchonlys are consumed leaving no funds available for a fee, then CreateTransaction will not include a fee in the transaction. Also, includeWatching tests (for fundrawtransaction). See also: bitcoin#5503
src/wallet.cpp
Outdated
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.
s/temporary/temporarily
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.
Thanks. Fixed.
92dcfa0 to
1f8f85b
Compare
|
needs rebase (assigned 0.11 milestone, would be nice to have this) |
1f8f85b to
0e093a7
Compare
|
rebased. Moved RPC function "fundrawtransaction()" from |
bcd0359 to
9ffa175
Compare
- fix typo - fix RPCTypeCheck for fundrawtransaction - some comments - merged with subtractFeeFromAmout patch (non trivial)
- serialize transaction size calculation (aka dummy-signing) without the need of signing the transaction (wallet can be locked to use fundrawtransaction) - rename VINS to vInputs
fundrawtransaction requires a wallet and therefore it belongs to rpcwallet.cpp
rpc dispatch tables reqWallet has been removed.
9ffa175 to
79858cd
Compare
|
rebased. |
|
I needed to use this for something and rewrote/tweaked a few chunks. See changes at https://github.com/TheBlueMatt/bitcoin/tree/frt |
# Conflicts: # src/rpcserver.cpp
|
Pulled in some commits from @TheBlueMatt. Only pulled in clear beneficial and easy reviewable commits. Other things (CCoinControl usage, watch-only support) may be better handled in a 2nd pull request to avoid large changeset. |
# Conflicts: # src/wallet/rpcwallet.cpp
f1e48f4 to
840b89b
Compare
|
@jonasschnelli Actually, the changes I made were mostly to limit the size of this pull request. Some of them look like it would become a big pull request, but once squashed, the total size is actually smaller than the original :) |
|
Also, not sure when you pulled in, but I force pushe'd a few times, you may want to check that the ones you merged are the latest versions (I'm done now, I think). I also merged in a tweaked-up version of fundrawtransaction there. |
|
@TheBlueMatt Thank you for your tweaks! Will try to go through the optimizing commits but need a clear head for that. Will do it soon. |
|
I added two more commits to that tree and made a nice rebased version at https://github.com/TheBlueMatt/bitcoin/commits/frt2 |
|
Rebased frt2. @jonasschnelli do you want to review my changes and merge them here, or should I just open a new pull request? I'd like to keep this moving. |
|
closing in favor of #6088 |
Support watchonly in fundrawtransaction, CreateTransaction, SelectCoins and coin selection in general. Coin selection is exposed over RPC through fundrawtransaction, and watchonly can be enabled by passing includeWatching true (defaults to false). fundrawtransaction will first attempt to fund a transaction without using watchonly, even when includeWatching is enabled. When this fails, an includeWatching attempt is made. When an includeWatching attempt at coin selection is performed (in CreateTransaction), and all watchonlys are consumed leaving no funds available for a fee, then CreateTransaction will not include a fee in the transaction. Also, includeWatching tests (for fundrawtransaction). See also: bitcoin#5503
Basic implementation of a new rpc call
fundrawtransaction.This call will fill a rawtransaction containing only vouts with unspent coins from the wallet.
Currently there is no way to return the
CReserveKeyto the keypool.