Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/proof.cpp
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | |||||
static constexpr Amount PROOF_DUST_THRESOLD = 1 * SATOSHI; | static constexpr Amount PROOF_DUST_THRESOLD = 1 * SATOSHI; | ||||
bool Proof::verify(ProofValidationState &state) const { | bool Proof::verify(ProofValidationState &state) const { | ||||
if (stakes.empty()) { | if (stakes.empty()) { | ||||
return state.Invalid(ProofValidationResult::NO_STAKE); | return state.Invalid(ProofValidationResult::NO_STAKE); | ||||
} | } | ||||
if (stakes.size() > AVALANCHE_MAX_PROOF_STAKES) { | |||||
return state.Invalid(ProofValidationResult::TOO_MANY_UTXOS); | |||||
} | |||||
std::unordered_set<COutPoint, SaltedOutpointHasher> utxos; | std::unordered_set<COutPoint, SaltedOutpointHasher> utxos; | ||||
for (const SignedStake &ss : stakes) { | for (const SignedStake &ss : stakes) { | ||||
const Stake &s = ss.getStake(); | const Stake &s = ss.getStake(); | ||||
if (s.getAmount() < PROOF_DUST_THRESOLD) { | if (s.getAmount() < PROOF_DUST_THRESOLD) { | ||||
return state.Invalid(ProofValidationResult::DUST_THRESOLD); | return state.Invalid(ProofValidationResult::DUST_THRESOLD); | ||||
} | } | ||||
if (!utxos.insert(s.getUTXO()).second) { | if (!utxos.insert(s.getUTXO()).second) { | ||||
▲ Show 20 Lines • Show All 66 Lines • Show Last 20 Lines |