From a03f804f2aa0261ed3a47103dfe989ebd9302480 Mon Sep 17 00:00:00 2001 From: Jim Posen Date: Fri, 30 Mar 2018 00:39:08 -0700 Subject: [index] Move disk IO logic from GetTransaction to TxIndex::FindTx. --- src/validation.cpp | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'src/validation.cpp') diff --git a/src/validation.cpp b/src/validation.cpp index 5ea81bfc98..14257d78f9 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1029,27 +1029,7 @@ bool GetTransaction(const uint256& hash, CTransactionRef& txOut, const Consensus } if (g_txindex) { - CDiskTxPos postx; - if (g_txindex->FindTx(hash, postx)) { - CAutoFile file(OpenBlockFile(postx, true), SER_DISK, CLIENT_VERSION); - if (file.IsNull()) - return error("%s: OpenBlockFile failed", __func__); - CBlockHeader header; - try { - file >> header; - fseek(file.Get(), postx.nTxOffset, SEEK_CUR); - file >> txOut; - } catch (const std::exception& e) { - return error("%s: Deserialize or I/O error - %s", __func__, e.what()); - } - hashBlock = header.GetHash(); - if (txOut->GetHash() != hash) - return error("%s: txid mismatch", __func__); - return true; - } - - // transaction not found in index, nothing more can be done - return false; + return g_txindex->FindTx(hash, hashBlock, txOut); } if (fAllowSlow) { // use coin database to locate block that contains transaction, and scan it -- cgit v1.2.3