X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=blobdiff_plain;f=src%2Falert.cpp;h=65927ed74bd028ac0296242dfd7576fe518d3aee;hp=a1dc27a662e0bc08581a7e9df059412b56e8d842;hb=9e58e0a8ca28b15a4bfa677f5b23891972db40fd;hpb=40b1d4e9e164d65458c39186bd38b7c2610a5240 diff --git a/src/alert.cpp b/src/alert.cpp index a1dc27a..65927ed 100644 --- a/src/alert.cpp +++ b/src/alert.cpp @@ -53,8 +53,8 @@ std::string CUnsignedAlert::ToString() const return strprintf( "CAlert(\n" " nVersion = %d\n" - " nRelayUntil = %"PRI64d"\n" - " nExpiration = %"PRI64d"\n" + " nRelayUntil = %" PRId64 "\n" + " nExpiration = %" PRId64 "\n" " nID = %d\n" " nCancel = %d\n" " setCancel = %s\n" @@ -130,6 +130,9 @@ bool CAlert::RelayTo(CNode* pnode) const { if (!IsInEffect()) return false; + // don't relay to nodes which haven't sent their version message + if (pnode->nVersion == 0) + return false; // returns true if wasn't already contained in the set if (pnode->setKnown.insert(GetHash()).second) { @@ -146,9 +149,8 @@ bool CAlert::RelayTo(CNode* pnode) const bool CAlert::CheckSignature() const { - CKey key; - if (!key.SetPubKey(ParseHex(fTestNet ? pszTestKey : pszMainKey))) - return error("CAlert::CheckSignature() : SetPubKey failed"); + CPubKey key; + key.Set(ParseHex(fTestNet ? pszTestKey : pszMainKey)); if (!key.Verify(Hash(vchMsg.begin(), vchMsg.end()), vchSig)) return error("CAlert::CheckSignature() : verify signature failed");