@@ -467,7 +467,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
467467 if (!batch[ID_NETWORKINFO][" error" ].isNull ()) return batch[ID_NETWORKINFO];
468468
469469 const UniValue& networkinfo{batch[ID_NETWORKINFO][" result" ]};
470- if (networkinfo[" version" ].get_int () < 209900 ) {
470+ if (networkinfo[" version" ].getInt < int > () < 209900 ) {
471471 throw std::runtime_error (" -netinfo requires bitcoind server to be running v0.21.0 and up" );
472472 }
473473 const int64_t time_now{count_seconds (Now<CliSeconds>())};
@@ -488,16 +488,16 @@ class NetinfoRequestHandler : public BaseRequestHandler
488488 if (conn_type == " manual" ) ++m_manual_peers_count;
489489 if (DetailsRequested ()) {
490490 // Push data for this peer to the peers vector.
491- const int peer_id{peer[" id" ].get_int ()};
492- const int mapped_as{peer[" mapped_as" ].isNull () ? 0 : peer[" mapped_as" ].get_int ()};
493- const int version{peer[" version" ].get_int ()};
494- const int64_t addr_processed{peer[" addr_processed" ].isNull () ? 0 : peer[" addr_processed" ].get_int64 ()};
495- const int64_t addr_rate_limited{peer[" addr_rate_limited" ].isNull () ? 0 : peer[" addr_rate_limited" ].get_int64 ()};
496- const int64_t conn_time{peer[" conntime" ].get_int64 ()};
497- const int64_t last_blck{peer[" last_block" ].get_int64 ()};
498- const int64_t last_recv{peer[" lastrecv" ].get_int64 ()};
499- const int64_t last_send{peer[" lastsend" ].get_int64 ()};
500- const int64_t last_trxn{peer[" last_transaction" ].get_int64 ()};
491+ const int peer_id{peer[" id" ].getInt < int > ()};
492+ const int mapped_as{peer[" mapped_as" ].isNull () ? 0 : peer[" mapped_as" ].getInt < int > ()};
493+ const int version{peer[" version" ].getInt < int > ()};
494+ const int64_t addr_processed{peer[" addr_processed" ].isNull () ? 0 : peer[" addr_processed" ].getInt < int64_t > ()};
495+ const int64_t addr_rate_limited{peer[" addr_rate_limited" ].isNull () ? 0 : peer[" addr_rate_limited" ].getInt < int64_t > ()};
496+ const int64_t conn_time{peer[" conntime" ].getInt < int64_t > ()};
497+ const int64_t last_blck{peer[" last_block" ].getInt < int64_t > ()};
498+ const int64_t last_recv{peer[" lastrecv" ].getInt < int64_t > ()};
499+ const int64_t last_send{peer[" lastsend" ].getInt < int64_t > ()};
500+ const int64_t last_trxn{peer[" last_transaction" ].getInt < int64_t > ()};
501501 const double min_ping{peer[" minping" ].isNull () ? -1 : peer[" minping" ].get_real ()};
502502 const double ping{peer[" pingtime" ].isNull () ? -1 : peer[" pingtime" ].get_real ()};
503503 const std::string addr{peer[" addr" ].get_str ()};
@@ -517,7 +517,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
517517 }
518518
519519 // Generate report header.
520- std::string result{strprintf (" %s client %s%s - server %i%s\n\n " , PACKAGE_NAME, FormatFullVersion (), ChainToString (), networkinfo[" protocolversion" ].get_int (), networkinfo[" subversion" ].get_str ())};
520+ std::string result{strprintf (" %s client %s%s - server %i%s\n\n " , PACKAGE_NAME, FormatFullVersion (), ChainToString (), networkinfo[" protocolversion" ].getInt < int > (), networkinfo[" subversion" ].get_str ())};
521521
522522 // Report detailed peer connections list sorted by direction and minimum ping time.
523523 if (DetailsRequested () && !m_peers.empty ()) {
@@ -598,7 +598,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
598598 max_addr_size = std::max (addr[" address" ].get_str ().length () + 1 , max_addr_size);
599599 }
600600 for (const UniValue& addr : local_addrs) {
601- result += strprintf (" \n %-*s port %6i score %6i" , max_addr_size, addr[" address" ].get_str (), addr[" port" ].get_int (), addr[" score" ].get_int ());
601+ result += strprintf (" \n %-*s port %6i score %6i" , max_addr_size, addr[" address" ].get_str (), addr[" port" ].getInt < int > (), addr[" score" ].getInt < int > ());
602602 }
603603 }
604604
@@ -851,7 +851,7 @@ static UniValue ConnectAndCallRPC(BaseRequestHandler* rh, const std::string& str
851851 response = CallRPC (rh, strMethod, args, rpcwallet);
852852 if (fWait ) {
853853 const UniValue& error = find_value (response, " error" );
854- if (!error.isNull () && error[" code" ].get_int () == RPC_IN_WARMUP) {
854+ if (!error.isNull () && error[" code" ].getInt < int > () == RPC_IN_WARMUP) {
855855 throw CConnectionFailed (" server in warmup" );
856856 }
857857 }
@@ -886,13 +886,13 @@ static void ParseError(const UniValue& error, std::string& strPrint, int& nRet)
886886 if (err_msg.isStr ()) {
887887 strPrint += (" error message:\n " + err_msg.get_str ());
888888 }
889- if (err_code.isNum () && err_code.get_int () == RPC_WALLET_NOT_SPECIFIED) {
889+ if (err_code.isNum () && err_code.getInt < int > () == RPC_WALLET_NOT_SPECIFIED) {
890890 strPrint += " \n Try adding \" -rpcwallet=<filename>\" option to bitcoin-cli command line." ;
891891 }
892892 } else {
893893 strPrint = " error: " + error.write ();
894894 }
895- nRet = abs (error[" code" ].get_int ());
895+ nRet = abs (error[" code" ].getInt < int > ());
896896}
897897
898898/* *
0 commit comments