@@ -787,10 +787,7 @@ static RPCHelpMan getblockfrompeer()
787
787
{" blockhash" , RPCArg::Type::STR_HEX, RPCArg::Optional::NO, " The block hash" },
788
788
{" nodeid" , RPCArg::Type::NUM, RPCArg::Optional::NO, " The node ID (see getpeerinfo for node IDs)" },
789
789
},
790
- RPCResult{RPCResult::Type::OBJ, " " , " " ,
791
- {
792
- {RPCResult::Type::STR, " warnings" , /* optional=*/ true , " any warnings" },
793
- }},
790
+ RPCResult{RPCResult::Type::OBJ_EMPTY, " " , /* optional=*/ false , " " , {}},
794
791
RPCExamples{
795
792
HelpExampleCli (" getblockfrompeer" , " \" 00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\" 0" )
796
793
+ HelpExampleRpc (" getblockfrompeer" , " \" 00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\" 0" )
@@ -816,14 +813,14 @@ static RPCHelpMan getblockfrompeer()
816
813
throw JSONRPCError (RPC_MISC_ERROR, " Block header missing" );
817
814
}
818
815
819
- UniValue result = UniValue::VOBJ;
820
-
821
816
if (index ->nStatus & BLOCK_HAVE_DATA) {
822
- result.pushKV (" warnings" , " Block already downloaded" );
823
- } else if (!peerman.FetchBlock (nodeid, *index )) {
817
+ throw JSONRPCError (RPC_MISC_ERROR, " Block already downloaded" );
818
+ }
819
+
820
+ if (!peerman.FetchBlock (nodeid, *index )) {
824
821
throw JSONRPCError (RPC_MISC_ERROR, " Failed to fetch block from peer" );
825
822
}
826
- return result ;
823
+ return UniValue::VOBJ ;
827
824
},
828
825
};
829
826
}
0 commit comments