Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/processor.cpp
Show First 20 Lines • Show All 241 Lines • ▼ Show 20 Lines | |||||
namespace { | namespace { | ||||
/** | /** | ||||
* When using TCP, we need to sign all messages as the transport layer is | * When using TCP, we need to sign all messages as the transport layer is | ||||
* not secure. | * not secure. | ||||
*/ | */ | ||||
class TCPResponse { | class TCPResponse { | ||||
Response response; | Response response; | ||||
std::array<uint8_t, 64> sig; | SchnorrSig sig; | ||||
public: | public: | ||||
TCPResponse(Response responseIn, const CKey &key) | TCPResponse(Response responseIn, const CKey &key) | ||||
: response(std::move(responseIn)) { | : response(std::move(responseIn)) { | ||||
CHashWriter hasher(SER_GETHASH, 0); | CHashWriter hasher(SER_GETHASH, 0); | ||||
hasher << response; | hasher << response; | ||||
const uint256 hash = hasher.GetHash(); | const uint256 hash = hasher.GetHash(); | ||||
▲ Show 20 Lines • Show All 140 Lines • ▼ Show 20 Lines | |||||
bool Processor::sendHello(CNode *pfrom) const { | bool Processor::sendHello(CNode *pfrom) const { | ||||
if (!peerData) { | if (!peerData) { | ||||
// We do not have a delegation to advertise. | // We do not have a delegation to advertise. | ||||
return false; | return false; | ||||
} | } | ||||
// Now let's sign! | // Now let's sign! | ||||
std::array<uint8_t, 64> sig; | SchnorrSig sig; | ||||
{ | { | ||||
CHashWriter hasher(SER_GETHASH, 0); | CHashWriter hasher(SER_GETHASH, 0); | ||||
hasher << peerData->delegation.getId(); | hasher << peerData->delegation.getId(); | ||||
hasher << pfrom->GetLocalNonce(); | hasher << pfrom->GetLocalNonce(); | ||||
hasher << pfrom->nRemoteHostNonce; | hasher << pfrom->nRemoteHostNonce; | ||||
hasher << pfrom->GetLocalExtraEntropy(); | hasher << pfrom->GetLocalExtraEntropy(); | ||||
hasher << pfrom->nRemoteExtraEntropy; | hasher << pfrom->nRemoteExtraEntropy; | ||||
▲ Show 20 Lines • Show All 175 Lines • Show Last 20 Lines |