Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
Show First 20 Lines • Show All 3,864 Lines • ▼ Show 20 Lines | if (msg_type == NetMsgType::AVARESPONSE && !fImporting && !fReindex && | ||||
// 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; | std::array<uint8_t, 64> sig; | ||||
vRecv >> sig; | vRecv >> sig; | ||||
return n.pubkey.VerifySchnorr(verifier.GetHash(), sig); | |||||
// Unfortunately, the verify API require a vector. | |||||
std::vector<uint8_t> vchSig{sig.begin(), sig.end()}; | |||||
return n.pubkey.VerifySchnorr(verifier.GetHash(), vchSig); | |||||
})) { | })) { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
Misbehaving(pfrom, 100, "invalid-ava-response-signature"); | Misbehaving(pfrom, 100, "invalid-ava-response-signature"); | ||||
return true; | return true; | ||||
} | } | ||||
std::vector<avalanche::BlockUpdate> updates; | std::vector<avalanche::BlockUpdate> updates; | ||||
if (!g_avalanche->registerVotes(pfrom.GetId(), response, updates)) { | if (!g_avalanche->registerVotes(pfrom.GetId(), response, updates)) { | ||||
▲ Show 20 Lines • Show All 1,405 Lines • Show Last 20 Lines |