Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/proofpool.h
Show All 39 Lines | struct ProofPoolEntryProofIdKeyExtractor { | ||||
} | } | ||||
}; | }; | ||||
namespace bmi = boost::multi_index; | namespace bmi = boost::multi_index; | ||||
/** | /** | ||||
* Map a proof to each utxo. A proof can be mapped with several utxos. | * Map a proof to each utxo. A proof can be mapped with several utxos. | ||||
*/ | */ | ||||
using ProofPool = boost::multi_index_container< | struct ProofPool { | ||||
boost::multi_index_container< | |||||
ProofPoolEntry, | ProofPoolEntry, | ||||
bmi::indexed_by< | bmi::indexed_by< | ||||
// index by utxo | // index by utxo | ||||
bmi::hashed_unique<bmi::tag<by_utxo>, | bmi::hashed_unique< | ||||
bmi::tag<by_utxo>, | |||||
bmi::const_mem_fun<ProofPoolEntry, const COutPoint &, | bmi::const_mem_fun<ProofPoolEntry, const COutPoint &, | ||||
&ProofPoolEntry::getUTXO>, | &ProofPoolEntry::getUTXO>, | ||||
SaltedOutpointHasher>, | SaltedOutpointHasher>, | ||||
// index by proofid | // index by proofid | ||||
bmi::hashed_non_unique<bmi::tag<by_proofid>, | bmi::hashed_non_unique<bmi::tag<by_proofid>, | ||||
ProofPoolEntryProofIdKeyExtractor, | ProofPoolEntryProofIdKeyExtractor, | ||||
SaltedProofIdHasher>>>; | SaltedProofIdHasher>>> | ||||
pool; | |||||
enum AddProofStatus { | |||||
REJECTED = 0, //!< Rejected due to conflicts | |||||
SUCCEED = 1, //!< Added successfully | |||||
DUPLICATED = 2, //!< Already in pool | |||||
}; | |||||
AddProofStatus addProof(const ProofRef &proof); | |||||
bool removeProof(ProofRef proof); | |||||
}; | |||||
} // namespace avalanche | } // namespace avalanche | ||||
#endif // BITCOIN_AVALANCHE_PROOFPOOL_H | #endif // BITCOIN_AVALANCHE_PROOFPOOL_H |