Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
Show First 20 Lines • Show All 3,958 Lines • ▼ Show 20 Lines | if (msg_type == NetMsgType::AVAHELLO && g_avalanche && | ||||
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; | ||||
} | } | ||||
std::array<uint8_t, 64> sig; | SchnorrSig sig; | ||||
verifier >> sig; | verifier >> sig; | ||||
} | } | ||||
// Ignore avalanche requests while importing | // Ignore avalanche requests while importing | ||||
if (msg_type == NetMsgType::AVAPOLL && !fImporting && !fReindex && | if (msg_type == NetMsgType::AVAPOLL && !fImporting && !fReindex && | ||||
g_avalanche && | g_avalanche && | ||||
gArgs.GetBoolArg("-enableavalanche", AVALANCHE_DEFAULT_ENABLED)) { | gArgs.GetBoolArg("-enableavalanche", AVALANCHE_DEFAULT_ENABLED)) { | ||||
auto now = std::chrono::steady_clock::now(); | auto now = std::chrono::steady_clock::now(); | ||||
▲ Show 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | if (msg_type == NetMsgType::AVARESPONSE && !fImporting && !fReindex && | ||||
// As long as QUIC is not implemented, we need to sign response and | // As long as QUIC is not implemented, we need to sign response and | ||||
// verify response's signatures in order to avoid any manipulation of | // verify response's signatures in order to avoid any manipulation of | ||||
// messages at the transport level. | // messages at the transport level. | ||||
CHashVerifier<CDataStream> verifier(&vRecv); | CHashVerifier<CDataStream> verifier(&vRecv); | ||||
avalanche::Response response; | avalanche::Response response; | ||||
verifier >> response; | verifier >> response; | ||||
if (!g_avalanche->forNode(pfrom.GetId(), [&](const avalanche::Node &n) { | if (!g_avalanche->forNode(pfrom.GetId(), [&](const avalanche::Node &n) { | ||||
std::array<uint8_t, 64> sig; | SchnorrSig sig; | ||||
vRecv >> sig; | vRecv >> sig; | ||||
return n.pubkey.VerifySchnorr(verifier.GetHash(), sig); | return n.pubkey.VerifySchnorr(verifier.GetHash(), sig); | ||||
})) { | })) { | ||||
Misbehaving(pfrom, 100, "invalid-ava-response-signature"); | Misbehaving(pfrom, 100, "invalid-ava-response-signature"); | ||||
return; | return; | ||||
} | } | ||||
std::vector<avalanche::BlockUpdate> updates; | std::vector<avalanche::BlockUpdate> updates; | ||||
▲ Show 20 Lines • Show All 1,455 Lines • Show Last 20 Lines |