mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Merge branch 'master' of github.com:jedmccaleb/NewCoin
This commit is contained in:
@@ -31,6 +31,11 @@
|
||||
# Note: $XDG_CONFIG_HOME defaults to $HOME/.config
|
||||
# $XDG_DATA_HOME defaults to $HOME/.local/share
|
||||
#
|
||||
# [debug_logfile]
|
||||
# Specifies were a debug logfile is kept. By default, no debug log is kept
|
||||
#
|
||||
# Example: debug.log
|
||||
#
|
||||
# [validators_site]:
|
||||
# Specifies where to find validators.txt for UNL boostrapping and RPC command unl_network.
|
||||
# During alpha testing, this defaults to: redstem.com
|
||||
@@ -117,6 +122,9 @@
|
||||
[rpc_allow_remote]
|
||||
1
|
||||
|
||||
[debug_logfile]
|
||||
debug.log
|
||||
|
||||
[validation_seed]
|
||||
snTBDmrhUK3znvF8AaQURLm4UCkbS
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "utils.h"
|
||||
#include "TaggedCache.h"
|
||||
#include "boost/filesystem.hpp"
|
||||
#include "Log.h"
|
||||
|
||||
Application* theApp = NULL;
|
||||
|
||||
@@ -53,7 +54,9 @@ void Application::stop()
|
||||
|
||||
void Application::run()
|
||||
{
|
||||
assert(mTxnDB==NULL);
|
||||
assert(mTxnDB == NULL);
|
||||
if (!theConfig.DEBUG_LOGFILE.empty())
|
||||
Log::setLogFile(theConfig.DEBUG_LOGFILE);
|
||||
|
||||
//
|
||||
// Construct databases.
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <iostream>
|
||||
|
||||
#define SECTION_ACCOUNT_PROBE_MAX "account_probe_max"
|
||||
#define SECTION_DEBUG_LOGFILE "debug_logfile"
|
||||
#define SECTION_FEE_ACCOUNT_CREATE "fee_account_create"
|
||||
#define SECTION_FEE_DEFAULT "fee_default"
|
||||
#define SECTION_FEE_NICKNAME_CREATE "fee_nickname_create"
|
||||
@@ -233,6 +234,9 @@ void Config::load()
|
||||
|
||||
if (sectionSingleB(secConfig, SECTION_UNL_DEFAULT, strTemp))
|
||||
UNL_DEFAULT = strTemp;
|
||||
|
||||
if (sectionSingleB(secConfig, SECTION_DEBUG_LOGFILE, strTemp))
|
||||
DEBUG_LOGFILE = strTemp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ public:
|
||||
boost::filesystem::path CONFIG_FILE;
|
||||
boost::filesystem::path CONFIG_DIR;
|
||||
boost::filesystem::path DATA_DIR;
|
||||
boost::filesystem::path DEBUG_LOGFILE;
|
||||
boost::filesystem::path UNL_DEFAULT;
|
||||
|
||||
std::string VALIDATORS_SITE; // Where to find validators.txt on the Internet.
|
||||
|
||||
@@ -108,7 +108,7 @@ Ledger::Ledger(const std::string& rawLedger) : mCloseTime(0),
|
||||
|
||||
void Ledger::updateHash()
|
||||
{
|
||||
if(!mImmutable)
|
||||
if (!mImmutable)
|
||||
{
|
||||
if (mTransactionMap) mTransHash = mTransactionMap->getHash();
|
||||
else mTransHash.zero();
|
||||
@@ -235,7 +235,6 @@ uint256 Ledger::getHash()
|
||||
|
||||
void Ledger::saveAcceptedLedger(Ledger::pointer ledger)
|
||||
{
|
||||
|
||||
std::string sql="INSERT INTO Ledgers "
|
||||
"(LedgerHash,LedgerSeq,PrevHash,TotalCoins,ClosingTime,AccountSetHash,TransSetHash) VALUES ('";
|
||||
sql.append(ledger->getHash().GetHex());
|
||||
@@ -328,10 +327,9 @@ Ledger::pointer Ledger::getSQL(const std::string& sql)
|
||||
uint32 ledgerSeq;
|
||||
std::string hash;
|
||||
|
||||
if(1)
|
||||
{
|
||||
ScopedLock sl(theApp->getLedgerDB()->getDBLock());
|
||||
Database *db = theApp->getLedgerDB()->getDB();
|
||||
ScopedLock sl(theApp->getLedgerDB()->getDBLock());
|
||||
|
||||
if (!db->executeSQL(sql) || !db->startIterRows())
|
||||
return Ledger::pointer();
|
||||
@@ -350,7 +348,8 @@ Ledger::pointer Ledger::getSQL(const std::string& sql)
|
||||
db->endIterRows();
|
||||
}
|
||||
|
||||
Ledger::pointer ret=boost::make_shared<Ledger>(prevHash, transHash, accountHash, totCoins, closingTime, ledgerSeq);
|
||||
Ledger::pointer ret =
|
||||
boost::make_shared<Ledger>(prevHash, transHash, accountHash, totCoins, closingTime, ledgerSeq);
|
||||
if (ret->getHash() != ledgerHash)
|
||||
{
|
||||
assert(false);
|
||||
|
||||
@@ -96,7 +96,7 @@ public:
|
||||
void updateHash();
|
||||
void setClosed() { mClosed = true; }
|
||||
void setAccepted() { mAccepted = true; }
|
||||
void setImmutable() { mImmutable = true; }
|
||||
void setImmutable() { updateHash(); mImmutable = true; }
|
||||
bool isClosed() { return mClosed; }
|
||||
bool isAccepted() { return mAccepted; }
|
||||
|
||||
|
||||
31
src/Log.cpp
31
src/Log.cpp
@@ -1,15 +1,15 @@
|
||||
|
||||
#include "Log.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
|
||||
boost::recursive_mutex Log::sLock;
|
||||
|
||||
#ifdef DEBUG
|
||||
LogSeverity Log::sMinSeverity = lsTRACE;
|
||||
#else
|
||||
LogSeverity Log::sMinSeverity = lsINFO;
|
||||
#endif
|
||||
LogSeverity Log::sMinSeverity = lsWARNING;
|
||||
|
||||
std::ofstream* Log::outStream = NULL;
|
||||
|
||||
Log::~Log()
|
||||
{
|
||||
@@ -26,9 +26,9 @@ Log::~Log()
|
||||
logMsg += oss.str();
|
||||
boost::recursive_mutex::scoped_lock sl(sLock);
|
||||
if (mSeverity >= sMinSeverity)
|
||||
{
|
||||
std::cerr << logMsg << std::endl;
|
||||
}
|
||||
if (outStream != NULL)
|
||||
(*outStream) << logMsg << std::endl;
|
||||
}
|
||||
|
||||
void Log::setMinSeverity(LogSeverity s)
|
||||
@@ -36,3 +36,20 @@ void Log::setMinSeverity(LogSeverity s)
|
||||
boost::recursive_mutex::scoped_lock sl(sLock);
|
||||
sMinSeverity = s;
|
||||
}
|
||||
|
||||
void Log::setLogFile(boost::filesystem::path path)
|
||||
{
|
||||
std::ofstream* newStream = new std::ofstream(path.c_str(), std::fstream::app);
|
||||
if (!newStream->good())
|
||||
{
|
||||
delete newStream;
|
||||
newStream = NULL;
|
||||
}
|
||||
|
||||
boost::recursive_mutex::scoped_lock sl(sLock);
|
||||
if (outStream != NULL)
|
||||
delete outStream;
|
||||
outStream = newStream;
|
||||
if (outStream)
|
||||
Log(lsINFO) << "Starting up";
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <sstream>
|
||||
|
||||
#include <boost/thread/recursive_mutex.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
enum LogSeverity
|
||||
{
|
||||
@@ -24,6 +25,7 @@ private:
|
||||
protected:
|
||||
static boost::recursive_mutex sLock;
|
||||
static LogSeverity sMinSeverity;
|
||||
static std::ofstream* outStream;
|
||||
|
||||
mutable std::ostringstream oss;
|
||||
LogSeverity mSeverity;
|
||||
@@ -45,6 +47,7 @@ public:
|
||||
}
|
||||
|
||||
static void setMinSeverity(LogSeverity);
|
||||
static void setLogFile(boost::filesystem::path);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -474,8 +474,8 @@ bool NetworkOPs::recvPropose(uint32 proposeSeq, const uint256& proposeHash,
|
||||
|
||||
if (mMode != omFULL) // FIXME: Should we relay?
|
||||
{
|
||||
Log(lsWARNING) << "Received proposal when not full: " << mMode;
|
||||
return true;
|
||||
Log(lsINFO) << "Received proposal when not full: " << mMode;
|
||||
return false; // FIXME: Need suppression table
|
||||
}
|
||||
if (!mConsensus)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user