Changeset View
Changeset View
Standalone View
Standalone View
src/chain.cpp
Show First 20 Lines • Show All 178 Lines • ▼ Show 20 Lines | while (pa != pb && pa && pb) { | ||||
pa = pa->pprev; | pa = pa->pprev; | ||||
pb = pb->pprev; | pb = pb->pprev; | ||||
} | } | ||||
// Eventually all chain branches meet at the genesis block. | // Eventually all chain branches meet at the genesis block. | ||||
assert(pa == pb); | assert(pa == pb); | ||||
return pa; | return pa; | ||||
} | } | ||||
bool AreOnTheSameFork(const CBlockIndex *pa, const CBlockIndex *pb) { | |||||
// The common ancstor needs to be either pa (pb is a child of pa) or pb (pa | |||||
jasonbcox: ancstor -> ancestor | |||||
// is a child of pb). | |||||
const CBlockIndex *pindexCommon = LastCommonAncestor(pa, pb); | |||||
return pindexCommon == pa || pindexCommon == pb; | |||||
} |
ancstor -> ancestor