| 305 | } |
| 306 | |
| 307 | int32_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 |
| 327 | bool GetTransaction(std::shared_ptr<CBaseTx> &pBaseTx, const uint256 &hash, CBlockDBCache &blockCache, |
no test coverage detected