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

Implement watchonly support in fundrawtransaction #6415

Merged
merged 10 commits into from Aug 14, 2015
Merged

Conversation

@TheBlueMatt
Copy link
Contributor

TheBlueMatt commented Jul 10, 2015

No description provided.

@TheBlueMatt
Copy link
Contributor Author

TheBlueMatt commented Jul 10, 2015

Realized I forgot to submit this after #6088....

@jonasschnelli
Copy link
Member

jonasschnelli commented Jul 14, 2015

Needs rebase

@laanwj laanwj added the Feature label Jul 17, 2015
@TheBlueMatt TheBlueMatt force-pushed the TheBlueMatt:frt3 branch 2 times, most recently Jul 17, 2015
TheBlueMatt added 8 commits Jun 10, 2015
This indicates that, eg, we have a public key for a key which may
be used as a pay-to-pubkey-hash. It generally means that we can
create a valid scriptSig except for missing private key(s) with
which to create signatures.
Some code and test cases stolen from
Bryan Bishop <bryan@ledgerx.com> (pull #5524).
@TheBlueMatt TheBlueMatt force-pushed the TheBlueMatt:frt3 branch to 6bdb474 Jul 20, 2015
@jgarzik
Copy link
Contributor

jgarzik commented Jul 23, 2015

ut ACK

@sipa

This comment has been minimized.

Copy link

sipa commented on src/wallet/wallet_ismine.h in d3354c5 Aug 8, 2015

Nit: the distinction here is really whether we know the script to sign with. Mind calling it ISMINE_WATCH_DESTINATION (as in: we're overriding our decision about whether we know how to sign for a particular destination) or ISMINE_WATCH_KEY (as in: we're overriding our decision about whether we know how to sign for a particular key).

This comment has been minimized.

Copy link
Owner Author

TheBlueMatt replied Aug 8, 2015

Maybe ISMINE_WATCH_(UN)SIGNABLE to make it really explicit what we're talking about?

This comment has been minimized.

Copy link

sipa replied Aug 8, 2015

Every watch-only result is unsignable... or we wouldn't need to watch it :)

How about ISMINE_WATCH_UNKNOWN_SCRIPT?

This comment has been minimized.

Copy link
Owner Author

TheBlueMatt replied Aug 8, 2015

Oops, meant ISMINE_WATCH_(UN)SOLVEABLE

This comment has been minimized.

Copy link

sipa replied Aug 8, 2015

This comment has been minimized.

Copy link
Owner Author

TheBlueMatt replied Aug 8, 2015

Done.

@sipa

This comment has been minimized.

Copy link

sipa commented on src/wallet/rpcdump.cpp in 907a425 Aug 10, 2015

I guess in theory you could import and p2pkh address as p2sh, by importing the p2pkh script as redeemscript. But that's probably pointless and confusing.

@sipa
Copy link
Member

sipa commented Aug 10, 2015

Untested ACK.

@sipa
Copy link
Member

sipa commented Aug 10, 2015

@sipa
Copy link
Member

sipa commented Aug 10, 2015

@laanwj
Copy link
Member

laanwj commented Aug 14, 2015

utACK

@laanwj laanwj merged commit d042854 into bitcoin:master Aug 14, 2015
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
laanwj added a commit that referenced this pull request Aug 14, 2015
d042854 SQUASH "Implement watchonly support in fundrawtransaction" (Matt Corallo)
428a898 SQUASH "Add have-pubkey distinction to ISMINE flags" (Matt Corallo)
6bdb474 Implement watchonly support in fundrawtransaction (Matt Corallo)
f5813bd Add logic to track pubkeys as watch-only, not just scripts (Matt Corallo)
d3354c5 Add have-pubkey distinction to ISMINE flags (Matt Corallo)
5c17059 Update importaddress help to push its use to script-only (Matt Corallo)
a1d7df3 Add importpubkey method to import a watch-only pubkey (Matt Corallo)
907a425 Add p2sh option to importaddress to import redeemScripts (Matt Corallo)
983d2d9 Split up importaddress into helper functions (Matt Corallo)
cfc3dd3 Also remove pay-2-pubkey from watch when adding a priv key (Matt Corallo)
bitcartel added a commit to bitcartel/zcash that referenced this pull request Apr 2, 2019
str4d added a commit to str4d/zcash that referenced this pull request Nov 14, 2019
Zcash: Excludes comments for variables and functions we don't have:

- fAcceptDatacarrier (bitcoin/bitcoin#6961)
- GetScriptForRawPubKey (bitcoin/bitcoin#6415)
- GetScriptForWitness (bitcoin/bitcoin#8149)
str4d added a commit to str4d/zcash that referenced this pull request Nov 14, 2019
Previously this was an inline test where the specificity was probably judged
overly specific. As a class method it makes sense to maintain consistency.

And replace some magic values with their constant equivalents.

Zcash: Excludes changes to the following functions we don't have:

- ExtractPubKey (bitcoin/bitcoin#6415)
- IsCompressedPubKey (bitcoin/bitcoin#8499)
zkbot added a commit to zcash/zcash that referenced this pull request Dec 3, 2019
Bitcoin 0.12 wallet PRs 1

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6057
- bitcoin/bitcoin#6415

Part of #2074. Closes #3700.
str4d added a commit to str4d/zcash that referenced this pull request Dec 3, 2019
Zcash: Excludes comments for variables and functions we don't have:

- fAcceptDatacarrier (bitcoin/bitcoin#6961)
- GetScriptForRawPubKey (bitcoin/bitcoin#6415)
- GetScriptForWitness (bitcoin/bitcoin#8149)
str4d added a commit to str4d/zcash that referenced this pull request Dec 3, 2019
Previously this was an inline test where the specificity was probably judged
overly specific. As a class method it makes sense to maintain consistency.

And replace some magic values with their constant equivalents.

Zcash: Excludes changes to the following functions we don't have:

- ExtractPubKey (bitcoin/bitcoin#6415)
- IsCompressedPubKey (bitcoin/bitcoin#8499)
str4d added a commit to str4d/zcash that referenced this pull request Dec 4, 2019
Zcash: Excludes comments for variables and functions we don't have:

- GetScriptForRawPubKey (bitcoin/bitcoin#6415)
- GetScriptForWitness (bitcoin/bitcoin#8149)
str4d added a commit to str4d/zcash that referenced this pull request Dec 4, 2019
Previously this was an inline test where the specificity was probably judged
overly specific. As a class method it makes sense to maintain consistency.

And replace some magic values with their constant equivalents.

Zcash: Excludes changes to the following functions we don't have:

- ExtractPubKey (bitcoin/bitcoin#6415)
- IsCompressedPubKey (bitcoin/bitcoin#8499)
furszy added a commit to furszy/PIVX that referenced this pull request Jun 18, 2020
Previously this was an inline test where the specificity was probably judged
overly specific. As a class method it makes sense to maintain consistency.

And replace some magic values with their constant equivalents.

Zcash: Excludes changes to the following functions we don't have:

- ExtractPubKey (bitcoin#6415)
- IsCompressedPubKey (bitcoin#8499)
furszy added a commit to furszy/PIVX that referenced this pull request Jun 18, 2020
Previously this was an inline test where the specificity was probably judged
overly specific. As a class method it makes sense to maintain consistency.

And replace some magic values with their constant equivalents.

Excludes changes to the following functions we don't have:

- ExtractPubKey (bitcoin#6415)
- IsCompressedPubKey (bitcoin#8499)
furszy added a commit to PIVX-Project/PIVX that referenced this pull request Jun 28, 2020
fc81158 [QA] Add test_change_position case to rpc_fundrawtransaction.py (random-zebra)
dd35760 [QA] Add test_option_feerate to rpc_fundrawtransaction functional test (random-zebra)
5bca4f4 Add more clear interface for CoinControl.h regarding individual feerate (random-zebra)
169bc3b [RPC] add feerate option to fundrawtransaction (random-zebra)
87dbdf8 [QA] Test new options in rpc_fundrawtransaction functional test (random-zebra)
bc9dc67 Add lockUnspents option to fundrawtransaction (random-zebra)
a3ac191 Add change options to fundrawtransaction (random-zebra)
0c1f7ba Add strict flag to RPCTypeCheckObj (random-zebra)
d655b42 Use CCoinControl selection in CWallet::FundTransaction (random-zebra)
76c8d54 [QA] Test watchonly addrs in fundrawtransaction tests (random-zebra)
134c5d2 Implement watchonly support in fundrawtransaction (random-zebra)
1b153e5 Update importaddress help to push its use to script-only (random-zebra)
7b4eb6d Add importpubkey method to import a watch-only pubkey (random-zebra)
816dabb Add p2sh option to importaddress to import redeemScripts (random-zebra)
60a20a4 Split up importaddress into helper functions (random-zebra)
cbffa80 Add logic to track pubkeys as watch-only, not just scripts (random-zebra)
12b38b0 Add have-pubkey distinction to ISMINE flags (random-zebra)
fab6556 Exempt unspendable transaction outputs from dust checks (random-zebra)
ab407ff [Tests] Fix and enable fundrawtransaction functional tests (random-zebra)
bc44ba0 [wallet] allow transaction without change if keypool is empty (random-zebra)
a2f8071 [wallet] CreateTransaction: simplify change address check (random-zebra)
761e60e Add fundrawtransaction RPC method (random-zebra)
ccb18dd Add FundTransaction method to wallet (random-zebra)
692b827 Add DummySignatureCreator which just creates zeroed sigs (random-zebra)

Pull request description:

  based on top of
  - [x] #1662

  This introduces a new wallet function, `CWallet::FundTransaction()` (and exposes it via RPC with `fundrawtransaction`), to fill a tx containing only vouts (or not enough vins to cover the vouts) with unspent coins from the wallet.

  `fundrawtransaction` will not modify existing inputs, and will add one change output (if needed) to the outputs. It will not sign the inputs (so can include also watch-only or multi-sig inputs, if enabled).

  backported from:
  - bitcoin#6088
  - bitcoin#17219 [`*`]
  - bitcoin#6417
  - bitcoin#6444
  - bitcoin#6415
  - bitcoin#6828
  - bitcoin#7296 (only bebe58b)
  - bitcoin#7506
  - bitcoin#7518
  - bitcoin#7967

  adapting the tests for the (more recent) framework.

  [`*`] Note: this has been included to be able to call `fundrawtransaction` without the need for an unencrypted wallet (for the change address key)

ACKs for top commit:
  furszy:
    re ACK fc81158 .
  Fuzzbawls:
    ACK fc81158

Tree-SHA512: 10235ce6e672a1cfd4ae2cad9312864c82971f6a4aa1a8ed9489d85156f5c4126c293180a7f1b86b7c65d07caab484e9a6d7a87ebf032bee55adb98d3e08e7b9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.