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
3333070 refactor: Call type-solver earlier in decodescript (MarcoFalke)
fab0d99 style: Remove whitespace (MarcoFalke)
Pull request description:
The current logic is a bit confusing. First creating the `UniValue` return dict, then parsing it again to get the type as `std::string`.
Clean this up by using a strong type `TxoutType`. Also, remove whitespace.
ACKs for top commit:
shaavan:
ACK 3333070
theStack:
Code-review ACK 3333070
Tree-SHA512: 49db7bc614d2491cd3ec0177d21ad1e9924dbece1eb5635290cd7fd18cb30adf4711b891daf522e7c4f6baab3033b66393bbfcd1d4726f24f90a433124f925d6
{"hexstring", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "the hex-encoded script"},
547
-
},
548
-
RPCResult{
549
-
RPCResult::Type::OBJ, "", "",
550
-
{
551
-
{RPCResult::Type::STR, "asm", "Script public key"},
552
-
{RPCResult::Type::STR, "type", "The output type (e.g. "+GetAllOutputTypes()+")"},
553
-
{RPCResult::Type::STR, "address", /* optional */true, "The Bitcoin address (only if a well-defined address exists)"},
554
-
{RPCResult::Type::STR, "p2sh", /* optional */true, "address of P2SH script wrapping this redeem script (not returned if the script is already a P2SH)"},
555
-
{RPCResult::Type::OBJ, "segwit", /* optional */true, "Result of a witness script public key wrapping this redeem script (not returned if the script is a P2SH or witness)",
556
-
{
557
-
{RPCResult::Type::STR, "asm", "String representation of the script public key"},
558
-
{RPCResult::Type::STR_HEX, "hex", "Hex string of the script public key"},
559
-
{RPCResult::Type::STR, "type", "The type of the script public key (e.g. witness_v0_keyhash or witness_v0_scripthash)"},
560
-
{RPCResult::Type::STR, "address", /* optional */true, "The Bitcoin address (only if a well-defined address exists)"},
561
-
{RPCResult::Type::STR, "p2sh-segwit", "address of the P2SH script wrapping this witness redeem script"},
562
-
}},
563
-
}
564
-
},
565
-
RPCExamples{
566
-
HelpExampleCli("decodescript", "\"hexstring\"")
567
-
+ HelpExampleRpc("decodescript", "\"hexstring\"")
568
-
},
543
+
return RPCHelpMan{
544
+
"decodescript",
545
+
"\nDecode a hex-encoded script.\n",
546
+
{
547
+
{"hexstring", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "the hex-encoded script"},
548
+
},
549
+
RPCResult{
550
+
RPCResult::Type::OBJ, "", "",
551
+
{
552
+
{RPCResult::Type::STR, "asm", "Script public key"},
553
+
{RPCResult::Type::STR, "type", "The output type (e.g. " + GetAllOutputTypes() + ")"},
554
+
{RPCResult::Type::STR, "address", /* optional */true, "The Bitcoin address (only if a well-defined address exists)"},
555
+
{RPCResult::Type::STR, "p2sh", /* optional */true, "address of P2SH script wrapping this redeem script (not returned if the script is already a P2SH)"},
556
+
{RPCResult::Type::OBJ, "segwit", /* optional */true, "Result of a witness script public key wrapping this redeem script (not returned if the script is a P2SH or witness)",
557
+
{
558
+
{RPCResult::Type::STR, "asm", "String representation of the script public key"},
559
+
{RPCResult::Type::STR_HEX, "hex", "Hex string of the script public key"},
560
+
{RPCResult::Type::STR, "type", "The type of the script public key (e.g. witness_v0_keyhash or witness_v0_scripthash)"},
561
+
{RPCResult::Type::STR, "address", /* optional */true, "The Bitcoin address (only if a well-defined address exists)"},
562
+
{RPCResult::Type::STR, "p2sh-segwit", "address of the P2SH script wrapping this witness redeem script"},
0 commit comments