mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Small changes to improve transaction benchmarking:
* Set transaction valid in hash router correctly * Properly account for root nodes in walkLedger * If loaded ledger is insane, log details * Extra logging while loading replay ledger * Don't test unsigned transactions expecting them to succeed * Don't be too noisy about signature failures
This commit is contained in:
@@ -1837,8 +1837,8 @@ int applyTransaction (TransactionEngine& engine
|
|||||||
parms = static_cast<TransactionEngineParams> (parms | tapRETRY);
|
parms = static_cast<TransactionEngineParams> (parms | tapRETRY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getApp().getHashRouter ().setFlag (txn->getTransactionID ()
|
if ((getApp().getHashRouter ().getFlags (txn->getTransactionID ())
|
||||||
, SF_SIGGOOD))
|
& SF_SIGGOOD) == SF_SIGGOOD)
|
||||||
{
|
{
|
||||||
parms = static_cast<TransactionEngineParams>
|
parms = static_cast<TransactionEngineParams>
|
||||||
(parms | tapNO_CHECK_SIGN);
|
(parms | tapNO_CHECK_SIGN);
|
||||||
|
|||||||
@@ -1549,7 +1549,16 @@ bool Ledger::walkLedger () const
|
|||||||
std::vector <SHAMapMissingNode> missingNodes1;
|
std::vector <SHAMapMissingNode> missingNodes1;
|
||||||
std::vector <SHAMapMissingNode> missingNodes2;
|
std::vector <SHAMapMissingNode> missingNodes2;
|
||||||
|
|
||||||
mAccountStateMap->walkMap (missingNodes1, 32);
|
if (mAccountStateMap->getHash().isZero() &&
|
||||||
|
! mAccountHash.isZero() &&
|
||||||
|
! mAccountStateMap->fetchRoot (mAccountHash, nullptr))
|
||||||
|
{
|
||||||
|
missingNodes1.emplace_back (SHAMapType::STATE, mAccountHash);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mAccountStateMap->walkMap (missingNodes1, 32);
|
||||||
|
}
|
||||||
|
|
||||||
if (ShouldLog (lsINFO, Ledger) && !missingNodes1.empty ())
|
if (ShouldLog (lsINFO, Ledger) && !missingNodes1.empty ())
|
||||||
{
|
{
|
||||||
@@ -1559,7 +1568,16 @@ bool Ledger::walkLedger () const
|
|||||||
<< "First: " << missingNodes1[0];
|
<< "First: " << missingNodes1[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
mTransactionMap->walkMap (missingNodes2, 32);
|
if (mTransactionMap->getHash().isZero() &&
|
||||||
|
mTransHash.isNonZero() &&
|
||||||
|
! mTransactionMap->fetchRoot (mTransHash, nullptr))
|
||||||
|
{
|
||||||
|
missingNodes2.emplace_back (SHAMapType::TRANSACTION, mTransHash);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mTransactionMap->walkMap (missingNodes2, 32);
|
||||||
|
}
|
||||||
|
|
||||||
if (ShouldLog (lsINFO, Ledger) && !missingNodes2.empty ())
|
if (ShouldLog (lsINFO, Ledger) && !missingNodes2.empty ())
|
||||||
{
|
{
|
||||||
@@ -1584,13 +1602,13 @@ bool Ledger::assertSane () const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteLog (lsFATAL, Ledger) << "ledger is not sane";
|
|
||||||
|
|
||||||
Json::Value j = getJson (*this);
|
Json::Value j = getJson (*this);
|
||||||
|
|
||||||
j [jss::accountTreeHash] = to_string (mAccountHash);
|
j [jss::accountTreeHash] = to_string (mAccountHash);
|
||||||
j [jss::transTreeHash] = to_string (mTransHash);
|
j [jss::transTreeHash] = to_string (mTransHash);
|
||||||
|
|
||||||
|
WriteLog (lsFATAL, Ledger) << "ledger is not sane" << j;
|
||||||
|
|
||||||
assert (false);
|
assert (false);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -132,8 +132,8 @@ public:
|
|||||||
test_genesisLedger (true, KeyType::secp256k1);
|
test_genesisLedger (true, KeyType::secp256k1);
|
||||||
test_genesisLedger (true, KeyType::ed25519);
|
test_genesisLedger (true, KeyType::ed25519);
|
||||||
|
|
||||||
test_genesisLedger (false, KeyType::secp256k1);
|
// test_genesisLedger (false, KeyType::secp256k1);
|
||||||
test_genesisLedger (false, KeyType::ed25519);
|
// test_genesisLedger (false, KeyType::ed25519);
|
||||||
|
|
||||||
test_unsigned_fails (KeyType::secp256k1);
|
test_unsigned_fails (KeyType::secp256k1);
|
||||||
test_unsigned_fails (KeyType::ed25519);
|
test_unsigned_fails (KeyType::ed25519);
|
||||||
|
|||||||
@@ -1238,10 +1238,12 @@ bool ApplicationImp::loadOldLedger (
|
|||||||
// this ledger holds the transactions we want to replay
|
// this ledger holds the transactions we want to replay
|
||||||
replayLedger = loadLedger;
|
replayLedger = loadLedger;
|
||||||
|
|
||||||
// this is the prior ledger
|
m_journal.info << "Loading parent ledger";
|
||||||
|
|
||||||
loadLedger = Ledger::loadByHash (replayLedger->getParentHash ());
|
loadLedger = Ledger::loadByHash (replayLedger->getParentHash ());
|
||||||
if (!loadLedger)
|
if (!loadLedger)
|
||||||
{
|
{
|
||||||
|
m_journal.info << "Loading parent ledger from node store";
|
||||||
|
|
||||||
// Try to build the ledger from the back end
|
// Try to build the ledger from the back end
|
||||||
auto il = std::make_shared <InboundLedger> (
|
auto il = std::make_shared <InboundLedger> (
|
||||||
@@ -1310,6 +1312,7 @@ bool ApplicationImp::loadOldLedger (
|
|||||||
txn->getSTransaction()->add(s);
|
txn->getSTransaction()->add(s);
|
||||||
if (!cur->addTransaction(it->getTag(), s))
|
if (!cur->addTransaction(it->getTag(), s))
|
||||||
m_journal.warning << "Unable to add transaction " << it->getTag();
|
m_journal.warning << "Unable to add transaction " << it->getTag();
|
||||||
|
getApp().getHashRouter().setFlag (it->getTag(), SF_SIGGOOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Switch to the mutable snapshot
|
// Switch to the mutable snapshot
|
||||||
|
|||||||
@@ -242,7 +242,7 @@ TER Transactor::preCheck ()
|
|||||||
(!(mParams & tapNO_CHECK_SIGN) && !mTxn.checkSign()))
|
(!(mParams & tapNO_CHECK_SIGN) && !mTxn.checkSign()))
|
||||||
{
|
{
|
||||||
mTxn.setBad ();
|
mTxn.setBad ();
|
||||||
m_journal.warning << "apply: Invalid transaction (bad signature)";
|
m_journal.debug << "apply: Invalid transaction (bad signature)";
|
||||||
return temINVALID;
|
return temINVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user