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:
@@ -57,6 +57,7 @@ extern int RpcDBCount, TxnDBCount, LedgerDBCount, WalletDBCount, HashNodeDBCount
|
|||||||
|
|
||||||
void Application::stop()
|
void Application::stop()
|
||||||
{
|
{
|
||||||
|
cLog(lsINFO) << "Received shutdown request";
|
||||||
mIOService.stop();
|
mIOService.stop();
|
||||||
mJobQueue.shutdown();
|
mJobQueue.shutdown();
|
||||||
mHashedObjectStore.bulkWrite();
|
mHashedObjectStore.bulkWrite();
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "InstanceCounter.h"
|
#include "InstanceCounter.h"
|
||||||
|
|
||||||
InstanceType* InstanceType::sHeadInstance = NULL;
|
InstanceType* InstanceType::sHeadInstance = NULL;
|
||||||
|
bool InstanceType::sMultiThreaded = false;
|
||||||
|
|
||||||
std::vector<InstanceType::InstanceCount> InstanceType::getInstanceCounts(int min)
|
std::vector<InstanceType::InstanceCount> InstanceType::getInstanceCounts(int min)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ protected:
|
|||||||
|
|
||||||
InstanceType* mNextInstance;
|
InstanceType* mNextInstance;
|
||||||
static InstanceType* sHeadInstance;
|
static InstanceType* sHeadInstance;
|
||||||
|
static bool sMultiThreaded;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef std::pair<std::string, int> InstanceCount;
|
typedef std::pair<std::string, int> InstanceCount;
|
||||||
@@ -42,18 +43,33 @@ public:
|
|||||||
sHeadInstance = this;
|
sHeadInstance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void multiThread()
|
||||||
|
{
|
||||||
|
// We can support global objects and multi-threaded code, but not both
|
||||||
|
// at the same time. Switch to multi-threaded.
|
||||||
|
sMultiThreaded = true;
|
||||||
|
}
|
||||||
|
|
||||||
void addInstance()
|
void addInstance()
|
||||||
|
{
|
||||||
|
if (sMultiThreaded)
|
||||||
{
|
{
|
||||||
mLock.lock();
|
mLock.lock();
|
||||||
++mInstances;
|
++mInstances;
|
||||||
mLock.unlock();
|
mLock.unlock();
|
||||||
}
|
}
|
||||||
|
else ++mInstances;
|
||||||
|
}
|
||||||
void decInstance()
|
void decInstance()
|
||||||
|
{
|
||||||
|
if (sMultiThreaded)
|
||||||
{
|
{
|
||||||
mLock.lock();
|
mLock.lock();
|
||||||
--mInstances;
|
--mInstances;
|
||||||
mLock.unlock();
|
mLock.unlock();
|
||||||
}
|
}
|
||||||
|
else --mInstances;
|
||||||
|
}
|
||||||
int getCount()
|
int getCount()
|
||||||
{
|
{
|
||||||
boost::mutex::scoped_lock(mLock);
|
boost::mutex::scoped_lock(mLock);
|
||||||
|
|||||||
@@ -181,6 +181,7 @@ void JobQueue::shutdown()
|
|||||||
mJobCond.notify_all();
|
mJobCond.notify_all();
|
||||||
while (mThreadCount != 0)
|
while (mThreadCount != 0)
|
||||||
mJobCond.wait(sl);
|
mJobCond.wait(sl);
|
||||||
|
cLog(lsDEBUG) << "Job queue has shut down";
|
||||||
}
|
}
|
||||||
|
|
||||||
void JobQueue::setThreadCount(int c)
|
void JobQueue::setThreadCount(int c)
|
||||||
|
|||||||
@@ -103,6 +103,13 @@ static bool LEFInit()
|
|||||||
<< SOElement(sfFeatures, SOE_REQUIRED)
|
<< SOElement(sfFeatures, SOE_REQUIRED)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
DECLARE_LEF(FeeSettings, ltFEE_SETTINGS)
|
||||||
|
<< SOElement(sfBaseFee, SOE_REQUIRED)
|
||||||
|
<< SOElement(sfReferenceFeeUnits, SOE_REQUIRED)
|
||||||
|
<< SOElement(sfReserveBase, SOE_REQUIRED)
|
||||||
|
<< SOElement(sfReserveIncrement, SOE_REQUIRED)
|
||||||
|
;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ enum LedgerEntryType
|
|||||||
ltCONTRACT = 'c',
|
ltCONTRACT = 'c',
|
||||||
ltLEDGER_HASHES = 'h',
|
ltLEDGER_HASHES = 'h',
|
||||||
ltFEATURES = 'f',
|
ltFEATURES = 'f',
|
||||||
|
ltFEE_SETTINGS = 's',
|
||||||
};
|
};
|
||||||
|
|
||||||
// Used as a prefix for computing ledger indexes (keys).
|
// Used as a prefix for computing ledger indexes (keys).
|
||||||
@@ -32,6 +33,7 @@ enum LedgerNameSpace
|
|||||||
spaceContract = 'c',
|
spaceContract = 'c',
|
||||||
spaceSkipList = 's',
|
spaceSkipList = 's',
|
||||||
spaceFeature = 'f',
|
spaceFeature = 'f',
|
||||||
|
spaceFee = 's',
|
||||||
};
|
};
|
||||||
|
|
||||||
enum LedgerSpecificFlags
|
enum LedgerSpecificFlags
|
||||||
|
|||||||
@@ -60,6 +60,9 @@
|
|||||||
FIELD(LastLedgerSequence, UINT32, 27)
|
FIELD(LastLedgerSequence, UINT32, 27)
|
||||||
FIELD(TransactionIndex, UINT32, 28)
|
FIELD(TransactionIndex, UINT32, 28)
|
||||||
FIELD(OperationLimit, UINT32, 29)
|
FIELD(OperationLimit, UINT32, 29)
|
||||||
|
FIELD(ReferenceFeeUnits, UINT32, 30)
|
||||||
|
FIELD(ReserveBase, UINT32, 31)
|
||||||
|
FIELD(ReserveIncrement, UINT32, 32)
|
||||||
|
|
||||||
// 64-bit integers
|
// 64-bit integers
|
||||||
FIELD(IndexNext, UINT64, 1)
|
FIELD(IndexNext, UINT64, 1)
|
||||||
@@ -69,6 +72,7 @@
|
|||||||
FIELD(BaseFee, UINT64, 5)
|
FIELD(BaseFee, UINT64, 5)
|
||||||
FIELD(ExchangeRate, UINT64, 6)
|
FIELD(ExchangeRate, UINT64, 6)
|
||||||
|
|
||||||
|
|
||||||
// 128-bit
|
// 128-bit
|
||||||
FIELD(EmailHash, HASH128, 1)
|
FIELD(EmailHash, HASH128, 1)
|
||||||
|
|
||||||
|
|||||||
@@ -76,6 +76,14 @@ static bool TFInit()
|
|||||||
<< SOElement(sfFeature, SOE_REQUIRED)
|
<< SOElement(sfFeature, SOE_REQUIRED)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
DECLARE_TF(SetFee, ttFEE)
|
||||||
|
<< SOElement(sfFeatures, SOE_REQUIRED)
|
||||||
|
<< SOElement(sfBaseFee, SOE_REQUIRED)
|
||||||
|
<< SOElement(sfReferenceFeeUnits, SOE_REQUIRED)
|
||||||
|
<< SOElement(sfReserveBase, SOE_REQUIRED)
|
||||||
|
<< SOElement(sfReserveIncrement, SOE_REQUIRED)
|
||||||
|
;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
enum TransactionType
|
enum TransactionType
|
||||||
{
|
{
|
||||||
ttINVALID = -1,
|
ttINVALID = -1,
|
||||||
|
|
||||||
ttPAYMENT = 0,
|
ttPAYMENT = 0,
|
||||||
ttCLAIM = 1, // open
|
ttCLAIM = 1, // open
|
||||||
ttWALLET_ADD = 2,
|
ttWALLET_ADD = 2,
|
||||||
@@ -21,6 +22,7 @@ enum TransactionType
|
|||||||
ttTRUST_SET = 20,
|
ttTRUST_SET = 20,
|
||||||
|
|
||||||
ttFEATURE = 100,
|
ttFEATURE = 100,
|
||||||
|
ttFEE = 101,
|
||||||
};
|
};
|
||||||
|
|
||||||
class TransactionFormat
|
class TransactionFormat
|
||||||
|
|||||||
@@ -260,6 +260,7 @@ void ValidationCollection::flush()
|
|||||||
{
|
{
|
||||||
bool anyNew = false;
|
bool anyNew = false;
|
||||||
|
|
||||||
|
cLog(lsINFO) << "Flushing validations";
|
||||||
boost::mutex::scoped_lock sl(mValidationLock);
|
boost::mutex::scoped_lock sl(mValidationLock);
|
||||||
BOOST_FOREACH(u160_val_pair& it, mCurrentValidations)
|
BOOST_FOREACH(u160_val_pair& it, mCurrentValidations)
|
||||||
{
|
{
|
||||||
@@ -276,6 +277,7 @@ void ValidationCollection::flush()
|
|||||||
boost::this_thread::sleep(boost::posix_time::milliseconds(100));
|
boost::this_thread::sleep(boost::posix_time::milliseconds(100));
|
||||||
sl.lock();
|
sl.lock();
|
||||||
}
|
}
|
||||||
|
cLog(lsDEBUG) << "Validations flushed";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ValidationCollection::condWrite()
|
void ValidationCollection::condWrite()
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ int main(int argc, char* argv[])
|
|||||||
//
|
//
|
||||||
// Set up option parsing.
|
// Set up option parsing.
|
||||||
//
|
//
|
||||||
po::options_description desc("Options");
|
po::options_description desc("General Options");
|
||||||
desc.add_options()
|
desc.add_options()
|
||||||
("help,h", "Display this message.")
|
("help,h", "Display this message.")
|
||||||
("conf", po::value<std::string>(), "Specify the configuration file.")
|
("conf", po::value<std::string>(), "Specify the configuration file.")
|
||||||
@@ -99,12 +99,21 @@ int main(int argc, char* argv[])
|
|||||||
("test,t", "Perform unit tests.")
|
("test,t", "Perform unit tests.")
|
||||||
("parameters", po::value< vector<string> >(), "Specify comma separated parameters.")
|
("parameters", po::value< vector<string> >(), "Specify comma separated parameters.")
|
||||||
("quiet,q", "Reduce diagnotics.")
|
("quiet,q", "Reduce diagnotics.")
|
||||||
("verbose,v", "Increase log level.")
|
("verbose,v", "Verbose logging.")
|
||||||
("load", "Load the current ledger from the local DB.")
|
("load", "Load the current ledger from the local DB.")
|
||||||
("start", "Start from a fresh Ledger.")
|
("start", "Start from a fresh Ledger.")
|
||||||
("net", "Get the initial ledger from the network.")
|
("net", "Get the initial ledger from the network.")
|
||||||
;
|
;
|
||||||
|
|
||||||
|
po::options_description hidden("Hidden Options");
|
||||||
|
hidden.add_options()
|
||||||
|
("trace,vvv", "Trace level logging")
|
||||||
|
("debug,vv", "Debug level logging")
|
||||||
|
;
|
||||||
|
|
||||||
|
po::options_description all("All Options");
|
||||||
|
all.add(desc).add(hidden);
|
||||||
|
|
||||||
// Interpret positional arguments as --parameters.
|
// Interpret positional arguments as --parameters.
|
||||||
po::positional_options_description p;
|
po::positional_options_description p;
|
||||||
p.add("parameters", -1);
|
p.add("parameters", -1);
|
||||||
@@ -129,7 +138,7 @@ int main(int argc, char* argv[])
|
|||||||
// Parse options, if no error.
|
// Parse options, if no error.
|
||||||
try {
|
try {
|
||||||
po::store(po::command_line_parser(argc, argv)
|
po::store(po::command_line_parser(argc, argv)
|
||||||
.options(desc) // Parse options.
|
.options(all) // Parse options.
|
||||||
.positional(p) // Remainder as --parameters.
|
.positional(p) // Remainder as --parameters.
|
||||||
.run(),
|
.run(),
|
||||||
vm);
|
vm);
|
||||||
@@ -141,11 +150,17 @@ int main(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vm.count("verbose"))
|
if (vm.count("trace"))
|
||||||
Log::setMinSeverity(lsTRACE, true);
|
Log::setMinSeverity(lsTRACE, true);
|
||||||
|
else if (vm.count("debug"))
|
||||||
|
Log::setMinSeverity(lsDEBUG, true);
|
||||||
|
else if (vm.count("verbose"))
|
||||||
|
Log::setMinSeverity(lsINFO, true);
|
||||||
else
|
else
|
||||||
Log::setMinSeverity(lsWARNING, true);
|
Log::setMinSeverity(lsWARNING, true);
|
||||||
|
|
||||||
|
InstanceType::multiThread();
|
||||||
|
|
||||||
if (vm.count("test"))
|
if (vm.count("test"))
|
||||||
{
|
{
|
||||||
unit_test_main(init_unit_test, argc, argv);
|
unit_test_main(init_unit_test, argc, argv);
|
||||||
|
|||||||
Reference in New Issue
Block a user