Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/proof.cpp
Show All 15 Lines | |||||
uint256 Stake::getHash(const ProofId &proofid) const { | uint256 Stake::getHash(const ProofId &proofid) const { | ||||
CHashWriter ss(SER_GETHASH, 0); | CHashWriter ss(SER_GETHASH, 0); | ||||
ss << proofid; | ss << proofid; | ||||
ss << *this; | ss << *this; | ||||
return ss.GetHash(); | return ss.GetHash(); | ||||
} | } | ||||
bool SignedStake::verify(const ProofId &proofid) const { | bool SignedStake::verify(const ProofId &proofid) const { | ||||
// Unfortunately, the verify API require a vector. | return stake.getPubkey().VerifySchnorr(stake.getHash(proofid), sig); | ||||
std::vector<uint8_t> vchSig{sig.begin(), sig.end()}; | |||||
return stake.getPubkey().VerifySchnorr(stake.getHash(proofid), vchSig); | |||||
} | } | ||||
ProofId Proof::computeProofId() const { | ProofId Proof::computeProofId() const { | ||||
CHashWriter ss(SER_GETHASH, 0); | CHashWriter ss(SER_GETHASH, 0); | ||||
ss << sequence; | ss << sequence; | ||||
ss << expirationTime; | ss << expirationTime; | ||||
ss << master; | ss << master; | ||||
▲ Show 20 Lines • Show All 98 Lines • Show Last 20 Lines |