Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
Show First 20 Lines • Show All 3,978 Lines • ▼ Show 20 Lines | if (msg_type == NetMsgType::AVAHELLO) { | ||||
pfrom.m_avalanche_state = std::make_unique<CNode::AvalancheState>(); | pfrom.m_avalanche_state = std::make_unique<CNode::AvalancheState>(); | ||||
} | } | ||||
CHashVerifier<CDataStream> verifier(&vRecv); | CHashVerifier<CDataStream> verifier(&vRecv); | ||||
avalanche::Delegation &delegation = pfrom.m_avalanche_state->delegation; | avalanche::Delegation &delegation = pfrom.m_avalanche_state->delegation; | ||||
verifier >> delegation; | verifier >> delegation; | ||||
avalanche::Proof proof; | avalanche::Proof proof; | ||||
// TODO: read proof from message | |||||
if (proof.getStakes().size() > AVALANCHE_MAX_PROOF_STAKES) { | |||||
Misbehaving(pfrom, 100, "too-large-avalanche-proof"); | |||||
return; | |||||
} | |||||
avalanche::DelegationState state; | avalanche::DelegationState state; | ||||
CPubKey pubkey; | CPubKey pubkey; | ||||
if (!delegation.verify(state, proof, pubkey)) { | if (!delegation.verify(state, proof, pubkey)) { | ||||
Misbehaving(pfrom, 100, "invalid-delegation"); | Misbehaving(pfrom, 100, "invalid-delegation"); | ||||
return; | return; | ||||
} | } | ||||
SchnorrSig sig; | SchnorrSig sig; | ||||
▲ Show 20 Lines • Show All 1,595 Lines • Show Last 20 Lines |