src/test/alert_tests.cpp
//
// alertTests contains 7 alerts, generated with this code:
// (SignAndSave code not shown, alert signing key is secret)
//
alertTests contains 7 alerts, generated with this code:
(SignAndSave code not shown, alert signing key is secret)
alertTests contains 7 alerts generated with this code : ( SignAndSave code not shown alert signing key is secret )
void GenerateTestFile(boost::filesystem::path testFile, const char* base58SecretKey)
{
    CBitcoinSecret secret;
    secret.SetString(base58SecretKey);
    CKey key = secret.GetKey();
    FILE* fp = fopen(testFile.string().c_str(), "wb");
    if (!fp) return;
    CAutoFile fileout = CAutoFile(fp, SER_DISK, CLIENT_VERSION);
    if (!fileout) return;
    CUnsignedAlert alert;
    alert.nRelayUntil   = 60;
    alert.nExpiration   = 24 * 60 * 60;
    alert.nID           = 1;
    alert.nCancel       = 0;   
    alert.nMinVer       = 0;  
    alert.nMaxVer       = 70001;
    alert.nPriority     = 1;
    alert.strComment    = "Alert comment";
    alert.strStatusBar  = "Alert 1";
    fileout << Sign(alert, key);
    alert.setSubVer.insert(std::string("/Satoshi:0.1.0/"));
    alert.strStatusBar  = "Alert 1 for Satoshi 0.1.0";
    fileout << Sign(alert, key);
    alert.setSubVer.insert(std::string("/Satoshi:0.2.0/"));
    alert.strStatusBar  = "Alert 1 for Satoshi 0.1.0, 0.2.0";
    fileout << Sign(alert, key);
    alert.setSubVer.clear();
    ++alert.nID;
    alert.nCancel = 1;
    alert.nPriority = 100;
    alert.strStatusBar  = "Alert 2, cancels 1";
    fileout << Sign(alert, key);
    alert.nExpiration += 60;
    ++alert.nID;
    fileout << Sign(alert, key);
    ++alert.nID;
    alert.nMinVer = 11;
    alert.nMaxVer = 22;
    fileout << Sign(alert, key);
    ++alert.nID;
    alert.strStatusBar  = "Alert 2 for Satoshi 0.1.0";
    alert.setSubVer.insert(std::string("/Satoshi:0.1.0/"));
    fileout << Sign(alert, key);
    ++alert.nID;
    alert.nMinVer = 0;
    alert.nMaxVer = 999999;
    alert.strStatusBar  = "Evil Alert'; /bin/ls; echo '";
    alert.setSubVer.clear();
    fileout << Sign(alert, key);
}
void GenerateTestFile ( boost :: filesystem :: path testFile , const char * base58SecretKey ) { CBitcoinSecret secret ; secret . SetString ( base58SecretKey ) ; CKey key = secret . GetKey ( ) ; FILE * fp = fopen ( testFile . string ( ) . c_str ( ) , " " ) ; if ( ! fp ) return ; CAutoFile fileout = CAutoFile ( fp , SER_DISK , CLIENT_VERSION ) ; if ( ! fileout ) return ; CUnsignedAlert alert ; alert . nRelayUntil = 60 ; alert . nExpiration = 24 * 60 * 60 ; alert . nID = 1 ; alert . nCancel = 0 ; alert . nMinVer = 0 ; alert . nMaxVer = 70001 ; alert . nPriority = 1 ; alert . strComment = " " ; alert . strStatusBar = " " ; fileout << Sign ( alert , key ) ; alert . setSubVer . insert ( std :: string ( " " ) ) ; alert . strStatusBar = " " ; fileout << Sign ( alert , key ) ; alert . setSubVer . insert ( std :: string ( " " ) ) ; alert . strStatusBar = " " ; fileout << Sign ( alert , key ) ; alert . setSubVer . clear ( ) ; ++ alert . nID ; alert . nCancel = 1 ; alert . nPriority = 100 ; alert . strStatusBar = " " ; fileout << Sign ( alert , key ) ; alert . nExpiration += 60 ; ++ alert . nID ; fileout << Sign ( alert , key ) ; ++ alert . nID ; alert . nMinVer = 11 ; alert . nMaxVer = 22 ; fileout << Sign ( alert , key ) ; ++ alert . nID ; alert . strStatusBar = " " ; alert . setSubVer . insert ( std :: string ( " " ) ) ; fileout << Sign ( alert , key ) ; ++ alert . nID ; alert . nMinVer = 0 ; alert . nMaxVer = 999999 ; alert . strStatusBar = " " ; alert . setSubVer . clear ( ) ; fileout << Sign ( alert , key ) ; }
alertTests contains 7 alerts, generated with this code:
(SignAndSave code not shown, alert signing key is secret)
alertTests contains 7 alerts generated with this code : ( SignAndSave code not shown alert signing key is secret )
// cancels previous messages up to this ID number // These versions are protocol versions