Browse Source

Merge pull request #4129

d56e30c removed a few unnecessary casts (Kamil Domanski)
3e74ac2 json_spirit: #include <stdint.h> (Kamil Domanski)
4b61a6a switch from boost int types to <stdint.h> (Kamil Domanski)
0.10
Wladimir J. van der Laan 11 years ago
parent
commit
bfae70aae6
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 12
      src/json/json_spirit_reader_template.h
  2. 32
      src/json/json_spirit_value.h
  3. 14
      src/rpcblockchain.cpp
  4. 52
      src/rpcclient.cpp
  5. 6
      src/rpcmining.cpp
  6. 6
      src/rpcmisc.cpp
  7. 18
      src/rpcnet.cpp
  8. 12
      src/rpcrawtransaction.cpp
  9. 12
      src/rpcwallet.cpp

12
src/json/json_spirit_reader_template.h

@ -33,8 +33,8 @@
namespace json_spirit namespace json_spirit
{ {
const spirit_namespace::int_parser < boost::int64_t > int64_p = spirit_namespace::int_parser < boost::int64_t >(); const spirit_namespace::int_parser < int64_t > int64_p = spirit_namespace::int_parser < int64_t >();
const spirit_namespace::uint_parser< boost::uint64_t > uint64_p = spirit_namespace::uint_parser< boost::uint64_t >(); const spirit_namespace::uint_parser< uint64_t > uint64_p = spirit_namespace::uint_parser< uint64_t >();
template< class Iter_type > template< class Iter_type >
bool is_eq( Iter_type first, Iter_type last, const char* c_str ) bool is_eq( Iter_type first, Iter_type last, const char* c_str )
@ -270,12 +270,12 @@ namespace json_spirit
add_to_current( Value_type() ); add_to_current( Value_type() );
} }
void new_int( boost::int64_t i ) void new_int( int64_t i )
{ {
add_to_current( i ); add_to_current( i );
} }
void new_uint64( boost::uint64_t ui ) void new_uint64( uint64_t ui )
{ {
add_to_current( ui ); add_to_current( ui );
} }
@ -425,8 +425,8 @@ namespace json_spirit
typedef boost::function< void( Char_type ) > Char_action; typedef boost::function< void( Char_type ) > Char_action;
typedef boost::function< void( Iter_type, Iter_type ) > Str_action; typedef boost::function< void( Iter_type, Iter_type ) > Str_action;
typedef boost::function< void( double ) > Real_action; typedef boost::function< void( double ) > Real_action;
typedef boost::function< void( boost::int64_t ) > Int_action; typedef boost::function< void( int64_t ) > Int_action;
typedef boost::function< void( boost::uint64_t ) > Uint64_action; typedef boost::function< void( uint64_t ) > Uint64_action;
Char_action begin_obj ( boost::bind( &Semantic_actions_t::begin_obj, &self.actions_, _1 ) ); Char_action begin_obj ( boost::bind( &Semantic_actions_t::begin_obj, &self.actions_, _1 ) );
Char_action end_obj ( boost::bind( &Semantic_actions_t::end_obj, &self.actions_, _1 ) ); Char_action end_obj ( boost::bind( &Semantic_actions_t::end_obj, &self.actions_, _1 ) );

32
src/json/json_spirit_value.h

