diff --git a/src/avalanche/processor.h b/src/avalanche/processor.h --- a/src/avalanche/processor.h +++ b/src/avalanche/processor.h @@ -287,12 +287,6 @@ CPubKey getSessionPubKey() const; bool sendHello(CNode *pfrom) const; - /** - * Build and return the challenge whose signature we expect a peer to - * include in his AVAHELLO message. - */ - uint256 buildRemoteSighash(CNode *pfrom) const; - bool addProof(const std::shared_ptr &proof); std::shared_ptr getProof(const ProofId &proofid) const; std::shared_ptr getLocalProof() const; diff --git a/src/avalanche/processor.cpp b/src/avalanche/processor.cpp --- a/src/avalanche/processor.cpp +++ b/src/avalanche/processor.cpp @@ -543,16 +543,6 @@ return hasher.GetHash(); } -uint256 Processor::buildRemoteSighash(CNode *pfrom) const { - CHashWriter hasher(SER_GETHASH, 0); - hasher << pfrom->m_avalanche_state->delegation.getId(); - hasher << pfrom->nRemoteHostNonce; - hasher << pfrom->GetLocalNonce(); - hasher << pfrom->nRemoteExtraEntropy; - hasher << pfrom->GetLocalExtraEntropy(); - return hasher.GetHash(); -} - bool Processor::sendHello(CNode *pfrom) const { if (!peerData) { // We do not have a delegation to advertise. diff --git a/src/net_processing.cpp b/src/net_processing.cpp --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -4137,10 +4137,16 @@ 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; verifier >> sig; - if (!pubkey.VerifySchnorr(g_avalanche->buildRemoteSighash(&pfrom), - sig)) { + if (!pubkey.VerifySchnorr(sighasher.GetHash(), sig)) { Misbehaving(pfrom, 100, "invalid-avahello-signature"); return; }