Merge pull request 'Reduce memory usage' (#332) from reduce_memory into dev
Reviewed-on: https://git.hush.is/hush/hush3/pulls/332
This commit is contained in:
@@ -147,7 +147,7 @@ UniValue blockheaderToJSON(const CBlockIndex* blockindex)
|
||||
result.push_back(Pair("finalsaplingroot", blockindex->hashFinalSaplingRoot.GetHex()));
|
||||
result.push_back(Pair("time", (int64_t)blockindex->nTime));
|
||||
result.push_back(Pair("nonce", blockindex->nNonce.GetHex()));
|
||||
result.push_back(Pair("solution", HexStr(blockindex->nSolution)));
|
||||
result.pushKV("solution", HexStr(blockindex->GetBlockHeader().nSolution));
|
||||
result.push_back(Pair("bits", strprintf("%08x", blockindex->nBits)));
|
||||
result.push_back(Pair("difficulty", GetDifficulty(blockindex)));
|
||||
result.push_back(Pair("chainwork", blockindex->chainPower.chainWork.GetHex()));
|
||||
@@ -693,15 +693,18 @@ UniValue getblockheader(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
|
||||
CBlockIndex* pblockindex = mapBlockIndex[hash];
|
||||
|
||||
if (!fVerbose)
|
||||
{
|
||||
CDataStream ssBlock(SER_NETWORK, PROTOCOL_VERSION);
|
||||
ssBlock << pblockindex->GetBlockHeader();
|
||||
std::string strHex = HexStr(ssBlock.begin(), ssBlock.end());
|
||||
return strHex;
|
||||
try {
|
||||
if (!fVerbose) {
|
||||
CDataStream ssBlock(SER_NETWORK, PROTOCOL_VERSION);
|
||||
ssBlock << pblockindex->GetBlockHeader();
|
||||
std::string strHex = HexStr(ssBlock.begin(), ssBlock.end());
|
||||
return strHex;
|
||||
} else {
|
||||
return blockheaderToJSON(pblockindex);
|
||||
}
|
||||
} catch (const runtime_error&) {
|
||||
throw JSONRPCError(RPC_DATABASE_ERROR, "Failed to read index entry");
|
||||
}
|
||||
|
||||
return blockheaderToJSON(pblockindex);
|
||||
}
|
||||
|
||||
UniValue getblock(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
|
||||
Reference in New Issue
Block a user