Changeset View
Changeset View
Standalone View
Standalone View
src/rest.cpp
Show First 20 Lines • Show All 235 Lines • ▼ Show 20 Lines | CBlockIndex *tip = nullptr; | ||||
} | } | ||||
if (fHavePruned && !pblockindex->nStatus.hasData() && | if (fHavePruned && !pblockindex->nStatus.hasData() && | ||||
pblockindex->nTx > 0) { | pblockindex->nTx > 0) { | ||||
return RESTERR(req, HTTP_NOT_FOUND, | return RESTERR(req, HTTP_NOT_FOUND, | ||||
hashStr + " not available (pruned data)"); | hashStr + " not available (pruned data)"); | ||||
} | } | ||||
if (!ReadBlockFromDisk(block, pblockindex, config)) { | if (!ReadBlockFromDisk(block, pblockindex, | ||||
config.GetChainParams().GetConsensus())) { | |||||
return RESTERR(req, HTTP_NOT_FOUND, hashStr + " not found"); | return RESTERR(req, HTTP_NOT_FOUND, hashStr + " not found"); | ||||
} | } | ||||
} | } | ||||
CDataStream ssBlock(SER_NETWORK, | CDataStream ssBlock(SER_NETWORK, | ||||
PROTOCOL_VERSION | RPCSerializationFlags()); | PROTOCOL_VERSION | RPCSerializationFlags()); | ||||
ssBlock << block; | ssBlock << block; | ||||
▲ Show 20 Lines • Show All 132 Lines • ▼ Show 20 Lines | static bool rest_tx(Config &config, HTTPRequest *req, | ||||
const TxId txid(hash); | const TxId txid(hash); | ||||
if (g_txindex) { | if (g_txindex) { | ||||
g_txindex->BlockUntilSyncedToCurrentChain(); | g_txindex->BlockUntilSyncedToCurrentChain(); | ||||
} | } | ||||
CTransactionRef tx; | CTransactionRef tx; | ||||
uint256 hashBlock = uint256(); | uint256 hashBlock = uint256(); | ||||
if (!GetTransaction(config, txid, tx, hashBlock, true)) { | if (!GetTransaction(config.GetChainParams().GetConsensus(), txid, tx, | ||||
hashBlock, true)) { | |||||
return RESTERR(req, HTTP_NOT_FOUND, hashStr + " not found"); | return RESTERR(req, HTTP_NOT_FOUND, hashStr + " not found"); | ||||
} | } | ||||
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION | RPCSerializationFlags()); | CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION | RPCSerializationFlags()); | ||||
ssTx << tx; | ssTx << tx; | ||||
switch (rf) { | switch (rf) { | ||||
case RetFormat::BINARY: { | case RetFormat::BINARY: { | ||||
▲ Show 20 Lines • Show All 281 Lines • Show Last 20 Lines |