Changeset View
Changeset View
Standalone View
Standalone View
src/seeder/bitcoin.cpp
Show All 13 Lines | |||||
// The network magic to use. | // The network magic to use. | ||||
CMessageHeader::MessageMagic netMagic = {{0xe3, 0xe1, 0xf3, 0xe8}}; | CMessageHeader::MessageMagic netMagic = {{0xe3, 0xe1, 0xf3, 0xe8}}; | ||||
#define BITCOIN_SEED_NONCE 0x0539a019ca550825ULL | #define BITCOIN_SEED_NONCE 0x0539a019ca550825ULL | ||||
static const uint32_t allones(-1); | static const uint32_t allones(-1); | ||||
std::ostream &operator<<(std::ostream &os, const PeerMessagingState &state) { | |||||
os << static_cast<std::underlying_type<PeerMessagingState>::type>(state); | |||||
deadalnix: IMO you should separate the C++ magic from the intent of the code, because right now, that is… | |||||
return os; | |||||
} | |||||
void CSeederNode::BeginMessage(const char *pszCommand) { | void CSeederNode::BeginMessage(const char *pszCommand) { | ||||
if (nHeaderStart != allones) { | if (nHeaderStart != allones) { | ||||
AbortMessage(); | AbortMessage(); | ||||
} | } | ||||
nHeaderStart = vSend.size(); | nHeaderStart = vSend.size(); | ||||
vSend << CMessageHeader(netMagic, pszCommand, 0); | vSend << CMessageHeader(netMagic, pszCommand, 0); | ||||
nMessageStart = vSend.size(); | nMessageStart = vSend.size(); | ||||
// fprintf(stdout, "%s: SEND %s\n", ToString(you).c_str(), pszCommand); | // fprintf(stdout, "%s: SEND %s\n", ToString(you).c_str(), pszCommand); | ||||
▲ Show 20 Lines • Show All 319 Lines • Show Last 20 Lines |
IMO you should separate the C++ magic from the intent of the code, because right now, that is not very clear.
For instance, you could use something like:
And then call that. If it turns out to be more generally useful, then it can be moved to a header somewhere.