Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 4,623 Lines • ▼ Show 20 Lines | |||||
void CMerkleTx::SetMerkleBranch(const CBlockIndex *pindex, int posInBlock) { | void CMerkleTx::SetMerkleBranch(const CBlockIndex *pindex, int posInBlock) { | ||||
// 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; | ||||
} | } | ||||
int CMerkleTx::GetDepthInMainChain(const CBlockIndex *&pindexRet) const { | int CMerkleTx::GetDepthInMainChain() const { | ||||
if (hashUnset()) { | if (hashUnset()) { | ||||
return 0; | return 0; | ||||
} | } | ||||
AssertLockHeld(cs_main); | AssertLockHeld(cs_main); | ||||
// Find the block it claims to be in. | // Find the block it claims to be in. | ||||
CBlockIndex *pindex = LookupBlockIndex(hashBlock); | CBlockIndex *pindex = LookupBlockIndex(hashBlock); | ||||
if (!pindex || !chainActive.Contains(pindex)) { | if (!pindex || !chainActive.Contains(pindex)) { | ||||
return 0; | return 0; | ||||
} | } | ||||
pindexRet = pindex; | |||||
return ((nIndex == -1) ? (-1) : 1) * | return ((nIndex == -1) ? (-1) : 1) * | ||||
(chainActive.Height() - pindex->nHeight + 1); | (chainActive.Height() - pindex->nHeight + 1); | ||||
} | } | ||||
int CMerkleTx::GetBlocksToMaturity() const { | int CMerkleTx::GetBlocksToMaturity() const { | ||||
if (!IsCoinBase()) { | if (!IsCoinBase()) { | ||||
return 0; | return 0; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 122 Lines • Show Last 20 Lines |