mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
rpc: decode Miniscript descriptor when possible in decodescript
The descriptor inference logic would previously always use a dummy signing provider and would never analyze the witness script of a P2WSH scriptPubKey. Note even a valid Miniscript might not always be decodable from Script without more contextual information (for instance the key preimage for a pk_h).
This commit is contained in:
@@ -147,13 +147,13 @@ std::string EncodeHexTx(const CTransaction& tx, const int serializeFlags)
|
||||
return HexStr(ssTx);
|
||||
}
|
||||
|
||||
void ScriptToUniv(const CScript& script, UniValue& out, bool include_hex, bool include_address)
|
||||
void ScriptToUniv(const CScript& script, UniValue& out, bool include_hex, bool include_address, const SigningProvider* provider)
|
||||
{
|
||||
CTxDestination address;
|
||||
|
||||
out.pushKV("asm", ScriptToAsmStr(script));
|
||||
if (include_address) {
|
||||
out.pushKV("desc", InferDescriptor(script, DUMMY_SIGNING_PROVIDER)->ToString());
|
||||
out.pushKV("desc", InferDescriptor(script, provider ? *provider : DUMMY_SIGNING_PROVIDER)->ToString());
|
||||
}
|
||||
if (include_hex) {
|
||||
out.pushKV("hex", HexStr(script));
|
||||
|
||||
Reference in New Issue
Block a user