Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
Show First 20 Lines • Show All 4,131 Lines • ▼ Show 20 Lines | if (msg_type == NetMsgType::AVAHELLO) { | ||||
avalanche::DelegationState state; | avalanche::DelegationState state; | ||||
CPubKey pubkey; | CPubKey pubkey; | ||||
if (!delegation.verify(state, pubkey)) { | if (!delegation.verify(state, pubkey)) { | ||||
Misbehaving(pfrom, 100, "invalid-delegation"); | Misbehaving(pfrom, 100, "invalid-delegation"); | ||||
return; | return; | ||||
} | } | ||||
CHashWriter sighasher(SER_GETHASH, 0); | |||||
sighasher << pfrom.m_avalanche_state->delegation.getId(); | |||||
sighasher << pfrom.nRemoteHostNonce; | |||||
sighasher << pfrom.GetLocalNonce(); | |||||
sighasher << pfrom.nRemoteExtraEntropy; | |||||
sighasher << pfrom.GetLocalExtraEntropy(); | |||||
SchnorrSig sig; | SchnorrSig sig; | ||||
verifier >> sig; | verifier >> sig; | ||||
if (!pubkey.VerifySchnorr(g_avalanche->buildRemoteSighash(&pfrom), | if (!pubkey.VerifySchnorr(sighasher.GetHash(), sig)) { | ||||
sig)) { | |||||
Misbehaving(pfrom, 100, "invalid-avahello-signature"); | Misbehaving(pfrom, 100, "invalid-avahello-signature"); | ||||
return; | return; | ||||
} | } | ||||
// If we don't know this proof already, add it to the tracker so it can | // If we don't know this proof already, add it to the tracker so it can | ||||
// be requested. | // be requested. | ||||
const avalanche::ProofId proofid(delegation.getProofId()); | const avalanche::ProofId proofid(delegation.getProofId()); | ||||
if (!AlreadyHaveProof(proofid)) { | if (!AlreadyHaveProof(proofid)) { | ||||
▲ Show 20 Lines • Show All 1,692 Lines • Show Last 20 Lines |