@ -16,8 +16,8 @@
#include <cassert> #include <cassert>
#include <sstream> #include <sstream>
#include <stdexcept> #include <stdexcept>
#include <stdint.h>
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/cstdint.hpp>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <boost/variant.hpp> #include <boost/variant.hpp>
@ -45,8 +45,8 @@ namespace json_spirit
Value_impl( const Array& value ); Value_impl( const Array& value );
Value_impl( bool value ); Value_impl( bool value );
Value_impl( int value ); Value_impl( int value );
Value_impl( boost::int64_t value ); Value_impl( int64_t value );
Value_impl( boost::uint64_t value ); Value_impl( uint64_t value );
Value_impl( double value ); Value_impl( double value );
Value_impl( const Value_impl& other ); Value_impl( const Value_impl& other );
@ -65,8 +65,8 @@ namespace json_spirit
const Array& get_array() const; const Array& get_array() const;
bool get_bool() const; bool get_bool() const;
int get_int() const; int get_int() const;
boost::int64_t get_int64() const; int64_t get_int64() const;
boost::uint64_t get_uint64() const; uint64_t get_uint64() const;
double get_real() const; double get_real() const;
Object& get_obj(); Object& get_obj();
@ -83,7 +83,7 @@ namespace json_spirit
typedef boost::variant< String_type, typedef boost::variant< String_type,
boost::recursive_wrapper< Object >, boost::recursive_wrapper< Array >, boost::recursive_wrapper< Object >, boost::recursive_wrapper< Array >,
bool, boost::int64_t, double > Variant; bool, int64_t, double > Variant;
Value_type type_; Value_type type_;
Variant v_; Variant v_;
@ -258,13 +258,13 @@ namespace json_spirit
template< class Config > template< class Config >
Value_impl< Config >::Value_impl( int value ) Value_impl< Config >::Value_impl( int value )
: type_( int_type ) : type_( int_type )
, v_( static_cast< boost::int64_t >( value ) ) , v_( static_cast< int64_t >( value ) )
, is_uint64_( false ) , is_uint64_( false )
{ {
} }
template< class Config > template< class Config >
Value_impl< Config >::Value_impl( boost::int64_t value ) Value_impl< Config >::Value_impl( int64_t value )
: type_( int_type ) : type_( int_type )
, v_( value ) , v_( value )
, is_uint64_( false ) , is_uint64_( false )
@ -272,9 +272,9 @@ namespace json_spirit
} }
template< class Config > template< class Config >
Value_impl< Config >::Value_impl( boost::uint64_t value ) Value_impl< Config >::Value_impl( uint64_t value )
: type_( int_type ) : type_( int_type )
, v_( static_cast< boost::int64_t >( value ) ) , v_( static_cast< int64_t >( value ) )
, is_uint64_( true ) , is_uint64_( true )
{ {
} }
@ -390,19 +390,19 @@ namespace json_spirit
} }
template< class Config > template< class Config >
boost::int64_t Value_impl< Config >::get_int64() const int64_t Value_impl< Config >::get_int64() const
{ {
check_type( int_type ); check_type( int_type );
return boost::get< boost::int64_t >( v_ ); return boost::get< int64_t >( v_ );
} }
template< class Config > template< class Config >
boost::uint64_t Value_impl< Config >::get_uint64() const uint64_t Value_impl< Config >::get_uint64() const
{ {
check_type( int_type ); check_type( int_type );
return static_cast< boost::uint64_t >( get_int64() ); return static_cast< uint64_t >( get_int64() );
} }
template< class Config > template< class Config >
@ -481,13 +481,13 @@ namespace json_spirit
} }
template< class Value > template< class Value >
boost::int64_t get_value( const Value& value, Type_to_type< boost::int64_t > ) int64_t get_value( const Value& value, Type_to_type< int64_t > )
{ {
return value.get_int64(); return value.get_int64();
} }
template< class Value > template< class Value >
boost::uint64_t get_value( const Value& value, Type_to_type< boost::uint64_t > ) uint64_t get_value( const Value& value, Type_to_type< uint64_t > )
{ {
return value.get_uint64(); return value.get_uint64();
} }

14
src/rpcblockchain.cpp

