Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/proofpool.h
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | bool forUtxo(const COutPoint &outpoint, Callable fun) const { | ||||
return it != utxos.end() && fun(it->second); | return it != utxos.end() && fun(it->second); | ||||
} | } | ||||
template <typename Callable> void forEachUtxo(Callable fun) const { | template <typename Callable> void forEachUtxo(Callable fun) const { | ||||
for (const auto &[outpoint, proofs] : utxos) { | for (const auto &[outpoint, proofs] : utxos) { | ||||
fun(outpoint, proofs); | fun(outpoint, proofs); | ||||
} | } | ||||
} | } | ||||
template <typename Callable> | |||||
void forEachConflictingProof(const ProofRef &proof, Callable fun) const { | |||||
for (const SignedStake &ss : proof->getStakes()) { | |||||
auto it = utxos.find(ss.getStake().getUTXO()); | |||||
if (it == utxos.end()) { | |||||
continue; | |||||
} | |||||
for (const ProofRef &p : it->second) { | |||||
if (p->getId() != proof->getId()) { | |||||
fun(p); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
}; | }; | ||||
} // namespace avalanche | } // namespace avalanche | ||||
#endif // BITCOIN_AVALANCHE_PROOFPOOL_H | #endif // BITCOIN_AVALANCHE_PROOFPOOL_H |