-
Notifications
You must be signed in to change notification settings - Fork 809
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 descriptor support to createmultisig rpc #1171
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #1171 +/- ##
==========================================
+ Coverage 70.41% 70.51% +0.09%
==========================================
Files 174 174
Lines 27515 27535 +20
==========================================
+ Hits 19376 19416 +40
+ Misses 8139 8119 -20
☔ View full report in Codecov by Sentry. |
d26e7c6
to
3599c13
Compare
3599c13
to
77be48b
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.
Instead of creating a descriptor string and then parsing it and then generating address, do this.
- Use the redeem script generated previously to generate address (based on
outputType
passed as arg). - Generated final descriptor string to be returned using string interpolation
Rationale: We are already generating the redeem script. Creating a descriptor just performs the same checks as Script.fromMultisig()
which is unnecessary.
let outputType = valid.str(2); | ||
|
||
if (outputType === null) { | ||
outputType = outputTypes.LEGACY; | ||
} |
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.
let outputType = valid.str(2); | |
if (outputType === null) { | |
outputType = outputTypes.LEGACY; | |
} | |
const outputType = valid.str(2) ?? outputTypes.LEGACY; |
'Redeem script exceeds size limit.'); | ||
} | ||
const isWitness = outputType !== outputTypes.LEGACY; | ||
const script = Script.fromMultisig(m, n, keys, false, isWitness); |
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.
const script = Script.fromMultisig(m, n, keys, false, isWitness); | |
const redeemScript = Script.fromMultisig(m, n, keys, false, isWitness); |
const subdesc = MultisigDescriptor.fromString( | ||
`multi(${m},${keyString})`, this.network, context | ||
); |
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.
I don't like this, but can't think of a better alternative atm
This pr adds descriptor support to createmultisig rpc.