Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/proof.cpp
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | bool Proof::FromHex(Proof &proof, const std::string &hexProof, | ||||
return true; | return true; | ||||
} | } | ||||
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; | |||||
WriteCompactSize(ss, stakes.size()); | WriteCompactSize(ss, stakes.size()); | ||||
for (const SignedStake &s : stakes) { | for (const SignedStake &s : stakes) { | ||||
ss << s.getStake(); | ss << s.getStake(); | ||||
} | } | ||||
return ProofId(ss.GetHash()); | CHashWriter ss2(SER_GETHASH, 0); | ||||
ss2 << ss.GetHash(); | |||||
ss2 << master; | |||||
return ProofId(ss2.GetHash()); | |||||
} | } | ||||
uint32_t Proof::getScore() const { | uint32_t Proof::getScore() const { | ||||
Amount total = Amount::zero(); | Amount total = Amount::zero(); | ||||
for (const SignedStake &s : stakes) { | for (const SignedStake &s : stakes) { | ||||
total += s.getStake().getAmount(); | total += s.getStake().getAmount(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 107 Lines • Show Last 20 Lines |