Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/proofpool.cpp
Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | |||||
// deleted during the erasure loop, so we pass it by value. Since it's a shared | // deleted during the erasure loop, so we pass it by value. Since it's a shared | ||||
// pointer, the copy is cheap enough and should not have any significant impact | // pointer, the copy is cheap enough and should not have any significant impact | ||||
// on performance. | // on performance. | ||||
bool ProofPool::removeProof(ProofRef proof) { | bool ProofPool::removeProof(ProofRef proof) { | ||||
auto &poolView = pool.get<by_proofid>(); | auto &poolView = pool.get<by_proofid>(); | ||||
return poolView.erase(proof->getId()); | return poolView.erase(proof->getId()); | ||||
} | } | ||||
ProofRef ProofPool::getProof(const ProofId &proofid) const { | |||||
auto &poolView = pool.get<by_proofid>(); | |||||
auto it = poolView.find(proofid); | |||||
return it == poolView.end() ? nullptr : it->proof; | |||||
} | |||||
} // namespace avalanche | } // namespace avalanche |