From 68a1b56a7c7a82ee863f5bddbb7708946da950a6 Mon Sep 17 00:00:00 2001 From: CryptoManiac Date: Thu, 31 Mar 2016 23:01:15 +0300 Subject: [PATCH] Revert 2d6690cc0c0e2525996856c392566133d1b2de50 --- src/main.cpp | 11 +++++++++++ src/main.h | 2 +- 2 files changed, 12 insertions(+), 1 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 502aa15..292cc51 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -446,6 +446,17 @@ int CMerkleTx::SetMerkleBranch(const CBlock* pblock) { CBlock blockTmp; + if (pblock == NULL) + { + // Load the block this tx is in + CTxIndex txindex; + if (!CTxDB("r").ReadTxIndex(GetHash(), txindex)) + return 0; + if (!blockTmp.ReadFromDisk(txindex.pos.nFile, txindex.pos.nBlockPos)) + return 0; + pblock = &blockTmp; + } + // Update the tx's hashBlock hashBlock = pblock->GetHash(); diff --git a/src/main.h b/src/main.h index 0a9a663..382ef1a 100644 --- a/src/main.h +++ b/src/main.h @@ -794,7 +794,7 @@ public: ) - int SetMerkleBranch(const CBlock* pblock); + int SetMerkleBranch(const CBlock* pblock=NULL); int GetDepthInMainChain(CBlockIndex* &pindexRet) const; int GetDepthInMainChain() const { CBlockIndex *pindexRet; return GetDepthInMainChain(pindexRet); } bool IsInMainChain() const { return GetDepthInMainChain() > 0; } -- 1.7.1