From: CryptoManiac Date: Thu, 31 Mar 2016 20:01:15 +0000 (+0300) Subject: Revert 2d6690cc0c0e2525996856c392566133d1b2de50 X-Git-Tag: nvc-v0.5.8~14 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=68a1b56a7c7a82ee863f5bddbb7708946da950a6;hp=27ce22da0815f4c1fa0e949cc4740e3f4dd1ea9c Revert 2d6690cc0c0e2525996856c392566133d1b2de50 --- 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; }