#include "key.h"
#include "net.h"
#include "sync.h"
-#include "ui_interface.h"
+#include "interface.h"
using namespace std;
CCriticalSection cs_mapAlerts;
static const char* pszMainKey = "043fa441fd4203d03f5df2b75ea14e36f20d39f43e7a61aa7552ab9bcd7ecb0e77a3be4585b13fcdaa22ef6e51f1ff6f2929bec2494385b086fb86610e33193195";
-static const char* pszTestKey = "043fa441fd4203d03f5df2b75ea14e36f20d39f43e7a61aa7552ab9bcd7ecb0e77a3be4585b13fcdaa22ef6e51f1ff6f2929bec2494385b086fb86610e33193195";
+
+// TestNet alerts pubKey
+static const char* pszTestKey = "0471dc165db490094d35cde15b1f5d755fa6ad6f2b5ed0f340e3f17f57389c3c2af113a8cbcc885bde73305a553b5640c83021128008ddf882e856336269080496";
+
+// TestNet alerts private key
+// "308201130201010420b665cff1884e53da26376fd1b433812c9a5a8a4d5221533b15b9629789bb7e42a081a53081a2020101302c06072a8648ce3d0101022100fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f300604010004010704410479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8022100fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141020101a1440342000471dc165db490094d35cde15b1f5d755fa6ad6f2b5ed0f340e3f17f57389c3c2af113a8cbcc885bde73305a553b5640c83021128008ddf882e856336269080496"
void CUnsignedAlert::SetNull()
{
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"
strStatusBar.c_str());
}
-void CUnsignedAlert::print() const
-{
- printf("%s", ToString().c_str());
-}
-
void CAlert::SetNull()
{
CUnsignedAlert::SetNull();
{
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)
{
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");