@@ -376,13 +376,30 @@ static RPCHelpMan getrawislocks()
376376 {" txid" , RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, " A transaction hash" },
377377 },
378378 },
379+ {" verbose" , RPCArg::Type::NUM, RPCArg::Default{1 }, " 0 for hex-encoded data, 1 for a json object" },
379380 },
380381 RPCResult{
381382 RPCResult::Type::ARR, " " , " Response is an array with the same size as the input txids" ,
382383 {
383- RPCResult{" if InstantSend Lock is known for specified txid" ,
384+ RPCResult{" for verbose = 0 if InstantSend Lock is known for specified txid" ,
384385 RPCResult::Type::STR, " data" , " The serialized, hex-encoded data for 'txid'"
385386 },
387+ RPCResult{" for verbose = 1 if InstantSend Lock is known for specified txid" ,
388+ RPCResult::Type::OBJ, " " , " " ,
389+ {
390+ {RPCResult::Type::STR_HEX, " txid" , " The transaction id" },
391+ {RPCResult::Type::ARR, " inputs" , " The inputs" ,
392+ {
393+ {" " , RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, " " ,
394+ {
395+ {RPCResult::Type::STR_HEX, " txid" , " The transaction id" },
396+ {RPCResult::Type::NUM, " vout" , " The output number" },
397+ },
398+ },
399+ },
400+ {RPCResult::Type::STR_HEX, " cycleHash" , " The Cycle Hash" },
401+ {RPCResult::Type::STR_HEX, " signature" , " The InstantSend's BLS signature" },
402+ }},
386403 RPCResult{" if no InstantSend Lock is known for specified txid" ,
387404 RPCResult::Type::STR, " data" , " Just 'None' string"
388405 },
@@ -401,14 +418,38 @@ static RPCHelpMan getrawislocks()
401418 throw JSONRPCError (RPC_INVALID_PARAMETER, " Up to 100 txids only" );
402419 }
403420
421+ int verbose = 1 ;
422+ if (!request.params [0 ].isNull ()) {
423+ if (request.params [0 ].isBool ()) {
424+ verbose = request.params [0 ].get_bool () ? 1 : 0 ;
425+ } else {
426+ verbose = request.params [0 ].get_int ();
427+ }
428+ }
429+
404430 const LLMQContext& llmq_ctx = EnsureLLMQContext (node);
405431 for (const auto idx : irange::range (txids.size ())) {
406432 const uint256 txid (ParseHashV (txids[idx], " txid" ));
407433
408434 if (const llmq::CInstantSendLockPtr islock = llmq_ctx.isman ->GetInstantSendLockByTxid (txid); islock != nullptr ) {
409- CDataStream ssTx (SER_NETWORK, PROTOCOL_VERSION);
410- ssTx << *islock;
411- result_arr.push_back (HexStr (ssTx));
435+ if (verbose == 1 ) {
436+ UniValue objIS;
437+ objIS.pushKV (" txid" , islock->txid .ToString ());
438+ UniValue outputs;
439+ for (const auto out : islock->inputs ) {
440+ UniValue outpoint;
441+ outpoint.pushKV (" txid" , out.hash .ToString ());
442+ outpoint.pushKV (" vout" , static_cast <int64_t >(out.n ));
443+ outputs.push_back (outpoint);
444+ }
445+ objIS.pushKV (" cycleHash" , islock->cycleHash .ToString ());
446+ objIS.pushKV (" sig" , islock->sig .ToString ());
447+ result_arr.push_back (objIS);
448+ } else {
449+ CDataStream ssTx (SER_NETWORK, PROTOCOL_VERSION);
450+ ssTx << *islock;
451+ result_arr.push_back (HexStr (ssTx));
452+ }
412453 } else {
413454 result_arr.push_back (" None" );
414455 }
0 commit comments