@ -64,8 +64,8 @@ Object blockToJSON(const CBlock& block, const CBlockIndex* blockindex)
BOOST_FOREACH(const CTransaction&tx, block.vtx) BOOST_FOREACH(const CTransaction&tx, block.vtx)
txs.push_back(tx.GetHash().GetHex()); txs.push_back(tx.GetHash().GetHex());
result.push_back(Pair("tx", txs)); result.push_back(Pair("tx", txs));
result.push_back(Pair("time", (boost::int64_t)block.GetBlockTime())); result.push_back(Pair("time", block.GetBlockTime()));
result.push_back(Pair("nonce", (boost::uint64_t)block.nNonce)); result.push_back(Pair("nonce", (uint64_t)block.nNonce));
result.push_back(Pair("bits", HexBits(block.nBits))); result.push_back(Pair("bits", HexBits(block.nBits)));
result.push_back(Pair("difficulty", GetDifficulty(blockindex))); result.push_back(Pair("difficulty", GetDifficulty(blockindex)));
result.push_back(Pair("chainwork", blockindex->nChainWork.GetHex())); result.push_back(Pair("chainwork", blockindex->nChainWork.GetHex()));
@ -175,7 +175,7 @@ Value getrawmempool(const Array& params, bool fHelp)
Object info; Object info;
info.push_back(Pair("size", (int)e.GetTxSize())); info.push_back(Pair("size", (int)e.GetTxSize()));
info.push_back(Pair("fee", ValueFromAmount(e.GetFee()))); info.push_back(Pair("fee", ValueFromAmount(e.GetFee())));
info.push_back(Pair("time", (boost::int64_t)e.GetTime())); info.push_back(Pair("time", e.GetTime()));
info.push_back(Pair("height", (int)e.GetHeight())); info.push_back(Pair("height", (int)e.GetHeight()));
info.push_back(Pair("startingpriority", e.GetPriority(e.GetHeight()))); info.push_back(Pair("startingpriority", e.GetPriority(e.GetHeight())));
info.push_back(Pair("currentpriority", e.GetPriority(chainActive.Height()))); info.push_back(Pair("currentpriority", e.GetPriority(chainActive.Height())));
@ -315,11 +315,11 @@ Value gettxoutsetinfo(const Array& params, bool fHelp)
CCoinsStats stats; CCoinsStats stats;
if (pcoinsTip->GetStats(stats)) { if (pcoinsTip->GetStats(stats)) {
ret.push_back(Pair("height", (boost::int64_t)stats.nHeight)); ret.push_back(Pair("height", (int64_t)stats.nHeight));
ret.push_back(Pair("bestblock", stats.hashBlock.GetHex())); ret.push_back(Pair("bestblock", stats.hashBlock.GetHex()));
ret.push_back(Pair("transactions", (boost::int64_t)stats.nTransactions)); ret.push_back(Pair("transactions", (int64_t)stats.nTransactions));
ret.push_back(Pair("txouts", (boost::int64_t)stats.nTransactionOutputs)); ret.push_back(Pair("txouts", (int64_t)stats.nTransactionOutputs));
ret.push_back(Pair("bytes_serialized", (boost::int64_t)stats.nSerializedSize)); ret.push_back(Pair("bytes_serialized", (int64_t)stats.nSerializedSize));
ret.push_back(Pair("hash_serialized", stats.hashSerialized.GetHex())); ret.push_back(Pair("hash_serialized", stats.hashSerialized.GetHex()));
ret.push_back(Pair("total_amount", ValueFromAmount(stats.nTotalAmount))); ret.push_back(Pair("total_amount", ValueFromAmount(stats.nTotalAmount)));
} }

52
src/rpcclient.cpp

