You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
decodescript could infer miniscript from given script in "segwit" context #27007
I was playing around with a probably-too-cute script for LN channel smart contract, and was looking for something to decide for me if miniscript can infer the structure of the script.
Since it's evaluated at "top level for desc it cannot get any meaningful structure from it. Perhaps in segwit it could try infering the miniscript in the segwit context
Activity
darosior commentedon Jan 31, 2023
The issue here is that in
decodescriptwe do try to parse awshdescriptor from a constructed P2WSH scriptPubKey:bitcoin/src/rpc/rawtransaction.cpp
Lines 519 to 530 in 2b211b4
But
inferScriptwon't be able to analyze the witness script itself since we are passing a dummy signature provider:bitcoin/src/core_write.cpp
Lines 150 to 156 in 2b211b4
Therefore
GetCScriptwon't return anything:bitcoin/src/script/descriptor.cpp
Lines 1622 to 1629 in 2b211b4
sipa commentedon Jan 31, 2023
I would think that all we need to do is add the RPC argument script to the signature provider used for inference.
instagibbs commentedon Jan 31, 2023
Yes, it's that simple (well, example I gave above was xonly key, so added 0x02 prefix):
darosior commentedon Feb 1, 2023
@instagibbs do you intend to PR this? Otherwise i can do it.
instagibbs commentedon Feb 1, 2023
Merge bitcoin/bitcoin#27037: rpc: decode Miniscript descriptor when p…
Merge bitcoin/bitcoin#27037: rpc: decode Miniscript descriptor when p…
Merge bitcoin/bitcoin#27037: rpc: decode Miniscript descriptor when p…
Merge bitcoin/bitcoin#27037: rpc: decode Miniscript descriptor when p…
Merge bitcoin#27037: rpc: decode Miniscript descriptor when possible …
Merge bitcoin#27037: rpc: decode Miniscript descriptor when possible …
Merge bitcoin#27037: rpc: decode Miniscript descriptor when possible …