@@ -2112,7 +2112,8 @@ RPCHelpMan importissuanceblindingkey()
21122112RPCHelpMan dumpblindingkey ()
21132113{
21142114 return RPCHelpMan{" dumpblindingkey" ,
2115- " \n Dumps the private blinding key for a CT address in hex." ,
2115+ " \n Dumps the private blinding key for a CT address in hex."
2116+ " \n Note: If the address is not a CT address, looks for blinding key corresponding to this non-CT address." ,
21162117 {
21172118 {" address" , RPCArg::Type::STR, RPCArg::Optional::NO, " The CT address" },
21182119 },
@@ -2134,17 +2135,15 @@ RPCHelpMan dumpblindingkey()
21342135 if (!IsValidDestination (dest)) {
21352136 throw JSONRPCError (RPC_INVALID_ADDRESS_OR_KEY, " Invalid Bitcoin address" );
21362137 }
2137- if (!IsBlindDestination (dest)) {
2138- throw JSONRPCError (RPC_INVALID_ADDRESS_OR_KEY, " Not a CT address" );
2139- }
21402138 CScript script = GetScriptForDestination (dest);
21412139 CKey key;
21422140 key = pwallet->GetBlindingKey (&script);
21432141 if (key.IsValid ()) {
21442142 CPubKey pubkey (key.GetPubKey ());
2145- if (pubkey = = GetDestinationBlindingKey (dest)) {
2146- return HexStr (Span< const unsigned char >( key. begin (), key. size ()) );
2143+ if (IsBlindDestination (dest) && pubkey ! = GetDestinationBlindingKey (dest)) {
2144+ throw JSONRPCError (RPC_INVALID_ADDRESS_OR_KEY, " CT address blinding key does not match the blinding key in wallet " );
21472145 }
2146+ return HexStr (Span<const unsigned char >(key.begin (), key.size ()));
21482147 }
21492148
21502149 throw JSONRPCError (RPC_WALLET_ERROR, " Blinding key for address is unknown" );
0 commit comments