@ -128,53 +128,53 @@ Array RPCConvertValues(const std::string &strMethod, const std::vector<std::stri
if (strMethod == "stop" && n > 0) ConvertTo<bool>(params[0]); if (strMethod == "stop" && n > 0) ConvertTo<bool>(params[0]);
if (strMethod == "getaddednodeinfo" && n > 0) ConvertTo<bool>(params[0]); if (strMethod == "getaddednodeinfo" && n > 0) ConvertTo<bool>(params[0]);
if (strMethod == "setgenerate" && n > 0) ConvertTo<bool>(params[0]); if (strMethod == "setgenerate" && n > 0) ConvertTo<bool>(params[0]);
if (strMethod == "setgenerate" && n > 1) ConvertTo<boost::int64_t>(params[1]); if (strMethod == "setgenerate" && n > 1) ConvertTo<int64_t>(params[1]);
if (strMethod == "getnetworkhashps" && n > 0) ConvertTo<boost::int64_t>(params[0]); if (strMethod == "getnetworkhashps" && n > 0) ConvertTo<int64_t>(params[0]);
if (strMethod == "getnetworkhashps" && n > 1) ConvertTo<boost::int64_t>(params[1]); if (strMethod == "getnetworkhashps" && n > 1) ConvertTo<int64_t>(params[1]);
if (strMethod == "sendtoaddress" && n > 1) ConvertTo<double>(params[1]); if (strMethod == "sendtoaddress" && n > 1) ConvertTo<double>(params[1]);
if (strMethod == "settxfee" && n > 0) ConvertTo<double>(params[0]); if (strMethod == "settxfee" && n > 0) ConvertTo<double>(params[0]);
if (strMethod == "getreceivedbyaddress" && n > 1) ConvertTo<boost::int64_t>(params[1]); if (strMethod == "getreceivedbyaddress" && n > 1) ConvertTo<int64_t>(params[1]);
if (strMethod == "getreceivedbyaccount" && n > 1) ConvertTo<boost::int64_t>(params[1]); if (strMethod == "getreceivedbyaccount" && n > 1) ConvertTo<int64_t>(params[1]);
if (strMethod == "listreceivedbyaddress" && n > 0) ConvertTo<boost::int64_t>(params[0]); if (strMethod == "listreceivedbyaddress" && n > 0) ConvertTo<int64_t>(params[0]);
if (strMethod == "listreceivedbyaddress" && n > 1) ConvertTo<bool>(params[1]); if (strMethod == "listreceivedbyaddress" && n > 1) ConvertTo<bool>(params[1]);
if (strMethod == "listreceivedbyaccount" && n > 0) ConvertTo<boost::int64_t>(params[0]); if (strMethod == "listreceivedbyaccount" && n > 0) ConvertTo<int64_t>(params[0]);
if (strMethod == "listreceivedbyaccount" && n > 1) ConvertTo<bool>(params[1]); if (strMethod == "listreceivedbyaccount" && n > 1) ConvertTo<bool>(params[1]);
if (strMethod == "getbalance" && n > 1) ConvertTo<boost::int64_t>(params[1]); if (strMethod == "getbalance" && n > 1) ConvertTo<int64_t>(params[1]);
if (strMethod == "getblockhash" && n > 0) ConvertTo<boost::int64_t>(params[0]); if (strMethod == "getblockhash" && n > 0) ConvertTo<int64_t>(params[0]);
if (strMethod == "move" && n > 2) ConvertTo<double>(params[2]); if (strMethod == "move" && n > 2) ConvertTo<double>(params[2]);
if (strMethod == "move" && n > 3) ConvertTo<boost::int64_t>(params[3]); if (strMethod == "move" && n > 3) ConvertTo<int64_t>(params[3]);
if (strMethod == "sendfrom" && n > 2) ConvertTo<double>(params[2]); if (strMethod == "sendfrom" && n > 2) ConvertTo<double>(params[2]);
if (strMethod == "sendfrom" && n > 3) ConvertTo<boost::int64_t>(params[3]); if (strMethod == "sendfrom" && n > 3) ConvertTo<int64_t>(params[3]);
if (strMethod == "listtransactions" && n > 1) ConvertTo<boost::int64_t>(params[1]); if (strMethod == "listtransactions" && n > 1) ConvertTo<int64_t>(params[1]);
if (strMethod == "listtransactions" && n > 2) ConvertTo<boost::int64_t>(params[2]); if (strMethod == "listtransactions" && n > 2) ConvertTo<int64_t>(params[2]);
if (strMethod == "listaccounts" && n > 0) ConvertTo<boost::int64_t>(params[0]); if (strMethod == "listaccounts" && n > 0) ConvertTo<int64_t>(params[0]);
if (strMethod == "walletpassphrase" && n > 1) ConvertTo<boost::int64_t>(params[1]); if (strMethod == "walletpassphrase" && n > 1) ConvertTo<int64_t>(params[1]);
if (strMethod == "getblocktemplate" && n > 0) ConvertTo<Object>(params[0]); if (strMethod == "getblocktemplate" && n > 0) ConvertTo<Object>(params[0]);
if (strMethod == "listsinceblock" && n > 1) ConvertTo<boost::int64_t>(params[1]); if (strMethod == "listsinceblock" && n > 1) ConvertTo<int64_t>(params[1]);
if (strMethod == "sendmany" && n > 1) ConvertTo<Object>(params[1]); if (strMethod == "sendmany" && n > 1) ConvertTo<Object>(params[1]);
if (strMethod == "sendmany" && n > 2) ConvertTo<boost::int64_t>(params[2]); if (strMethod == "sendmany" && n > 2) ConvertTo<int64_t>(params[2]);
if (strMethod == "addmultisigaddress" && n > 0) ConvertTo<boost::int64_t>(params[0]); if (strMethod == "addmultisigaddress" && n > 0) ConvertTo<int64_t>(params[0]);
if (strMethod == "addmultisigaddress" && n > 1) ConvertTo<Array>(params[1]); if (strMethod == "addmultisigaddress" && n > 1) ConvertTo<Array>(params[1]);
if (strMethod == "createmultisig" && n > 0) ConvertTo<boost::int64_t>(params[0]); if (strMethod == "createmultisig" && n > 0) ConvertTo<int64_t>(params[0]);
if (strMethod == "createmultisig" && n > 1) ConvertTo<Array>(params[1]); if (strMethod == "createmultisig" && n > 1) ConvertTo<Array>(params[1]);
if (strMethod == "listunspent" && n > 0) ConvertTo<boost::int64_t>(params[0]); if (strMethod == "listunspent" && n > 0) ConvertTo<int64_t>(params[0]);
if (strMethod == "listunspent" && n > 1) ConvertTo<boost::int64_t>(params[1]); if (strMethod == "listunspent" && n > 1) ConvertTo<int64_t>(params[1]);
if (strMethod == "listunspent" && n > 2) ConvertTo<Array>(params[2]); if (strMethod == "listunspent" && n > 2) ConvertTo<Array>(params[2]);
if (strMethod == "getblock" && n > 1) ConvertTo<bool>(params[1]); if (strMethod == "getblock" && n > 1) ConvertTo<bool>(params[1]);
if (strMethod == "getrawtransaction" && n > 1) ConvertTo<boost::int64_t>(params[1]); if (strMethod == "getrawtransaction" && n > 1) ConvertTo<int64_t>(params[1]);
if (strMethod == "createrawtransaction" && n > 0) ConvertTo<Array>(params[0]); if (strMethod == "createrawtransaction" && n > 0) ConvertTo<Array>(params[0]);
if (strMethod == "createrawtransaction" && n > 1) ConvertTo<Object>(params[1]); if (strMethod == "createrawtransaction" && n > 1) ConvertTo<Object>(params[1]);
if (strMethod == "signrawtransaction" && n > 1) ConvertTo<Array>(params[1], true); if (strMethod == "signrawtransaction" && n > 1) ConvertTo<Array>(params[1], true);
if (strMethod == "signrawtransaction" && n > 2) ConvertTo<Array>(params[2], true); if (strMethod == "signrawtransaction" && n > 2) ConvertTo<Array>(params[2], true);
if (strMethod == "sendrawtransaction" && n > 1) ConvertTo<bool>(params[1], true); if (strMethod == "sendrawtransaction" && n > 1) ConvertTo<bool>(params[1], true);
if (strMethod == "gettxout" && n > 1) ConvertTo<boost::int64_t>(params[1]); if (strMethod == "gettxout" && n > 1) ConvertTo<int64_t>(params[1]);
if (strMethod == "gettxout" && n > 2) ConvertTo<bool>(params[2]); if (strMethod == "gettxout" && n > 2) ConvertTo<bool>(params[2]);
if (strMethod == "lockunspent" && n > 0) ConvertTo<bool>(params[0]); if (strMethod == "lockunspent" && n > 0) ConvertTo<bool>(params[0]);
if (strMethod == "lockunspent" && n > 1) ConvertTo<Array>(params[1]); if (strMethod == "lockunspent" && n > 1) ConvertTo<Array>(params[1]);
if (strMethod == "importprivkey" && n > 2) ConvertTo<bool>(params[2]); if (strMethod == "importprivkey" && n > 2) ConvertTo<bool>(params[2]);
if (strMethod == "verifychain" && n > 0) ConvertTo<boost::int64_t>(params[0]); if (strMethod == "verifychain" && n > 0) ConvertTo<int64_t>(params[0]);
if (strMethod == "verifychain" && n > 1) ConvertTo<boost::int64_t>(params[1]); if (strMethod == "verifychain" && n > 1) ConvertTo<int64_t>(params[1]);
if (strMethod == "keypoolrefill" && n > 0) ConvertTo<boost::int64_t>(params[0]); if (strMethod == "keypoolrefill" && n > 0) ConvertTo<int64_t>(params[0]);
if (strMethod == "getrawmempool" && n > 0) ConvertTo<bool>(params[0]); if (strMethod == "getrawmempool" && n > 0) ConvertTo<bool>(params[0]);
return params; return params;

6
src/rpcmining.cpp

@ -88,7 +88,7 @@ Value GetNetworkHashPS(int lookup, int height) {
uint256 workDiff = pb->nChainWork - pb0->nChainWork; uint256 workDiff = pb->nChainWork - pb0->nChainWork;
int64_t timeDiff = maxTime - minTime; int64_t timeDiff = maxTime - minTime;
return (boost::int64_t)(workDiff.getdouble() / timeDiff); return (int64_t)(workDiff.getdouble() / timeDiff);
} }
Value getnetworkhashps(const Array& params, bool fHelp) Value getnetworkhashps(const Array& params, bool fHelp)
@ -226,8 +226,8 @@ Value gethashespersec(const Array& params, bool fHelp)
); );
if (GetTimeMillis() - nHPSTimerStart > 8000) if (GetTimeMillis() - nHPSTimerStart > 8000)
return (boost::int64_t)0; return (int64_t)0;
return (boost::int64_t)dHashesPerSec; return (int64_t)dHashesPerSec;
} }
#endif #endif

