Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/proof.h
Show All 39 Lines | |||||
namespace avalanche { | namespace avalanche { | ||||
/** Minimum amount per utxo */ | /** Minimum amount per utxo */ | ||||
static constexpr Amount PROOF_DUST_THRESHOLD = 1 * COIN; | static constexpr Amount PROOF_DUST_THRESHOLD = 1 * COIN; | ||||
class ProofValidationState; | class ProofValidationState; | ||||
struct ProofParams { | |||||
Amount stakeUtxoDustThreshold; | |||||
ProofParams() : stakeUtxoDustThreshold(PROOF_DUST_THRESHOLD) {} | |||||
}; | |||||
using StakeId = uint256; | using StakeId = uint256; | ||||
struct StakeCommitment : public uint256 { | struct StakeCommitment : public uint256 { | ||||
explicit StakeCommitment() : uint256() {} | explicit StakeCommitment() : uint256() {} | ||||
explicit StakeCommitment(const uint256 &b) : uint256(b) {} | explicit StakeCommitment(const uint256 &b) : uint256(b) {} | ||||
StakeCommitment(const ProofId &proofid, int64_t expirationTime, | StakeCommitment(const ProofId &proofid, int64_t expirationTime, | ||||
const CPubKey &master); | const CPubKey &master); | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 127 Lines • ▼ Show 20 Lines | public: | ||||
const ProofId &getId() const { return proofid; } | const ProofId &getId() const { return proofid; } | ||||
const LimitedProofId &getLimitedId() const { return limitedProofId; } | const LimitedProofId &getLimitedId() const { return limitedProofId; } | ||||
const StakeCommitment getStakeCommitment() const { | const StakeCommitment getStakeCommitment() const { | ||||
return StakeCommitment(proofid, expirationTime, master); | return StakeCommitment(proofid, expirationTime, master); | ||||
}; | }; | ||||
uint32_t getScore() const { return score; } | uint32_t getScore() const { return score; } | ||||
Amount getStakedAmount() const; | Amount getStakedAmount() const; | ||||
bool verify(ProofValidationState &state) const; | bool verify(const ProofParams ¶ms, ProofValidationState &state) const; | ||||
bool verify(ProofValidationState &state, | bool verify(const ProofParams ¶ms, ProofValidationState &state, | ||||
const ChainstateManager &chainman) const | const ChainstateManager &chainman) const | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main); | EXCLUSIVE_LOCKS_REQUIRED(cs_main); | ||||
}; | }; | ||||
using ProofRef = RCUPtr<const Proof>; | using ProofRef = RCUPtr<const Proof>; | ||||
class SaltedProofHasher : private SaltedUint256Hasher { | class SaltedProofHasher : private SaltedUint256Hasher { | ||||
public: | public: | ||||
Show All 9 Lines |