mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Check consensus hash consistency (RIPD-1456):
These changes use the hash of the consensus transaction set when characterizing the mismatch between a locally built ledger and fully validated network ledger. This allows detection of non-determinism in transaction process, in which consensus succeeded, but a node somehow generated a different subsequent ledger.
This commit is contained in:
@@ -182,12 +182,19 @@ void
|
||||
LedgerMaster::setValidLedger(
|
||||
std::shared_ptr<Ledger const> const& l)
|
||||
{
|
||||
|
||||
std::vector <NetClock::time_point> times;
|
||||
boost::optional<uint256> consensusHash;
|
||||
|
||||
if (! standalone_)
|
||||
{
|
||||
times = app_.getValidations().getTrustedValidationTimes(
|
||||
l->info().hash);
|
||||
auto const vals = app_.getValidations().getTrustedForLedger(l->info().hash);
|
||||
times.reserve(vals.size());
|
||||
for(auto const& val: vals)
|
||||
times.push_back(val->getSignTime());
|
||||
|
||||
if(!vals.empty())
|
||||
consensusHash = vals.front()->getConsensusHash();
|
||||
}
|
||||
|
||||
NetClock::time_point signTime;
|
||||
@@ -216,7 +223,7 @@ LedgerMaster::setValidLedger(
|
||||
|
||||
app_.getOPs().updateLocalTx (*l);
|
||||
app_.getSHAMapStore().onLedgerClosed (getValidatedLedger());
|
||||
mLedgerHistory.validatedLedger (l);
|
||||
mLedgerHistory.validatedLedger (l, consensusHash);
|
||||
app_.getAmendmentTable().doValidatedLedger (l);
|
||||
if (!app_.getOPs().isAmendmentBlocked() &&
|
||||
app_.getAmendmentTable().hasUnsupportedEnabled ())
|
||||
@@ -804,7 +811,9 @@ LedgerMaster::checkAccept (
|
||||
/** Report that the consensus process built a particular ledger */
|
||||
void
|
||||
LedgerMaster::consensusBuilt(
|
||||
std::shared_ptr<Ledger const> const& ledger, Json::Value consensus)
|
||||
std::shared_ptr<Ledger const> const& ledger,
|
||||
uint256 const& consensusHash,
|
||||
Json::Value consensus)
|
||||
{
|
||||
|
||||
// Because we just built a ledger, we are no longer building one
|
||||
@@ -814,7 +823,7 @@ LedgerMaster::consensusBuilt(
|
||||
if (standalone_)
|
||||
return;
|
||||
|
||||
mLedgerHistory.builtLedger (ledger, std::move (consensus));
|
||||
mLedgerHistory.builtLedger (ledger, consensusHash, std::move (consensus));
|
||||
|
||||
if (ledger->info().seq <= mValidLedgerSeq)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user