6
src/rpcmisc.cpp

@ -69,18 +69,18 @@ Value getinfo(const Array& params, bool fHelp)
} }
#endif #endif
obj.push_back(Pair("blocks", (int)chainActive.Height())); obj.push_back(Pair("blocks", (int)chainActive.Height()));
obj.push_back(Pair("timeoffset", (boost::int64_t)GetTimeOffset())); obj.push_back(Pair("timeoffset", GetTimeOffset()));
obj.push_back(Pair("connections", (int)vNodes.size())); obj.push_back(Pair("connections", (int)vNodes.size()));
obj.push_back(Pair("proxy", (proxy.first.IsValid() ? proxy.first.ToStringIPPort() : string()))); obj.push_back(Pair("proxy", (proxy.first.IsValid() ? proxy.first.ToStringIPPort() : string())));
obj.push_back(Pair("difficulty", (double)GetDifficulty())); obj.push_back(Pair("difficulty", (double)GetDifficulty()));
obj.push_back(Pair("testnet", TestNet())); obj.push_back(Pair("testnet", TestNet()));
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
if (pwalletMain) { if (pwalletMain) {
obj.push_back(Pair("keypoololdest", (boost::int64_t)pwalletMain->GetOldestKeyPoolTime())); obj.push_back(Pair("keypoololdest", pwalletMain->GetOldestKeyPoolTime()));
obj.push_back(Pair("keypoolsize", (int)pwalletMain->GetKeyPoolSize())); obj.push_back(Pair("keypoolsize", (int)pwalletMain->GetKeyPoolSize()));
} }
if (pwalletMain && pwalletMain->IsCrypted()) if (pwalletMain && pwalletMain->IsCrypted())
obj.push_back(Pair("unlocked_until", (boost::int64_t)nWalletUnlockTime)); obj.push_back(Pair("unlocked_until", nWalletUnlockTime));
obj.push_back(Pair("paytxfee", ValueFromAmount(nTransactionFee))); obj.push_back(Pair("paytxfee", ValueFromAmount(nTransactionFee)));
#endif #endif
obj.push_back(Pair("relayfee", ValueFromAmount(CTransaction::nMinRelayTxFee))); obj.push_back(Pair("relayfee", ValueFromAmount(CTransaction::nMinRelayTxFee)));

