-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Add address type option to addmultisigaddress #12213
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
Add address type option to addmultisigaddress #12213
Conversation
|
Another option to avoid |
|
👍 |
jonasschnelli
left a comment
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.
utACK d1d17607eba0cae096bfa0d2dbdc977a071385bd
|
Concept ACK. Should probably do the same for createmultisig? |
|
In this PR? |
|
I mean they are related. To me it makes sense to update atomically, since I fail to see why you'd want the one but not the other. |
|
The test framework only calls But I guess it can be extended to |
|
When this is only about tests, we can untag from 0.16, imo. When this is about a needed feature for users, I don't see why createmultisig shouldn't support it. |
|
utACK d1d1760 |
src/wallet/rpcwallet.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.
You need to update the RPC command table as well with this added argument, to make named arguments work.
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.
Maybe even add a test for all new options
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.
@promag you missed this update to the RPC command table for addmultisigaddress
ryanofsky
left a comment
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.
Conditional utACK d1d17607eba0cae096bfa0d2dbdc977a071385bd: this shouldn't be merged until the named argument fix Wladimir suggested is added.
Also agree createmultisig update would be nice here.
|
If I set the default address type to bech32 and then create a 1 of 2 multisig address using a wallet address and the public key of some external bech32 address, and I set the type to legacy: bitcoin-cli addmultisigaddress 1 '["bcrt1q0uh7xeh8jmnfzd0se9n39ut9n64sf7mt3ndhal","034c534e0cd400f69a948f7d6eecb891deca140c9e2035658033d5ebbaccd88058"]' "" legacyThe result of {
"isvalid": true,
"address": "2NEso1BnKq8kPCyZqMaYzw8E6Vf5N4KCZk1",
"scriptPubKey": "a914ed452d142f0601587ba077293a79caa35503797787",
"ismine": false,
"iswatchonly": false,
"isscript": true,
"iswitness": false,
"script": "multisig",
"hex": "512102bdb9ca3346c02befe78dbe4e47b6569df8cb312aebf165dc90439287910cc8d921034c534e0cd400f69a948f7d6eecb891deca140c9e2035658033d5ebbaccd8805852ae",
"sigsrequired": 1,
"pubkeys": [
"02bdb9ca3346c02befe78dbe4e47b6569df8cb312aebf165dc90439287910cc8d9",
"034c534e0cd400f69a948f7d6eecb891deca140c9e2035658033d5ebbaccd88058"
],
"addresses": [
"ms7TUkdntfebxKQw1oG685Kimdt34VVUaA",
"muQMALGUmB3n4YLcAHUQrM9BHNF3VCEr5z"
],
"account": ""
}The only thing I recognize is the pub key of the external address. I haven't tried spending from it. The wallet doesn't know what address type was used by the external wallet, but shouldn't it at least know this about itself? When setting the multisig address type to bech32 the result makes more sense, because it leaves out the address field: bitcoin-cli addmultisigaddress 1 '["bcrt1q0uh7xeh8jmnfzd0se9n39ut9n64sf7mt3ndhal","034c534e0cd400f69a948f7d6eecb891deca140c9e2035658033d5ebbaccd88058"]' "" bech32{
"isvalid": true,
"address": "bcrt1qdpzf4v83kq9gfamz53m4x6wx2rqw72pw87a5jf603g9ckp0j3jmqp0680q",
"scriptPubKey": "002068449ab0f1b00a84f762a4775369c650c0ef282e3fbb49274f8a0b8b05f28cb6",
"ismine": false,
"iswatchonly": false,
"isscript": true,
"iswitness": true,
"witness_version": 0,
"witness_program": "68449ab0f1b00a84f762a4775369c650c0ef282e3fbb49274f8a0b8b05f28cb6",
"script": "multisig",
"hex": "512102bdb9ca3346c02befe78dbe4e47b6569df8cb312aebf165dc90439287910cc8d921034c534e0cd400f69a948f7d6eecb891deca140c9e2035658033d5ebbaccd8805852ae",
"sigsrequired": 1,
"pubkeys": [
"02bdb9ca3346c02befe78dbe4e47b6569df8cb312aebf165dc90439287910cc8d9",
"034c534e0cd400f69a948f7d6eecb891deca140c9e2035658033d5ebbaccd88058"
],
"account": ""
}Not sure if this is even related to this particular change. |
|
@Sjors The 'addresses' field is very confusing, and I'd like to get rid of it, but it's there for backward compatibility. Historically there was no difference between addresses (shorthands for scriptPubKeys) and key identifiers, and it lives on in a number of calls. In this case, it's effectively the same as the 'pubkeys' field (which was added in #11403), but encoding the public keys as P2PKH addresses. |
d1d1760 to
5fee1f9
Compare
|
Pushed |
f188594 to
27b8162
Compare
|
@sipa currently when |
meshcollider
left a comment
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.
utACK 27b8162 modulo comments below and awaiting tests
src/rpc/misc.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.
Should be 3. not 4.
src/wallet/rpcwallet.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.
@promag you missed this update to the RPC command table for addmultisigaddress
27b8162 to
363a438
Compare
|
needs rebase and comments addressed |
|
utACK the first and third commits:
I'm NACKish on the second commit ([rpc] Add address type option to createmultisig) because it adds a wallet dependency to server which will be difficult to unpick, and will make substatial work for #11415. |
|
I can move [rpc] Add address type option to createmultisig to a new PR so it doesn't hold the rest. I don't feel both must be updated in one shot. |
I'd be in favour of that, but several other contributors asked for the opposite (for createmultisig to be added to this PR). I think wait to hear what they think. |
|
Needs rebase. |
On second thought yeah, the wallet dependency complicates that part so separating it out for separate discussion would be good, makes this PR easier to merge |
6066545 to
30a4b23
Compare
30a4b23 to
bca85e6
Compare
test/functional/nulldummy.py
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.
This line currently causes failure, but appending ['address'] fixes it. Similar changes are needed in segwit.py. This is due to #11415 merge.
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.
Right, like above.
bca85e6 to
5afbff9
Compare
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.
Conditional utACK 5afbff9755768d191275736a19db078c139a5ec3 if segwit.py test is fixed. Only change since last review is rebase and fixing CRPCCommand args.
5afbff9 to
f523c6b
Compare
jnewbery
left a comment
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.
Tested ACK f523c6b. One nit in the tests.
| self.ms_address = self.nodes[0].addmultisigaddress(1,[self.address])['address'] | ||
| self.wit_address = self.nodes[0].addwitnessaddress(self.address) | ||
| self.wit_ms_address = self.nodes[0].addwitnessaddress(self.ms_address) | ||
| self.wit_ms_address = self.nodes[0].addmultisigaddress(1, [self.address], '', 'p2sh-segwit')['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 named arguments (specifically, it's not clear what the third argument '' is for). Same for segwit.py
|
Re-utACK f523c6b |
f523c6b [qa] Use address type in addmultisigaddress to avoid addwitnessaddress (João Barbosa) 886a92f [rpc] Add address type option to addmultisigaddress (João Barbosa) Pull request description: Adds the option `address_type` to `addmultisigaddress` and `createmultisg` RPC. This also allows to avoid `addwitnessaddress` to obtain an `p2sh-segwit` or `bech32` multsig address. Related to #12210 as this reduces `addwitnessaddress` usage. Tree-SHA512: 8f8f85dfcff66bb6c7e1e9865e37c285dead1d6dadb9672a89b92fa209d03cc35817ca1d656588c6c2146b728daaf7540b851929b640294653c62836cbefe7ee
|
Is there a pull request for createmultisig, or am I blind? |
|
@MarcoFalke not yet. |
Adds the option
address_typetoaddmultisigaddressandcreatemultisgRPC. This also allows to avoidaddwitnessaddressto obtain anp2sh-segwitorbech32multsig address.Related to #12210 as this reduces
addwitnessaddressusage.