Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/processor.cpp
Show First 20 Lines • Show All 216 Lines • ▼ Show 20 Lines | namespace { | ||||
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(); | ||||
// Now let's sign! | // Now let's sign! | ||||
std::vector<uint8_t> vchSig; | if (!key.SignSchnorr(hash, sig)) { | ||||
if (key.SignSchnorr(hash, vchSig)) { | |||||
// Schnorr sigs are 64 bytes in size. | |||||
assert(vchSig.size() == 64); | |||||
std::copy(vchSig.begin(), vchSig.end(), sig.begin()); | |||||
} else { | |||||
sig.fill(0); | sig.fill(0); | ||||
} | } | ||||
} | } | ||||
// serialization support | // serialization support | ||||
ADD_SERIALIZE_METHODS; | ADD_SERIALIZE_METHODS; | ||||
template <typename Stream, typename Operation> | template <typename Stream, typename Operation> | ||||
▲ Show 20 Lines • Show All 294 Lines • Show Last 20 Lines |