18
src/rpcnet.cpp

@ -116,11 +116,11 @@ Value getpeerinfo(const Array& params, bool fHelp)
if (!(stats.addrLocal.empty())) if (!(stats.addrLocal.empty()))
obj.push_back(Pair("addrlocal", stats.addrLocal)); obj.push_back(Pair("addrlocal", stats.addrLocal));
obj.push_back(Pair("services", strprintf("%08x", stats.nServices))); obj.push_back(Pair("services", strprintf("%08x", stats.nServices)));
obj.push_back(Pair("lastsend", (boost::int64_t)stats.nLastSend)); obj.push_back(Pair("lastsend", stats.nLastSend));
obj.push_back(Pair("lastrecv", (boost::int64_t)stats.nLastRecv)); obj.push_back(Pair("lastrecv", stats.nLastRecv));
obj.push_back(Pair("bytessent", (boost::int64_t)stats.nSendBytes)); obj.push_back(Pair("bytessent", stats.nSendBytes));
obj.push_back(Pair("bytesrecv", (boost::int64_t)stats.nRecvBytes)); obj.push_back(Pair("bytesrecv", stats.nRecvBytes));
obj.push_back(Pair("conntime", (boost::int64_t)stats.nTimeConnected)); obj.push_back(Pair("conntime", stats.nTimeConnected));
obj.push_back(Pair("pingtime", stats.dPingTime)); obj.push_back(Pair("pingtime", stats.dPingTime));
if (stats.dPingWait > 0.0) if (stats.dPingWait > 0.0)
obj.push_back(Pair("pingwait", stats.dPingWait)); obj.push_back(Pair("pingwait", stats.dPingWait));
@ -328,9 +328,9 @@ Value getnettotals(const Array& params, bool fHelp)
); );
Object obj; Object obj;
obj.push_back(Pair("totalbytesrecv", static_cast< boost::uint64_t>(CNode::GetTotalBytesRecv()))); obj.push_back(Pair("totalbytesrecv", CNode::GetTotalBytesRecv()));
obj.push_back(Pair("totalbytessent", static_cast<boost::uint64_t>(CNode::GetTotalBytesSent()))); obj.push_back(Pair("totalbytessent", CNode::GetTotalBytesSent()));
obj.push_back(Pair("timemillis", static_cast<boost::int64_t>(GetTimeMillis()))); obj.push_back(Pair("timemillis", GetTimeMillis()));
return obj; return obj;
} }
@ -365,7 +365,7 @@ Value getnetworkinfo(const Array& params, bool fHelp)
Object obj; Object obj;
obj.push_back(Pair("version", (int)CLIENT_VERSION)); obj.push_back(Pair("version", (int)CLIENT_VERSION));
obj.push_back(Pair("protocolversion",(int)PROTOCOL_VERSION)); obj.push_back(Pair("protocolversion",(int)PROTOCOL_VERSION));
obj.push_back(Pair("timeoffset", (boost::int64_t)GetTimeOffset())); obj.push_back(Pair("timeoffset", GetTimeOffset()));
obj.push_back(Pair("connections", (int)vNodes.size())); obj.push_back(Pair("connections", (int)vNodes.size()));
obj.push_back(Pair("proxy", (proxy.first.IsValid() ? proxy.first.ToStringIPPort() : string()))); obj.push_back(Pair("proxy", (proxy.first.IsValid() ? proxy.first.ToStringIPPort() : string())));
obj.push_back(Pair("relayfee", ValueFromAmount(CTransaction::nMinRelayTxFee))); obj.push_back(Pair("relayfee", ValueFromAmount(CTransaction::nMinRelayTxFee)));

