Revert 2d6690cc0c0e2525996856c392566133d1b2de50
authorCryptoManiac <balthazar@yandex.ru>
Thu, 31 Mar 2016 20:01:15 +0000 (23:01 +0300)
committerCryptoManiac <balthazar@yandex.ru>
Thu, 31 Mar 2016 20:01:15 +0000 (23:01 +0300)
src/main.cpp
src/main.h

index 502aa15..292cc51 100644 (file)
@@ -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();
 
index 0a9a663..382ef1a 100644 (file)
@@ -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; }