MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / GetTxConfirmHeight

Function GetTxConfirmHeight

src/main.cpp:307–324  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

305}
306
307int32_t GetTxConfirmHeight(const uint256 &hash, CBlockDBCache &blockCache) {
308 if (SysCfg().IsTxIndex()) {
309 CDiskTxPos diskTxPos;
310 if (blockCache.ReadTxIndex(hash, diskTxPos)) {
311 CAutoFile file(OpenBlockFile(diskTxPos, true), SER_DISK, CLIENT_VERSION);
312 CBlockHeader header;
313 try {
314 file >> header;
315 } catch (std::exception &e) {
316 ERRORMSG("Deserialize or I/O error - %s", e.what());
317 return -1;
318 }
319 return header.GetHeight();
320 }
321 }
322
323 return -1;
324}
325
326// Return transaction in tx, and if it was found inside a block, its hash is placed in blockHash
327bool GetTransaction(std::shared_ptr<CBaseTx> &pBaseTx, const uint256 &hash, CBlockDBCache &blockCache,

Callers 2

getcontractregidFunction · 0.85
ExGetTxConfirmHeightFuncFunction · 0.85

Calls 5

OpenBlockFileFunction · 0.85
IsTxIndexMethod · 0.80
ReadTxIndexMethod · 0.80
whatMethod · 0.45
GetHeightMethod · 0.45

Tested by

no test coverage detected