12
src/rpcrawtransaction.cpp

@ -55,7 +55,7 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry)
{ {
entry.push_back(Pair("txid", tx.GetHash().GetHex())); entry.push_back(Pair("txid", tx.GetHash().GetHex()));
entry.push_back(Pair("version", tx.nVersion)); entry.push_back(Pair("version", tx.nVersion));
entry.push_back(Pair("locktime", (boost::int64_t)tx.nLockTime)); entry.push_back(Pair("locktime", (int64_t)tx.nLockTime));
Array vin; Array vin;
BOOST_FOREACH(const CTxIn& txin, tx.vin) BOOST_FOREACH(const CTxIn& txin, tx.vin)
{ {
@ -65,13 +65,13 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry)
else else
{ {
in.push_back(Pair("txid", txin.prevout.hash.GetHex())); in.push_back(Pair("txid", txin.prevout.hash.GetHex()));
in.push_back(Pair("vout", (boost::int64_t)txin.prevout.n)); in.push_back(Pair("vout", (int64_t)txin.prevout.n));
Object o; Object o;
o.push_back(Pair("asm", txin.scriptSig.ToString())); o.push_back(Pair("asm", txin.scriptSig.ToString()));
o.push_back(Pair("hex", HexStr(txin.scriptSig.begin(), txin.scriptSig.end()))); o.push_back(Pair("hex", HexStr(txin.scriptSig.begin(), txin.scriptSig.end())));
in.push_back(Pair("scriptSig", o)); in.push_back(Pair("scriptSig", o));
} }
in.push_back(Pair("sequence", (boost::int64_t)txin.nSequence)); in.push_back(Pair("sequence", (int64_t)txin.nSequence));
vin.push_back(in); vin.push_back(in);
} }
entry.push_back(Pair("vin", vin)); entry.push_back(Pair("vin", vin));
@ -81,7 +81,7 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry)
const CTxOut& txout = tx.vout[i]; const CTxOut& txout = tx.vout[i];
Object out; Object out;
out.push_back(Pair("value", ValueFromAmount(txout.nValue))); out.push_back(Pair("value", ValueFromAmount(txout.nValue)));
out.push_back(Pair("n", (boost::int64_t)i)); out.push_back(Pair("n", (int64_t)i));
Object o; Object o;
ScriptPubKeyToJSON(txout.scriptPubKey, o, true); ScriptPubKeyToJSON(txout.scriptPubKey, o, true);
out.push_back(Pair("scriptPubKey", o)); out.push_back(Pair("scriptPubKey", o));
@ -99,8 +99,8 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry)
if (chainActive.Contains(pindex)) if (chainActive.Contains(pindex))
{ {
entry.push_back(Pair("confirmations", 1 + chainActive.Height() - pindex->nHeight)); entry.push_back(Pair("confirmations", 1 + chainActive.Height() - pindex->nHeight));
entry.push_back(Pair("time", (boost::int64_t)pindex->nTime)); entry.push_back(Pair("time", (int64_t)pindex->nTime));
entry.push_back(Pair("blocktime", (boost::int64_t)pindex->nTime)); entry.push_back(Pair("blocktime", (int64_t)pindex->nTime));
} }
else else
entry.push_back(Pair("confirmations", 0)); entry.push_back(Pair("confirmations", 0));

