Improve reporting for bad validators.txt.

This commit is contained in:
Arthur Britto
2012-04-30 13:59:02 -07:00
parent 0ab34eee3d
commit fc2ce4ea35
4 changed files with 15 additions and 6 deletions

View File

@@ -3,8 +3,10 @@
#include <string>
#define SYSTEM_NAME "newcoin"
#define SYSTEM_NAME "newcoin"
#define VALIDATORS_SITE "redstem.com"
#define VALIDATORS_FILE_NAME "validators.txt"
const int SYSTEM_PEER_PORT=6561;
// Allow anonymous DH.

View File

@@ -22,10 +22,8 @@
#include "AccountState.h"
#define VALIDATORS_FETCH_SECONDS 30
#define VALIDATORS_FILE_NAME "validators.txt"
#define VALIDATORS_FILE_PATH "/" VALIDATORS_FILE_NAME
#define VALIDATORS_FILE_BYTES_MAX (50 << 10)
#define VALIDATORS_SITE "redstem.com"
/*
Just read from wire until the entire request is in.
@@ -609,7 +607,7 @@ void RPCServer::validatorsResponse(const boost::system::error_code& err, std::st
{
std::cerr << "Fetch '" VALIDATORS_FILE_NAME "' complete." << std::endl;
if(!err)
if (!err)
{
theApp->getUNL().nodeDefault(strResponse);
}

View File

@@ -1020,9 +1020,14 @@ int UniqueNodeList::iSourceScore(validatorSource vsWhy)
// Queue a domain for a single attempt fetch a newcoin.txt.
// --> strComment: only used on vsManual
// YYY As a lot of these may happen at once, would be nice to wrap multiple calls in a transaction.
void UniqueNodeList::nodeAddDomain(std::string strDomain, validatorSource vsWhy, std::string strComment)
void UniqueNodeList::nodeAddDomain(const std::string& strDomain, validatorSource vsWhy, std::string strComment)
{
// YYY Would be best to verify strDomain is a valid domain.
// std::cerr << str(boost::format("nodeAddDomain: '%s' %c '%s'")
// % strDomain
// % vsWhy
// % strComment) << std::endl;
seedDomain sdCurrent;
bool bFound = getSeedDomains(strDomain, sdCurrent);
@@ -1211,6 +1216,10 @@ void UniqueNodeList::nodeDefault(std::string strValidators) {
nodeAddDomain(strValidator, vsValidator);
}
}
else
{
std::cerr << "WARNING: '" VALIDATORS_FILE_NAME "' missing [" SECTION_VALIDATORS "]." << std::endl;
}
}
// vim:ts=4

View File

@@ -116,7 +116,7 @@ public:
void start();
void nodeAddPublic(NewcoinAddress naNodePublic, std::string strComment);
void nodeAddDomain(std::string strDomain, validatorSource vsWhy, std::string strComment="");
void nodeAddDomain(const std::string& strDomain, validatorSource vsWhy, std::string strComment="");
void nodeRemove(NewcoinAddress naNodePublic);
void nodeDefault(std::string strValidators);
void nodeReset();