-
Notifications
You must be signed in to change notification settings - Fork 36.6k
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
Enable various p2sh-p2wpkh functionality #11089
Conversation
src/base58.cpp
Outdated
if (!IsValid() || vchVersion != Params().Base58Prefix(CChainParams::SCRIPT_ADDRESS)) { | ||
return false; | ||
} | ||
memcpy(scriptID.begin(), &vchData[0], 20); |
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.
Prefer vchData.data() over &vchData[0]
utACK 7fb9887 |
83c37fd
to
8f6765a
Compare
utACK 8f6765a |
8f6765a
to
0c4572c
Compare
@@ -281,6 +281,15 @@ bool CBitcoinAddress::GetKeyID(CKeyID& keyID) const | |||
return true; | |||
} | |||
|
|||
bool CBitcoinAddress::GetScriptID(CScriptID& scriptID) const | |||
{ | |||
if (!IsValid() || vchVersion != Params().Base58Prefix(CChainParams::SCRIPT_ADDRESS)) { |
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.
nit: Use if (!IsScript())
Added 0.15.1 milestone |
|
needs rebase |
This needs a rebase after CBitcoinAddress was removed in #11117. However, this will become much easier after #11167, as then native witness destinations can be used. Also, I'm not convinced that dumpprivkey for (p2sh or not) segwit addresses is the right approach, as you can't expect importprivkey to work for those. |
Needs rebase |
Either close (because it's in #11403) or rebase? |
Removing from backport |
b224a47 Add address_types test (Pieter Wuille) 7ee54fd Support downgrading after recovered keypool witness keys (Pieter Wuille) 940a219 SegWit wallet support (Pieter Wuille) f37c64e Implicitly know about P2WPKH redeemscripts (Pieter Wuille) 57273f2 [test] Serialize CTransaction with witness by default (Pieter Wuille) cf2c0b6 Support P2WPKH and P2SH-P2WPKH in dumpprivkey (Pieter Wuille) 37c03d3 Support P2WPKH addresses in create/addmultisig (Pieter Wuille) 3eaa003 Extend validateaddress information for P2SH-embedded witness (Pieter Wuille) 30a27dc Expose method to find key for a single-key destination (Pieter Wuille) 985c795 Improve witness destination types and use them more (Pieter Wuille) cbe1974 [refactor] GetAccount{PubKey,Address} -> GetAccountDestination (Pieter Wuille) 0c8ea63 Abstract out IsSolvable from Witnessifier (Pieter Wuille) Pull request description: This implements a minimum viable implementation of SegWit wallet support, based on top of #11389, and includes part of the functionality from #11089. Two new configuration options are added: * `-addresstype`, with options `legacy`, `p2sh`, and `bech32`. It controls what kind of addresses are produced by `getnewaddress`, `getaccountaddress`, and `createmultisigaddress`. * `-changetype`, with the same options, and by default equal to `-addresstype`, that controls what kind of change is used. All wallet private and public keys can be used for any type of address. Support for address types dependent on different derivation paths will need a major overhaul of how our internal detection of outputs work. I expect that that will happen for a next major version. The above also applies to imported keys, as having a distinction there but not for normal operations is a disaster for testing, and probably for comprehension of users. This has some ugly effects, like needing to associate the provided label to `importprivkey` with each style address for the corresponding key. To deal with witness outputs requiring a corresponding redeemscript in wallet, three approaches are used: * All SegWit addresses created through `getnewaddress` or multisig RPCs explicitly get their redeemscripts added to the wallet file. This means that downgrading after creating a witness address will work, as long as the wallet file is up to date. * All SegWit keys in the wallet get an _implicit_ redeemscript added, without it being written to the file. This means recovery of an old backup will work, as long as you use new software. * All keypool keys that are seen used in transactions explicitly get their redeemscripts added to the wallet files. This means that downgrading after recovering from a backup that includes a witness address will work. These approaches correspond to solutions 3a, 1a, and 5a respectively from https://gist.github.com/sipa/125cfa1615946d0c3f3eec2ad7f250a2. As argued there, there is no full solution for dealing with the case where you both downgrade and restore a backup, so that's also not implemented. `dumpwallet`, `importwallet`, `importmulti`, `signmessage` and `verifymessage` don't work with SegWit addresses yet. They're remaining TODOs, for this PR or a follow-up. Because of that, several tests unexpectedly run with `-addresstype=legacy` for now. Tree-SHA512: d425dbe517c0422061ab8dacdc3a6ae47da071450932ed992c79559d922dff7b2574a31a8c94feccd3761c1dffb6422c50055e6dca8e3cf94a169bc95e39e959
I don't know how to rebase this. |
Isn't all the functionality in this PR merged through other patches? If something isn't, I'd like to know. |
I believe so.
…On Fri, Mar 2, 2018, 11:23 AM Pieter Wuille ***@***.***> wrote:
Isn't all the functionality in this PR merged through other patches? If
something isn't, I'd like to know.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#11089 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFgC06R5bdjd25ARJGFe0TpQ6HouALGXks5taWQCgaJpZM4O7x6X>
.
|
This had 4 changes:
|
A subset of #9017