mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
More log updates.
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
#include "Application.h"
|
||||
#include "Log.h"
|
||||
|
||||
SETUP_LOG();
|
||||
|
||||
HashedObjectStore::HashedObjectStore(int cacheSize, int cacheAge) :
|
||||
mCache(cacheSize, cacheAge), mWritePending(false)
|
||||
{
|
||||
@@ -22,9 +24,7 @@ bool HashedObjectStore::store(HashedObjectType type, uint32 index,
|
||||
if (!theApp->getHashNodeDB()) return true;
|
||||
if (mCache.touch(hash))
|
||||
{
|
||||
#ifdef HS_DEBUG
|
||||
Log(lsTRACE) << "HOS: " << hash << " store: incache";
|
||||
#endif
|
||||
cLog(lsTRACE) << "HOS: " << hash << " store: incache";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ void HashedObjectStore::bulkWrite()
|
||||
mWriteSet.swap(set);
|
||||
mWritePending = false;
|
||||
}
|
||||
Log(lsINFO) << "HOS: BulkWrite " << set.size();
|
||||
cLog(lsINFO) << "HOS: BulkWrite " << set.size();
|
||||
|
||||
static boost::format fExists("SELECT ObjType FROM CommittedObjects WHERE Hash = '%s';");
|
||||
static boost::format
|
||||
@@ -94,7 +94,7 @@ HashedObject::pointer HashedObjectStore::retrieve(const uint256& hash)
|
||||
obj = mCache.fetch(hash);
|
||||
if (obj)
|
||||
{
|
||||
Log(lsTRACE) << "HOS: " << hash << " fetch: incache";
|
||||
cLog(lsTRACE) << "HOS: " << hash << " fetch: incache";
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
@@ -111,7 +111,7 @@ HashedObject::pointer HashedObjectStore::retrieve(const uint256& hash)
|
||||
|
||||
if (!db->executeSQL(sql) || !db->startIterRows())
|
||||
{
|
||||
Log(lsTRACE) << "HOS: " << hash << " fetch: not in db";
|
||||
cLog(lsTRACE) << "HOS: " << hash << " fetch: not in db";
|
||||
return HashedObject::pointer();
|
||||
}
|
||||
|
||||
@@ -136,14 +136,14 @@ HashedObject::pointer HashedObjectStore::retrieve(const uint256& hash)
|
||||
case 'A': htype = hotACCOUNT_NODE; break;
|
||||
case 'N': htype = hotTRANSACTION_NODE; break;
|
||||
default:
|
||||
Log(lsERROR) << "Invalid hashed object";
|
||||
cLog(lsERROR) << "Invalid hashed object";
|
||||
return HashedObject::pointer();
|
||||
}
|
||||
|
||||
obj = boost::make_shared<HashedObject>(htype, index, data, hash);
|
||||
mCache.canonicalize(hash, obj);
|
||||
}
|
||||
Log(lsTRACE) << "HOS: " << hash << " fetch: in db";
|
||||
cLog(lsTRACE) << "HOS: " << hash << " fetch: in db";
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
#include "Log.h"
|
||||
|
||||
SETUP_LOG();
|
||||
|
||||
void SHAMap::getMissingNodes(std::vector<SHAMapNode>& nodeIDs, std::vector<uint256>& hashes, int max,
|
||||
SHAMapSyncFilter* filter)
|
||||
{
|
||||
@@ -26,7 +28,7 @@ void SHAMap::getMissingNodes(std::vector<SHAMapNode>& nodeIDs, std::vector<uint2
|
||||
|
||||
if (!root->isInner())
|
||||
{
|
||||
Log(lsWARNING) << "synching empty tree";
|
||||
cLog(lsWARNING) << "synching empty tree";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -61,12 +63,12 @@ void SHAMap::getMissingNodes(std::vector<SHAMapNode>& nodeIDs, std::vector<uint2
|
||||
d = boost::make_shared<SHAMapTreeNode>(childID, nodeData, mSeq, snfPREFIX);
|
||||
if (childHash != d->getNodeHash())
|
||||
{
|
||||
Log(lsERROR) << "Wrong hash from cached object";
|
||||
cLog(lsERROR) << "Wrong hash from cached object";
|
||||
d = SHAMapTreeNode::pointer();
|
||||
}
|
||||
else
|
||||
{
|
||||
Log(lsTRACE) << "Got sync node from cache: " << *d;
|
||||
cLog(lsTRACE) << "Got sync node from cache: " << *d;
|
||||
mTNByID[*d] = d;
|
||||
}
|
||||
}
|
||||
@@ -136,7 +138,7 @@ bool SHAMap::addRootNode(const std::vector<unsigned char>& rootNode, SHANodeForm
|
||||
// we already have a root node
|
||||
if (root->getNodeHash().isNonZero())
|
||||
{
|
||||
Log(lsTRACE) << "got root node, already have one";
|
||||
cLog(lsTRACE) << "got root node, already have one";
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -168,7 +170,7 @@ bool SHAMap::addRootNode(const uint256& hash, const std::vector<unsigned char>&
|
||||
// we already have a root node
|
||||
if (root->getNodeHash().isNonZero())
|
||||
{
|
||||
Log(lsTRACE) << "got root node, already have one";
|
||||
cLog(lsTRACE) << "got root node, already have one";
|
||||
assert(root->getNodeHash() == hash);
|
||||
return true;
|
||||
}
|
||||
@@ -216,15 +218,15 @@ bool SHAMap::addKnownNode(const SHAMapNode& node, const std::vector<unsigned cha
|
||||
|
||||
if (iNode->isLeaf() || (iNode->getDepth() == node.getDepth()))
|
||||
{
|
||||
Log(lsTRACE) << "got inner node, already had it (late)";
|
||||
cLog(lsTRACE) << "got inner node, already had it (late)";
|
||||
return true;
|
||||
}
|
||||
|
||||
if (iNode->getDepth() != (node.getDepth() - 1))
|
||||
{ // Either this node is broken or we didn't request it (yet)
|
||||
Log(lsINFO) << "unable to hook node " << node;
|
||||
Log(lsINFO) << " stuck at " << *iNode;
|
||||
Log(lsINFO) << "got depth=" << node.getDepth() << ", walked to= " << iNode->getDepth();
|
||||
cLog(lsINFO) << "unable to hook node " << node;
|
||||
cLog(lsINFO) << " stuck at " << *iNode;
|
||||
cLog(lsINFO) << "got depth=" << node.getDepth() << ", walked to= " << iNode->getDepth();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -295,16 +297,16 @@ bool SHAMap::deepCompare(SHAMap& other)
|
||||
|
||||
if (!otherNode)
|
||||
{
|
||||
Log(lsINFO) << "unable to fetch node";
|
||||
cLog(lsINFO) << "unable to fetch node";
|
||||
return false;
|
||||
}
|
||||
else if (otherNode->getNodeHash() != node->getNodeHash())
|
||||
{
|
||||
Log(lsWARNING) << "node hash mismatch";
|
||||
cLog(lsWARNING) << "node hash mismatch";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Log(lsTRACE) << "Comparing inner nodes " << *node;
|
||||
// cLog(lsTRACE) << "Comparing inner nodes " << *node;
|
||||
|
||||
if (node->getNodeHash() != otherNode->getNodeHash())
|
||||
return false;
|
||||
@@ -329,7 +331,7 @@ bool SHAMap::deepCompare(SHAMap& other)
|
||||
SHAMapTreeNode::pointer next = getNode(node->getChildNodeID(i), node->getChildHash(i), false);
|
||||
if (!next)
|
||||
{
|
||||
Log(lsWARNING) << "unable to fetch inner node";
|
||||
cLog(lsWARNING) << "unable to fetch inner node";
|
||||
return false;
|
||||
}
|
||||
stack.push(next);
|
||||
@@ -365,7 +367,7 @@ static bool confuseMap(SHAMap &map, int count)
|
||||
items.push_back(item->getTag());
|
||||
if (!map.addItem(*item, false, false))
|
||||
{
|
||||
Log(lsFATAL) << "Unable to add item to map";
|
||||
cLog(lsFATAL) << "Unable to add item to map";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -374,14 +376,14 @@ static bool confuseMap(SHAMap &map, int count)
|
||||
{
|
||||
if (!map.delItem(*it))
|
||||
{
|
||||
Log(lsFATAL) << "Unable to remove item from map";
|
||||
cLog(lsFATAL) << "Unable to remove item from map";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (beforeHash != map.getHash())
|
||||
{
|
||||
Log(lsFATAL) << "Hashes do not match";
|
||||
cLog(lsFATAL) << "Hashes do not match";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -412,26 +414,26 @@ BOOST_AUTO_TEST_SUITE( SHAMapSync )
|
||||
|
||||
BOOST_AUTO_TEST_CASE( SHAMapSync_test )
|
||||
{
|
||||
Log(lsTRACE) << "being sync test";
|
||||
cLog(lsTRACE) << "being sync test";
|
||||
unsigned int seed;
|
||||
RAND_pseudo_bytes(reinterpret_cast<unsigned char *>(&seed), sizeof(seed));
|
||||
srand(seed);
|
||||
|
||||
Log(lsTRACE) << "Constructing maps";
|
||||
cLog(lsTRACE) << "Constructing maps";
|
||||
SHAMap source, destination;
|
||||
|
||||
// add random data to the source map
|
||||
Log(lsTRACE) << "Adding random data";
|
||||
cLog(lsTRACE) << "Adding random data";
|
||||
int items = 10000;
|
||||
for (int i = 0; i < items; ++i)
|
||||
source.addItem(*makeRandomAS(), false, false);
|
||||
|
||||
Log(lsTRACE) << "Adding items, then removing them";
|
||||
cLog(lsTRACE) << "Adding items, then removing them";
|
||||
if (!confuseMap(source, 500)) BOOST_FAIL("ConfuseMap");
|
||||
|
||||
source.setImmutable();
|
||||
|
||||
Log(lsTRACE) << "SOURCE COMPLETE, SYNCHING";
|
||||
cLog(lsTRACE) << "SOURCE COMPLETE, SYNCHING";
|
||||
|
||||
std::vector<SHAMapNode> nodeIDs, gotNodeIDs;
|
||||
std::list< std::vector<unsigned char> > gotNodes;
|
||||
@@ -447,23 +449,23 @@ BOOST_AUTO_TEST_CASE( SHAMapSync_test )
|
||||
|
||||
if (!source.getNodeFat(SHAMapNode(), nodeIDs, gotNodes, (rand() % 2) == 0, (rand() % 2) == 0))
|
||||
{
|
||||
Log(lsFATAL) << "GetNodeFat(root) fails";
|
||||
cLog(lsFATAL) << "GetNodeFat(root) fails";
|
||||
BOOST_FAIL("GetNodeFat");
|
||||
}
|
||||
if (gotNodes.size() < 1)
|
||||
{
|
||||
Log(lsFATAL) << "Didn't get root node " << gotNodes.size();
|
||||
cLog(lsFATAL) << "Didn't get root node " << gotNodes.size();
|
||||
BOOST_FAIL("NodeSize");
|
||||
}
|
||||
if (!destination.addRootNode(*gotNodes.begin(), snfWIRE))
|
||||
{
|
||||
Log(lsFATAL) << "AddRootNode fails";
|
||||
cLog(lsFATAL) << "AddRootNode fails";
|
||||
BOOST_FAIL("AddRootNode");
|
||||
}
|
||||
nodeIDs.clear();
|
||||
gotNodes.clear();
|
||||
|
||||
Log(lsINFO) << "ROOT COMPLETE, INNER SYNCHING";
|
||||
cLog(lsINFO) << "ROOT COMPLETE, INNER SYNCHING";
|
||||
#ifdef SMS_DEBUG
|
||||
int bytes = 0;
|
||||
#endif
|
||||
@@ -477,14 +479,14 @@ BOOST_AUTO_TEST_CASE( SHAMapSync_test )
|
||||
destination.getMissingNodes(nodeIDs, hashes, 2048, NULL);
|
||||
if (nodeIDs.empty()) break;
|
||||
|
||||
Log(lsINFO) << nodeIDs.size() << " needed nodes";
|
||||
cLog(lsINFO) << nodeIDs.size() << " needed nodes";
|
||||
|
||||
// get as many nodes as possible based on this information
|
||||
for (nodeIDIterator = nodeIDs.begin(); nodeIDIterator != nodeIDs.end(); ++nodeIDIterator)
|
||||
{
|
||||
if (!source.getNodeFat(*nodeIDIterator, gotNodeIDs, gotNodes, (rand() % 2) == 0, (rand() % 2) == 0))
|
||||
{
|
||||
Log(lsFATAL) << "GetNodeFat fails";
|
||||
cLog(lsFATAL) << "GetNodeFat fails";
|
||||
BOOST_FAIL("GetNodeFat");
|
||||
}
|
||||
}
|
||||
@@ -494,11 +496,11 @@ BOOST_AUTO_TEST_CASE( SHAMapSync_test )
|
||||
|
||||
if (gotNodeIDs.empty())
|
||||
{
|
||||
Log(lsFATAL) << "No nodes gotten";
|
||||
cLog(lsFATAL) << "No nodes gotten";
|
||||
BOOST_FAIL("Got Node ID");
|
||||
}
|
||||
|
||||
Log(lsTRACE) << gotNodeIDs.size() << " found nodes";
|
||||
cLog(lsTRACE) << gotNodeIDs.size() << " found nodes";
|
||||
for (nodeIDIterator = gotNodeIDs.begin(), rawNodeIterator = gotNodes.begin();
|
||||
nodeIDIterator != gotNodeIDs.end(); ++nodeIDIterator, ++rawNodeIterator)
|
||||
{
|
||||
@@ -508,7 +510,7 @@ BOOST_AUTO_TEST_CASE( SHAMapSync_test )
|
||||
#endif
|
||||
if (!destination.addKnownNode(*nodeIDIterator, *rawNodeIterator, NULL))
|
||||
{
|
||||
Log(lsTRACE) << "AddKnownNode fails";
|
||||
cLog(lsTRACE) << "AddKnownNode fails";
|
||||
BOOST_FAIL("AddKnownNode");
|
||||
}
|
||||
}
|
||||
@@ -520,18 +522,18 @@ BOOST_AUTO_TEST_CASE( SHAMapSync_test )
|
||||
destination.clearSynching();
|
||||
|
||||
#ifdef SMS_DEBUG
|
||||
Log(lsINFO) << "SYNCHING COMPLETE " << items << " items, " << nodes << " nodes, " <<
|
||||
cLog(lsINFO) << "SYNCHING COMPLETE " << items << " items, " << nodes << " nodes, " <<
|
||||
bytes / 1024 << " KB";
|
||||
#endif
|
||||
|
||||
if (!source.deepCompare(destination))
|
||||
{
|
||||
Log(lsFATAL) << "DeepCompare fails";
|
||||
cLog(lsFATAL) << "DeepCompare fails";
|
||||
BOOST_FAIL("Deep Compare");
|
||||
}
|
||||
|
||||
#ifdef SMS_DEBUG
|
||||
Log(lsINFO) << "SHAMapSync test passed: " << items << " items, " <<
|
||||
cLog(lsINFO) << "SHAMapSync test passed: " << items << " items, " <<
|
||||
passes << " passes, " << nodes << " nodes";
|
||||
#endif
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include "TransactionFormats.h"
|
||||
#include "utils.h"
|
||||
|
||||
SETUP_LOG();
|
||||
|
||||
void TransactionEngine::txnWrite()
|
||||
{
|
||||
// Write back the account states
|
||||
@@ -32,7 +34,7 @@ void TransactionEngine::txnWrite()
|
||||
|
||||
case taaCREATE:
|
||||
{
|
||||
Log(lsINFO) << "applyTransaction: taaCREATE: " << sleEntry->getText();
|
||||
cLog(lsINFO) << "applyTransaction: taaCREATE: " << sleEntry->getText();
|
||||
|
||||
if (mLedger->writeBack(lepCREATE, sleEntry) & lepERROR)
|
||||
assert(false);
|
||||
@@ -41,7 +43,7 @@ void TransactionEngine::txnWrite()
|
||||
|
||||
case taaMODIFY:
|
||||
{
|
||||
Log(lsINFO) << "applyTransaction: taaMODIFY: " << sleEntry->getText();
|
||||
cLog(lsINFO) << "applyTransaction: taaMODIFY: " << sleEntry->getText();
|
||||
|
||||
if (mLedger->writeBack(lepNONE, sleEntry) & lepERROR)
|
||||
assert(false);
|
||||
@@ -50,7 +52,7 @@ void TransactionEngine::txnWrite()
|
||||
|
||||
case taaDELETE:
|
||||
{
|
||||
Log(lsINFO) << "applyTransaction: taaDELETE: " << sleEntry->getText();
|
||||
cLog(lsINFO) << "applyTransaction: taaDELETE: " << sleEntry->getText();
|
||||
|
||||
if (!mLedger->peekAccountStateMap()->delItem(it->first))
|
||||
assert(false);
|
||||
@@ -62,7 +64,7 @@ void TransactionEngine::txnWrite()
|
||||
|
||||
TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, TransactionEngineParams params)
|
||||
{
|
||||
Log(lsTRACE) << "applyTransaction>";
|
||||
cLog(lsTRACE) << "applyTransaction>";
|
||||
assert(mLedger);
|
||||
mNodes.init(mLedger, txn.getTransactionID(), mLedger->getLedgerSeq());
|
||||
|
||||
@@ -75,7 +77,7 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
||||
SerializedTransaction s2(sit);
|
||||
if (!s2.isEquivalent(txn))
|
||||
{
|
||||
Log(lsFATAL) << "Transaction serdes mismatch";
|
||||
cLog(lsFATAL) << "Transaction serdes mismatch";
|
||||
Json::StyledStreamWriter ssw;
|
||||
ssw.write(Log(lsINFO).ref(), txn.getJson(0));
|
||||
ssw.write(Log(lsFATAL).ref(), s2.getJson(0));
|
||||
@@ -88,7 +90,7 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
||||
uint256 txID = txn.getTransactionID();
|
||||
if (!txID)
|
||||
{
|
||||
Log(lsWARNING) << "applyTransaction: invalid transaction id";
|
||||
cLog(lsWARNING) << "applyTransaction: invalid transaction id";
|
||||
|
||||
terResult = temINVALID;
|
||||
}
|
||||
@@ -110,7 +112,7 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
||||
// Consistency: really signed.
|
||||
if ((tesSUCCESS == terResult) && !isSetBit(params, tapNO_CHECK_SIGN) && !txn.checkSign(naSigningPubKey))
|
||||
{
|
||||
Log(lsWARNING) << "applyTransaction: Invalid transaction: bad signature";
|
||||
cLog(lsWARNING) << "applyTransaction: Invalid transaction: bad signature";
|
||||
|
||||
terResult = temINVALID;
|
||||
}
|
||||
@@ -153,12 +155,12 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
||||
break;
|
||||
|
||||
case ttINVALID:
|
||||
Log(lsWARNING) << "applyTransaction: Invalid transaction: ttINVALID transaction type";
|
||||
cLog(lsWARNING) << "applyTransaction: Invalid transaction: ttINVALID transaction type";
|
||||
terResult = temINVALID;
|
||||
break;
|
||||
|
||||
default:
|
||||
Log(lsWARNING) << "applyTransaction: Invalid transaction: unknown transaction type";
|
||||
cLog(lsWARNING) << "applyTransaction: Invalid transaction: unknown transaction type";
|
||||
terResult = temUNKNOWN;
|
||||
break;
|
||||
}
|
||||
@@ -173,7 +175,7 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
||||
// Only check fee is sufficient when the ledger is open.
|
||||
if (isSetBit(params, tapOPEN_LEDGER) && saPaid < saCost)
|
||||
{
|
||||
Log(lsINFO) << "applyTransaction: insufficient fee";
|
||||
cLog(lsINFO) << "applyTransaction: insufficient fee";
|
||||
|
||||
terResult = telINSUF_FEE_P;
|
||||
}
|
||||
@@ -183,7 +185,7 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
||||
if (saPaid)
|
||||
{
|
||||
// Transaction is malformed.
|
||||
Log(lsWARNING) << "applyTransaction: fee not allowed";
|
||||
cLog(lsWARNING) << "applyTransaction: fee not allowed";
|
||||
|
||||
terResult = temINSUF_FEE_P;
|
||||
}
|
||||
@@ -194,7 +196,7 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
||||
mTxnAccountID = txn.getSourceAccount().getAccountID();
|
||||
if (tesSUCCESS == terResult && !mTxnAccountID)
|
||||
{
|
||||
Log(lsWARNING) << "applyTransaction: bad source id";
|
||||
cLog(lsWARNING) << "applyTransaction: bad source id";
|
||||
|
||||
terResult = temINVALID;
|
||||
}
|
||||
@@ -215,7 +217,7 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
||||
|
||||
if (!mTxnAccount)
|
||||
{
|
||||
Log(lsTRACE) << boost::str(boost::format("applyTransaction: Delay transaction: source account does not exist: %s") %
|
||||
cLog(lsTRACE) << boost::str(boost::format("applyTransaction: Delay transaction: source account does not exist: %s") %
|
||||
txn.getSourceAccount().humanAccountID());
|
||||
|
||||
terResult = terNO_ACCOUNT;
|
||||
@@ -234,7 +236,7 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
||||
case ttCLAIM:
|
||||
if (bHaveAuthKey)
|
||||
{
|
||||
Log(lsWARNING) << "applyTransaction: Account already claimed.";
|
||||
cLog(lsWARNING) << "applyTransaction: Account already claimed.";
|
||||
|
||||
terResult = tefCLAIMED;
|
||||
}
|
||||
@@ -257,8 +259,8 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
||||
if (naSigningPubKey.getAccountID() != mTxnAccountID)
|
||||
{
|
||||
// Signing Pub Key must be for Source Account ID.
|
||||
Log(lsWARNING) << "sourceAccountID: " << naSigningPubKey.humanAccountID();
|
||||
Log(lsWARNING) << "txn accountID: " << txn.getSourceAccount().humanAccountID();
|
||||
cLog(lsWARNING) << "sourceAccountID: " << naSigningPubKey.humanAccountID();
|
||||
cLog(lsWARNING) << "txn accountID: " << txn.getSourceAccount().humanAccountID();
|
||||
|
||||
terResult = tefBAD_CLAIM_ID;
|
||||
}
|
||||
@@ -270,8 +272,8 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
||||
if (naSigningPubKey.getAccountID() != mTxnAccountID)
|
||||
{
|
||||
// Signing Pub Key must be for Source Account ID.
|
||||
Log(lsWARNING) << "sourceAccountID: " << naSigningPubKey.humanAccountID();
|
||||
Log(lsWARNING) << "txn accountID: " << txn.getSourceAccount().humanAccountID();
|
||||
cLog(lsWARNING) << "sourceAccountID: " << naSigningPubKey.humanAccountID();
|
||||
cLog(lsWARNING) << "txn accountID: " << txn.getSourceAccount().humanAccountID();
|
||||
|
||||
terResult = temBAD_SET_ID;
|
||||
}
|
||||
@@ -291,13 +293,13 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
||||
}
|
||||
else if (bHaveAuthKey)
|
||||
{
|
||||
Log(lsINFO) << "applyTransaction: Delay: Not authorized to use account.";
|
||||
cLog(lsINFO) << "applyTransaction: Delay: Not authorized to use account.";
|
||||
|
||||
terResult = tefBAD_AUTH;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log(lsINFO) << "applyTransaction: Invalid: Not authorized to use account.";
|
||||
cLog(lsINFO) << "applyTransaction: Invalid: Not authorized to use account.";
|
||||
|
||||
terResult = temBAD_AUTH_MASTER;
|
||||
}
|
||||
@@ -313,7 +315,7 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
||||
}
|
||||
else if (saSrcBalance < saPaid)
|
||||
{
|
||||
Log(lsINFO)
|
||||
cLog(lsINFO)
|
||||
<< boost::str(boost::format("applyTransaction: Delay: insufficient balance: balance=%s paid=%s")
|
||||
% saSrcBalance.getText()
|
||||
% saPaid.getText());
|
||||
@@ -334,13 +336,13 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
||||
{
|
||||
uint32 a_seq = mTxnAccount->getFieldU32(sfSequence);
|
||||
|
||||
Log(lsTRACE) << "Aseq=" << a_seq << ", Tseq=" << t_seq;
|
||||
cLog(lsTRACE) << "Aseq=" << a_seq << ", Tseq=" << t_seq;
|
||||
|
||||
if (t_seq != a_seq)
|
||||
{
|
||||
if (a_seq < t_seq)
|
||||
{
|
||||
Log(lsINFO) << "applyTransaction: future sequence number";
|
||||
cLog(lsINFO) << "applyTransaction: future sequence number";
|
||||
|
||||
terResult = terPRE_SEQ;
|
||||
}
|
||||
@@ -348,7 +350,7 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
||||
terResult = tefALREADY;
|
||||
else
|
||||
{
|
||||
Log(lsWARNING) << "applyTransaction: past sequence number";
|
||||
cLog(lsWARNING) << "applyTransaction: past sequence number";
|
||||
|
||||
terResult = tefPAST_SEQ;
|
||||
}
|
||||
@@ -360,11 +362,11 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
||||
}
|
||||
else
|
||||
{
|
||||
Log(lsINFO) << "applyTransaction: Zero cost transaction";
|
||||
cLog(lsINFO) << "applyTransaction: Zero cost transaction";
|
||||
|
||||
if (t_seq)
|
||||
{
|
||||
Log(lsINFO) << "applyTransaction: bad sequence for pre-paid transaction";
|
||||
cLog(lsINFO) << "applyTransaction: bad sequence for pre-paid transaction";
|
||||
|
||||
terResult = tefPAST_SEQ;
|
||||
}
|
||||
@@ -389,7 +391,7 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
||||
break;
|
||||
|
||||
case ttINVALID:
|
||||
Log(lsINFO) << "applyTransaction: invalid type";
|
||||
cLog(lsINFO) << "applyTransaction: invalid type";
|
||||
terResult = temINVALID;
|
||||
break;
|
||||
|
||||
@@ -443,7 +445,7 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
||||
|
||||
transResultInfo(terResult, strToken, strHuman);
|
||||
|
||||
Log(lsINFO) << "applyTransaction: terResult=" << strToken << " : " << terResult << " : " << strHuman;
|
||||
cLog(lsINFO) << "applyTransaction: terResult=" << strToken << " : " << terResult << " : " << strHuman;
|
||||
|
||||
if (isTepPartial(terResult) && isSetBit(params, tapRETRY))
|
||||
{
|
||||
|
||||
@@ -42,6 +42,8 @@
|
||||
#define MIN(x,y) ((x)<(y)?(x):(y))
|
||||
#endif
|
||||
|
||||
SETUP_LOG();
|
||||
|
||||
UniqueNodeList::UniqueNodeList(boost::asio::io_service& io_service) :
|
||||
mdtScoreTimer(io_service),
|
||||
mFetchActive(0),
|
||||
@@ -612,7 +614,7 @@ void UniqueNodeList::processIps(const std::string& strSite, const NewcoinAddress
|
||||
|
||||
std::string strEscNodePublic = sqlEscape(naNodePublic.humanNodePublic());
|
||||
|
||||
Log(lsINFO)
|
||||
cLog(lsDEBUG)
|
||||
<< str(boost::format("Validator: '%s' processing %d ips.")
|
||||
% strSite % ( pmtVecStrIps ? pmtVecStrIps->size() : 0));
|
||||
|
||||
@@ -716,7 +718,7 @@ int UniqueNodeList::processValidators(const std::string& strSite, const std::str
|
||||
|
||||
if (!boost::regex_match(strReferral, smMatch, reReferral))
|
||||
{
|
||||
Log(lsWARNING) << str(boost::format("Bad validator: syntax error: %s: %s") % strSite % strReferral);
|
||||
cLog(lsWARNING) << str(boost::format("Bad validator: syntax error: %s: %s") % strSite % strReferral);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -727,7 +729,7 @@ int UniqueNodeList::processValidators(const std::string& strSite, const std::str
|
||||
if (naValidator.setSeedGeneric(strRefered))
|
||||
{
|
||||
|
||||
Log(lsWARNING) << str(boost::format("Bad validator: domain or public key required: %s %s") % strRefered % strComment);
|
||||
cLog(lsWARNING) << str(boost::format("Bad validator: domain or public key required: %s %s") % strRefered % strComment);
|
||||
}
|
||||
else if (naValidator.setNodePublic(strRefered))
|
||||
{
|
||||
@@ -735,7 +737,7 @@ int UniqueNodeList::processValidators(const std::string& strSite, const std::str
|
||||
// XXX Schedule for CAS lookup.
|
||||
nodeAddPublic(naValidator, vsWhy, strComment);
|
||||
|
||||
Log(lsINFO) << str(boost::format("Node Public: %s %s") % strRefered % strComment);
|
||||
cLog(lsINFO) << str(boost::format("Node Public: %s %s") % strRefered % strComment);
|
||||
|
||||
if (naNodePublic.isValid())
|
||||
vstrValues.push_back(str(boost::format("('%s',%d,'%s')") % strNodePublic % iValues % naValidator.humanNodePublic()));
|
||||
@@ -747,7 +749,7 @@ int UniqueNodeList::processValidators(const std::string& strSite, const std::str
|
||||
// A domain: need to look it up.
|
||||
nodeAddDomain(strRefered, vsWhy, strComment);
|
||||
|
||||
Log(lsINFO) << str(boost::format("Node Domain: %s %s") % strRefered % strComment);
|
||||
cLog(lsINFO) << str(boost::format("Node Domain: %s %s") % strRefered % strComment);
|
||||
|
||||
if (naNodePublic.isValid())
|
||||
vstrValues.push_back(str(boost::format("('%s',%d,%s)") % strNodePublic % iValues % sqlEscape(strRefered)));
|
||||
@@ -1577,7 +1579,7 @@ void UniqueNodeList::nodeBootstrap()
|
||||
// Always merge in the file specified in the config.
|
||||
if (!theConfig.UNL_DEFAULT.empty())
|
||||
{
|
||||
Log(lsINFO) << "Bootstrapping UNL: loading from unl_default.";
|
||||
cLog(lsINFO) << "Bootstrapping UNL: loading from unl_default.";
|
||||
|
||||
bLoaded = nodeLoad(theConfig.UNL_DEFAULT);
|
||||
}
|
||||
@@ -1585,7 +1587,7 @@ void UniqueNodeList::nodeBootstrap()
|
||||
// If never loaded anything try the current directory.
|
||||
if (!bLoaded && theConfig.UNL_DEFAULT.empty())
|
||||
{
|
||||
Log(lsINFO) << "Bootstrapping UNL: loading from '" VALIDATORS_FILE_NAME "'.";
|
||||
cLog(lsINFO) << "Bootstrapping UNL: loading from '" VALIDATORS_FILE_NAME "'.";
|
||||
|
||||
bLoaded = nodeLoad(VALIDATORS_FILE_NAME);
|
||||
}
|
||||
@@ -1595,7 +1597,7 @@ void UniqueNodeList::nodeBootstrap()
|
||||
{
|
||||
NewcoinAddress naInvalid; // Don't want a referrer on added entries.
|
||||
|
||||
Log(lsINFO) << "Bootstrapping UNL: loading from " CONFIG_FILE_NAME ".";
|
||||
cLog(lsINFO) << "Bootstrapping UNL: loading from " CONFIG_FILE_NAME ".";
|
||||
|
||||
if (processValidators("local", CONFIG_FILE_NAME, naInvalid, vsConfig, &theConfig.VALIDATORS))
|
||||
bLoaded = true;
|
||||
@@ -1603,7 +1605,7 @@ void UniqueNodeList::nodeBootstrap()
|
||||
|
||||
if (!bLoaded)
|
||||
{
|
||||
Log(lsINFO) << "Bootstrapping UNL: loading from " << theConfig.VALIDATORS_SITE << ".";
|
||||
cLog(lsINFO) << "Bootstrapping UNL: loading from " << theConfig.VALIDATORS_SITE << ".";
|
||||
|
||||
nodeNetwork();
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "LedgerTiming.h"
|
||||
#include "Log.h"
|
||||
|
||||
// #define VC_DEBUG
|
||||
SETUP_LOG();
|
||||
|
||||
bool ValidationCollection::addValidation(const SerializedValidation::pointer& val)
|
||||
{
|
||||
@@ -21,9 +21,14 @@ bool ValidationCollection::addValidation(const SerializedValidation::pointer& va
|
||||
if ((now > (valClose - LEDGER_EARLY_INTERVAL)) && (now < (valClose + LEDGER_VAL_INTERVAL)))
|
||||
isCurrent = true;
|
||||
else
|
||||
Log(lsWARNING) << "Received stale validation now=" << now << ", close=" << valClose;
|
||||
{
|
||||
cLog(lsWARNING) << "Received stale validation now=" << now << ", close=" << valClose;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cLog(lsINFO) << "Node " << signer.humanNodePublic() << " not in UNL";
|
||||
}
|
||||
else Log(lsINFO) << "Node " << signer.humanNodePublic() << " not in UNL";
|
||||
|
||||
uint256 hash = val->getLedgerHash();
|
||||
uint160 node = signer.getNodeID();
|
||||
@@ -49,7 +54,7 @@ bool ValidationCollection::addValidation(const SerializedValidation::pointer& va
|
||||
}
|
||||
}
|
||||
|
||||
Log(lsINFO) << "Val for " << hash << " from " << signer.humanNodePublic()
|
||||
cLog(lsINFO) << "Val for " << hash << " from " << signer.humanNodePublic()
|
||||
<< " added " << (val->isTrusted() ? "trusted/" : "UNtrusted/") << (isCurrent ? "current" : "stale");
|
||||
return isCurrent;
|
||||
}
|
||||
@@ -84,9 +89,7 @@ void ValidationCollection::getValidationCount(const uint256& ledger, bool curren
|
||||
isTrusted = false;
|
||||
else
|
||||
{
|
||||
#ifdef VC_DEBUG
|
||||
Log(lsINFO) << "VC: Untrusted due to time " << ledger;
|
||||
#endif
|
||||
cLog(lsTRACE) << "VC: Untrusted due to time " << ledger;
|
||||
}
|
||||
}
|
||||
if (isTrusted)
|
||||
@@ -95,9 +98,7 @@ void ValidationCollection::getValidationCount(const uint256& ledger, bool curren
|
||||
++untrusted;
|
||||
}
|
||||
}
|
||||
#ifdef VC_DEBUG
|
||||
Log(lsINFO) << "VC: " << ledger << "t:" << trusted << " u:" << untrusted;
|
||||
#endif
|
||||
cLog(lsTRACE) << "VC: " << ledger << "t:" << trusted << " u:" << untrusted;
|
||||
}
|
||||
|
||||
int ValidationCollection::getTrustedValidationCount(const uint256& ledger)
|
||||
|
||||
Reference in New Issue
Block a user