12
src/rpcwallet.cpp

@ -49,7 +49,7 @@ void WalletTxToJSON(const CWalletTx& wtx, Object& entry)
{ {
entry.push_back(Pair("blockhash", wtx.hashBlock.GetHex())); entry.push_back(Pair("blockhash", wtx.hashBlock.GetHex()));
entry.push_back(Pair("blockindex", wtx.nIndex)); entry.push_back(Pair("blockindex", wtx.nIndex));
entry.push_back(Pair("blocktime", (boost::int64_t)(mapBlockIndex[wtx.hashBlock]->nTime))); entry.push_back(Pair("blocktime", (int64_t)(mapBlockIndex[wtx.hashBlock]->nTime)));
} }
uint256 hash = wtx.GetHash(); uint256 hash = wtx.GetHash();
entry.push_back(Pair("txid", hash.GetHex())); entry.push_back(Pair("txid", hash.GetHex()));
@ -57,8 +57,8 @@ void WalletTxToJSON(const CWalletTx& wtx, Object& entry)
BOOST_FOREACH(const uint256& conflict, wtx.GetConflicts()) BOOST_FOREACH(const uint256& conflict, wtx.GetConflicts())
conflicts.push_back(conflict.GetHex()); conflicts.push_back(conflict.GetHex());
entry.push_back(Pair("walletconflicts", conflicts)); entry.push_back(Pair("walletconflicts", conflicts));
entry.push_back(Pair("time", (boost::int64_t)wtx.GetTxTime())); entry.push_back(Pair("time", wtx.GetTxTime()));
entry.push_back(Pair("timereceived", (boost::int64_t)wtx.nTimeReceived)); entry.push_back(Pair("timereceived", (int64_t)wtx.nTimeReceived));
BOOST_FOREACH(const PAIRTYPE(string,string)& item, wtx.mapValue) BOOST_FOREACH(const PAIRTYPE(string,string)& item, wtx.mapValue)
entry.push_back(Pair(item.first, item.second)); entry.push_back(Pair(item.first, item.second));
} }
@ -1167,7 +1167,7 @@ void AcentryToJSON(const CAccountingEntry& acentry, const string& strAccount, Ar
Object entry; Object entry;
entry.push_back(Pair("account", acentry.strAccount)); entry.push_back(Pair("account", acentry.strAccount));
entry.push_back(Pair("category", "move")); entry.push_back(Pair("category", "move"));
entry.push_back(Pair("time", (boost::int64_t)acentry.nTime)); entry.push_back(Pair("time", acentry.nTime));
entry.push_back(Pair("amount", ValueFromAmount(acentry.nCreditDebit))); entry.push_back(Pair("amount", ValueFromAmount(acentry.nCreditDebit)));
entry.push_back(Pair("otheraccount", acentry.strOtherAccount)); entry.push_back(Pair("otheraccount", acentry.strOtherAccount));
entry.push_back(Pair("comment", acentry.strComment)); entry.push_back(Pair("comment", acentry.strComment));
@ -1912,9 +1912,9 @@ Value getwalletinfo(const Array& params, bool fHelp)
obj.push_back(Pair("walletversion", pwalletMain->GetVersion())); obj.push_back(Pair("walletversion", pwalletMain->GetVersion()));
obj.push_back(Pair("balance", ValueFromAmount(pwalletMain->GetBalance()))); obj.push_back(Pair("balance", ValueFromAmount(pwalletMain->GetBalance())));
obj.push_back(Pair("txcount", (int)pwalletMain->mapWallet.size())); obj.push_back(Pair("txcount", (int)pwalletMain->mapWallet.size()));
obj.push_back(Pair("keypoololdest", (boost::int64_t)pwalletMain->GetOldestKeyPoolTime())); obj.push_back(Pair("keypoololdest", pwalletMain->GetOldestKeyPoolTime()));
obj.push_back(Pair("keypoolsize", (int)pwalletMain->GetKeyPoolSize())); obj.push_back(Pair("keypoolsize", (int)pwalletMain->GetKeyPoolSize()));
if (pwalletMain->IsCrypted()) if (pwalletMain->IsCrypted())
obj.push_back(Pair("unlocked_until", (boost::int64_t)nWalletUnlockTime)); obj.push_back(Pair("unlocked_until", nWalletUnlockTime));
return obj; return obj;
} }

Loading…
Cancel
Save