Browse Source

Merge #9446: SetMerkleBranch: remove unused code, remove cs_main lock requirement

9e351c9 SetMerkleBranch: remove unused code, remove cs_main lock requirement (Jonas Schnelli)
0.14
Jonas Schnelli 8 years ago
parent
commit
510c0d9c79
No known key found for this signature in database
GPG Key ID: 29D4BCB6416F53EC
  1. 10
      src/wallet/wallet.cpp
  2. 2
      src/wallet/wallet.h

10
src/wallet/wallet.cpp

@ -3736,21 +3736,13 @@ CWalletKey::CWalletKey(int64_t nExpires)
nTimeExpires = nExpires; nTimeExpires = nExpires;
} }
int CMerkleTx::SetMerkleBranch(const CBlockIndex* pindex, int posInBlock) void CMerkleTx::SetMerkleBranch(const CBlockIndex* pindex, int posInBlock)
{ {
AssertLockHeld(cs_main);
// Update the tx's hashBlock // Update the tx's hashBlock
hashBlock = pindex->GetBlockHash(); hashBlock = pindex->GetBlockHash();
// set the position of the transaction in the block // set the position of the transaction in the block
nIndex = posInBlock; nIndex = posInBlock;
// Is the tx in a block that's in the main chain
if (!chainActive.Contains(pindex))
return 0;
return chainActive.Height() - pindex->nHeight + 1;
} }
int CMerkleTx::GetDepthInMainChain(const CBlockIndex* &pindexRet) const int CMerkleTx::GetDepthInMainChain(const CBlockIndex* &pindexRet) const

2
src/wallet/wallet.h

@ -218,7 +218,7 @@ public:
READWRITE(nIndex); READWRITE(nIndex);
} }
int SetMerkleBranch(const CBlockIndex* pIndex, int posInBlock); void SetMerkleBranch(const CBlockIndex* pIndex, int posInBlock);
/** /**
* Return depth of transaction in blockchain: * Return depth of transaction in blockchain:

Loading…
Cancel
Save