|
|
@ -178,9 +178,12 @@ static bool rest_headers(HTTPRequest* req, |
|
|
|
} |
|
|
|
} |
|
|
|
case RF_JSON: { |
|
|
|
case RF_JSON: { |
|
|
|
UniValue jsonHeaders(UniValue::VARR); |
|
|
|
UniValue jsonHeaders(UniValue::VARR); |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
LOCK(cs_main); |
|
|
|
for (const CBlockIndex *pindex : headers) { |
|
|
|
for (const CBlockIndex *pindex : headers) { |
|
|
|
jsonHeaders.push_back(blockheaderToJSON(pindex)); |
|
|
|
jsonHeaders.push_back(blockheaderToJSON(pindex)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
std::string strJSON = jsonHeaders.write() + "\n"; |
|
|
|
std::string strJSON = jsonHeaders.write() + "\n"; |
|
|
|
req->WriteHeader("Content-Type", "application/json"); |
|
|
|
req->WriteHeader("Content-Type", "application/json"); |
|
|
|
req->WriteReply(HTTP_OK, strJSON); |
|
|
|
req->WriteReply(HTTP_OK, strJSON); |
|
|
@ -239,7 +242,11 @@ static bool rest_block(HTTPRequest* req, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
case RF_JSON: { |
|
|
|
case RF_JSON: { |
|
|
|
UniValue objBlock = blockToJSON(block, pblockindex, showTxDetails); |
|
|
|
UniValue objBlock; |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
LOCK(cs_main); |
|
|
|
|
|
|
|
objBlock = blockToJSON(block, pblockindex, showTxDetails); |
|
|
|
|
|
|
|
} |
|
|
|
std::string strJSON = objBlock.write() + "\n"; |
|
|
|
std::string strJSON = objBlock.write() + "\n"; |
|
|
|
req->WriteHeader("Content-Type", "application/json"); |
|
|
|
req->WriteHeader("Content-Type", "application/json"); |
|
|
|
req->WriteReply(HTTP_OK, strJSON); |
|
|
|
req->WriteReply(HTTP_OK, strJSON); |
|
|
|