Support "standalone" mode (-a or --standalone) in which we do not connect

to the network and do not close ledgers. This mode makes it much easier to
test transactions as they are only applied once to the open ledger.
This commit is contained in:
JoelKatz
2012-08-14 15:35:30 -07:00
parent 4b2ae556bd
commit e473ce8424
8 changed files with 39 additions and 6 deletions

View File

@@ -95,13 +95,14 @@ void Application::run()
//
// Set up UNL.
//
getUNL().nodeBootstrap();
if (!theConfig.RUN_STANDALONE)
getUNL().nodeBootstrap();
//
// Allow peer connections.
//
if (!theConfig.PEER_IP.empty() && theConfig.PEER_PORT)
if (!theConfig.RUN_STANDALONE && !theConfig.PEER_IP.empty() && theConfig.PEER_PORT)
{
mPeerDoor = new PeerDoor(mIOService);
}
@@ -127,7 +128,8 @@ void Application::run()
//
// Begin connecting to network.
//
mConnectionPool.start();
if (!theConfig.RUN_STANDALONE)
mConnectionPool.start();
// New stuff.
NewcoinAddress rootSeedMaster = NewcoinAddress::createSeedGeneric("masterpassphrase");
@@ -155,7 +157,14 @@ void Application::run()
}
mNetOps.setStateTimer();
if (theConfig.RUN_STANDALONE)
{
Log(lsWARNING) << "Running in standalone mode";
mNetOps.setStandAlone();
mMasterLedger.runStandAlone();
}
else
mNetOps.setStateTimer();
mIOService.run(); // This blocks