Skip to content

Conversation

@achow101
Copy link
Member

CreateMultisigRedeemscript() is changed to AddAndGetMultisigDestination() so that the process of constructing the redeemScript and then getting the CTxDestination are done in the same function. This allows that function to see what the keys in the multisig are so that the correct address type is returned from AddAndGetDestinationForScript().

This only effects the createmultisig and addmultisigaddress RPCs and does not change signing logic as #16022 does.

Alternative to #16022 and #16012

Fixes #16011

@gmaxwell
Copy link
Contributor

This sounds right to me.

@maflcko maflcko added this to the 0.18.1 milestone May 15, 2019
src/rpc/util.cpp Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: as an out arg, it'd be somewhat more clear to place script_out towards the end. AddAndGetDestinationForScript's placement is based on the same not being an out arg.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, that seems to en the convention, usually
wish C++ had tuple unpacking and it was unnecessary to bother with 'output arguments'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@laanwj
Copy link
Member

laanwj commented May 29, 2019

utACK 5fefdb3286b617a74dd395381b1be0b29f21b0e6

Copy link
Contributor

@meshcollider meshcollider left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

@achow101 achow101 force-pushed the dont-sw-ms-uncomp branch from 5fefdb3 to 8e45fd8 Compare June 5, 2019 13:12
@maflcko maflcko closed this Jun 16, 2019
@maflcko maflcko reopened this Jun 16, 2019
@DrahtBot
Copy link
Contributor

DrahtBot commented Jun 18, 2019

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #16227 (Refactor CWallet's inheritance chain by achow101)

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.

@achow101 achow101 force-pushed the dont-sw-ms-uncomp branch from 8e45fd8 to 4069662 Compare June 18, 2019 15:38
@meshcollider
Copy link
Contributor

re-utACK 4069662

Copy link
Contributor

@kallewoof kallewoof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 40696620703e7339957177e95a9acb1d8be80e0e

Some nits, can be ignored (though would like comment fixed if possible).

src/rpc/util.cpp Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment (number required) is confusing. Reading code I understand it's the threshold for sigs (k in k-of-n). Maybe "from a given list of public keys, number of required signatures, and the address type"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I'm mistaken, convention is to import system libs first, then own stuff. decimal was imported here, though, so grain-of-salt.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bunch of other tests do system libs after our own 🤷‍♂️

@achow101 achow101 force-pushed the dont-sw-ms-uncomp branch from 4069662 to 0c39c9d Compare June 19, 2019 22:05
@kallewoof
Copy link
Contributor

re-ACK 0c39c9d

@meshcollider
Copy link
Contributor

@achow101 I think your force push reversed the parameter reordering you did a couple of days ago

…n instead of two

Instead of creating a redeemScript with CreateMultisigRedeemscript and
then getting the destination with AddAndGetDestinationForScript, do
both in the same function.

CreateMultisigRedeemscript is changed to AddAndGetMultisigDestination.
It creates the redeemScript and returns it via an output parameter. Then
it calls AddAndGetDestinationForScript to add the destination to the
keystore and get the proper destination.

This allows us to inspect the public keys in the redeemScript before creating
the destination so that the correct destination is used when uncompressed
pubkeys are in the multisig.
@achow101 achow101 force-pushed the dont-sw-ms-uncomp branch from 0c39c9d to a495034 Compare June 20, 2019 15:02
@achow101
Copy link
Member Author

@achow101 I think your force push reversed the parameter reordering you did a couple of days ago

Oops. Should be fixed now.

@meshcollider
Copy link
Contributor

re-utACK a495034

@meshcollider meshcollider merged commit a495034 into bitcoin:master Jun 21, 2019
meshcollider added a commit that referenced this pull request Jun 21, 2019
…ys returns a legacy address

a495034 Make and get the multisig redeemscript and destination in one function instead of two (Andrew Chow)

Pull request description:

  `CreateMultisigRedeemscript()` is changed to `AddAndGetMultisigDestination()` so that the process of constructing the redeemScript and then getting the `CTxDestination` are done in the same function. This allows that function to see what the keys in the multisig are so that the correct address type is returned from `AddAndGetDestinationForScript()`.

  This only effects the `createmultisig` and `addmultisigaddress` RPCs and does not change signing logic as #16022 does.

  Alternative to #16022 and #16012

  Fixes #16011

