Skip to content

Commit

Permalink
Replace HexBits with strprintf
Browse files Browse the repository at this point in the history
  • Loading branch information
jtimon committed Jun 28, 2014
1 parent ba81f45 commit 645d497
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/rpcblockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Object blockToJSON(const CBlock& block, const CBlockIndex* blockindex)
result.push_back(Pair("tx", txs));
result.push_back(Pair("time", block.GetBlockTime()));
result.push_back(Pair("nonce", (uint64_t)block.nNonce));
result.push_back(Pair("bits", HexBits(block.nBits)));
result.push_back(Pair("bits", strprintf("%08x", block.nBits)));
result.push_back(Pair("difficulty", GetDifficulty(blockindex)));
result.push_back(Pair("chainwork", blockindex->nChainWork.GetHex()));

Expand Down
2 changes: 1 addition & 1 deletion src/rpcmining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ Value getblocktemplate(const Array& params, bool fHelp)
result.push_back(Pair("sigoplimit", (int64_t)MAX_BLOCK_SIGOPS));
result.push_back(Pair("sizelimit", (int64_t)MAX_BLOCK_SIZE));
result.push_back(Pair("curtime", (int64_t)pblock->nTime));
result.push_back(Pair("bits", HexBits(pblock->nBits)));
result.push_back(Pair("bits", strprintf("%08x", pblock->nBits)));
result.push_back(Pair("height", (int64_t)(pindexPrev->nHeight+1)));

return result;
Expand Down
10 changes: 0 additions & 10 deletions src/rpcserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,6 @@ Value ValueFromAmount(int64_t amount)
return (double)amount / (double)COIN;
}

std::string HexBits(unsigned int nBits)
{
union {
int32_t nBits;
char cBits[4];
} uBits;
uBits.nBits = htonl((int32_t)nBits);
return HexStr(BEGIN(uBits.cBits), END(uBits.cBits));
}

uint256 ParseHashV(const Value& v, string strName)
{
string strHex;
Expand Down
1 change: 0 additions & 1 deletion src/rpcserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ extern int64_t nWalletUnlockTime;
extern int64_t AmountFromValue(const json_spirit::Value& value);
extern json_spirit::Value ValueFromAmount(int64_t amount);
extern double GetDifficulty(const CBlockIndex* blockindex = NULL);
extern std::string HexBits(unsigned int nBits);
extern std::string HelpRequiringPassphrase();
extern std::string HelpExampleCli(std::string methodname, std::string args);
extern std::string HelpExampleRpc(std::string methodname, std::string args);
Expand Down

0 comments on commit 645d497

Please sign in to comment.