Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/processor.cpp
Show First 20 Lines • Show All 259 Lines • ▼ Show 20 Lines | return blockVoteRecords.getWriteView() | ||||
->insert(std::make_pair(pindex, VoteRecord(isAccepted))) | ->insert(std::make_pair(pindex, VoteRecord(isAccepted))) | ||||
.second; | .second; | ||||
} | } | ||||
void Processor::addProofToReconcile(const ProofRef &proof) { | void Processor::addProofToReconcile(const ProofRef &proof) { | ||||
// TODO We don't want to accept an infinite number of conflicting proofs. | // TODO We don't want to accept an infinite number of conflicting proofs. | ||||
// They should be some rules to make them expensive and/or limited by | // They should be some rules to make them expensive and/or limited by | ||||
// design. | // design. | ||||
const bool isAccepted = | const bool isAccepted = WITH_LOCK( | ||||
WITH_LOCK(cs_peerManager, return peerManager->isValid(proof->getId())); | cs_peerManager, return peerManager->isBoundToPeer(proof->getId())); | ||||
proofVoteRecords.getWriteView()->insert( | proofVoteRecords.getWriteView()->insert( | ||||
std::make_pair(proof, VoteRecord(isAccepted))); | std::make_pair(proof, VoteRecord(isAccepted))); | ||||
} | } | ||||
bool Processor::isAccepted(const CBlockIndex *pindex) const { | bool Processor::isAccepted(const CBlockIndex *pindex) const { | ||||
auto r = blockVoteRecords.getReadView(); | auto r = blockVoteRecords.getReadView(); | ||||
auto it = r->find(pindex); | auto it = r->find(pindex); | ||||
▲ Show 20 Lines • Show All 450 Lines • Show Last 20 Lines |