ACKs for commit a49503:

Tree-SHA512: 5b0154a714deea3b2cc3a54beb420c95eeeacf4ca30c40ca80940d9d640f8b03611b0fc14c2f0710bfd8a79e8d27ad7d9ae380b4b83d52b40ab201624f2a63f0
maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request Jun 21, 2019
…n instead of two

Instead of creating a redeemScript with CreateMultisigRedeemscript and
then getting the destination with AddAndGetDestinationForScript, do
both in the same function.

CreateMultisigRedeemscript is changed to AddAndGetMultisigDestination.
It creates the redeemScript and returns it via an output parameter. Then
it calls AddAndGetDestinationForScript to add the destination to the
keystore and get the proper destination.

This allows us to inspect the public keys in the redeemScript before creating
the destination so that the correct destination is used when uncompressed
pubkeys are in the multisig.

Github-Pull: bitcoin#16026
Rebased-From: a495034
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jun 21, 2019
…ig always returns a legacy address

a495034 Make and get the multisig redeemscript and destination in one function instead of two (Andrew Chow)

Pull request description:

  `CreateMultisigRedeemscript()` is changed to `AddAndGetMultisigDestination()` so that the process of constructing the redeemScript and then getting the `CTxDestination` are done in the same function. This allows that function to see what the keys in the multisig are so that the correct address type is returned from `AddAndGetDestinationForScript()`.

  This only effects the `createmultisig` and `addmultisigaddress` RPCs and does not change signing logic as bitcoin#16022 does.

  Alternative to bitcoin#16022 and bitcoin#16012

  Fixes bitcoin#16011

ACKs for commit a49503:

Tree-SHA512: 5b0154a714deea3b2cc3a54beb420c95eeeacf4ca30c40ca80940d9d640f8b03611b0fc14c2f0710bfd8a79e8d27ad7d9ae380b4b83d52b40ab201624f2a63f0
HashUnlimited pushed a commit to HashUnlimited/chaincoin that referenced this pull request Aug 23, 2019
…n instead of two

Instead of creating a redeemScript with CreateMultisigRedeemscript and
then getting the destination with AddAndGetDestinationForScript, do
both in the same function.

CreateMultisigRedeemscript is changed to AddAndGetMultisigDestination.
It creates the redeemScript and returns it via an output parameter. Then
it calls AddAndGetDestinationForScript to add the destination to the
keystore and get the proper destination.

This allows us to inspect the public keys in the redeemScript before creating
the destination so that the correct destination is used when uncompressed
pubkeys are in the multisig.

Github-Pull: bitcoin#16026
Rebased-From: a495034
Bushstar pushed a commit to Bushstar/omnicore that referenced this pull request Aug 24, 2019
…n instead of two

Instead of creating a redeemScript with CreateMultisigRedeemscript and
then getting the destination with AddAndGetDestinationForScript, do
both in the same function.

CreateMultisigRedeemscript is changed to AddAndGetMultisigDestination.
It creates the redeemScript and returns it via an output parameter. Then
it calls AddAndGetDestinationForScript to add the destination to the
keystore and get the proper destination.

This allows us to inspect the public keys in the redeemScript before creating
the destination so that the correct destination is used when uncompressed
pubkeys are in the multisig.

Github-Pull: bitcoin#16026
Rebased-From: a495034
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jun 12, 2020
…lways returns a legacy address

Summary:
a49503402b6bc21e3878e151c07529941d36aed0 Make and get the multisig redeemscript and destination in one function instead of two (Andrew Chow)

Pull request description:

  `CreateMultisigRedeemscript()` is changed to `AddAndGetMultisigDestination()` so that the process of constructing the redeemScript and then getting the `CTxDestination` are done in the same function. This allows that function to see what the keys in the multisig are so that the correct address type is returned from `AddAndGetDestinationForScript()`.

  This only effects the `createmultisig` and `addmultisigaddress` RPCs and does not change signing logic as #16022 does.

  Alternative to #16022 and #16012

  Fixes #16011

---

Backport of Core [[bitcoin/bitcoin#16026 | PR16026]]

Test Plan:
  ninja check-all

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Subscribers: deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D6552
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

addmultisigaddress does not fallback to legacy when there are uncompressed public keys in the parameters

9 participants