Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/delegation.cpp
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
bool Delegation::verify(DelegationState &state, CPubKey &auth) const { | bool Delegation::verify(DelegationState &state, CPubKey &auth) const { | ||||
uint256 hash = getProofId(); | uint256 hash = getProofId(); | ||||
const CPubKey *pauth = &proofMaster; | const CPubKey *pauth = &proofMaster; | ||||
bool ret = reduceLevels(hash, levels, [&](const Level &l) { | bool ret = reduceLevels(hash, levels, [&](const Level &l) { | ||||
if (!pauth->VerifySchnorr(hash, l.sig)) { | if (!pauth->VerifySchnorr(hash, l.sig)) { | ||||
return state.Invalid(DelegationResult::INVALID_SIGNATURE); | return state.Invalid(DelegationResult::INVALID_SIGNATURE, | ||||
"invalid-signature"); | |||||
} | } | ||||
// This key is valid, now up to the next delegation level. | // This key is valid, now up to the next delegation level. | ||||
pauth = &l.pubkey; | pauth = &l.pubkey; | ||||
return true; | return true; | ||||
}); | }); | ||||
auth = *pauth; | auth = *pauth; | ||||
return ret; | return ret; | ||||
} | } | ||||
} // namespace avalanche | } // namespace avalanche |