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:
Brad Chase
2018-03-01 13:22:45 -05:00
committed by seelabs
parent 3a5a6c3637
commit 1507ed66a8
20 changed files with 402 additions and 86 deletions

View File

@@ -88,6 +88,7 @@ public:
signed before sharing with other nodes.
@param ledgerHash The hash of the validated ledger
@param consensusHash The hash of the consensus transaction set
@param signTime When the validation is signed
@param publicKey The current signing public key
@param nodeID ID corresponding to node's public master key
@@ -97,6 +98,7 @@ public:
STValidation(
uint256 const& ledgerHash,
uint256 const& consensusHash,
NetClock::time_point signTime,
PublicKey const& publicKey,
NodeID const& nodeID,
@@ -114,9 +116,14 @@ public:
return emplace(n, buf, std::move(*this));
}
// Hash of the validated ledger
uint256
getLedgerHash() const;
// Hash of consensus transaction set used to generate ledger
uint256
getConsensusHash() const;
NetClock::time_point
getSignTime() const;

View File

@@ -28,6 +28,7 @@ namespace ripple {
STValidation::STValidation(
uint256 const& ledgerHash,
uint256 const& consensusHash,
NetClock::time_point signTime,
PublicKey const& publicKey,
NodeID const& nodeID,
@@ -36,6 +37,7 @@ STValidation::STValidation(
{
// Does not sign
setFieldH256 (sfLedgerHash, ledgerHash);
setFieldH256 (sfConsensusHash, consensusHash);
setFieldU32 (sfSigningTime, signTime.time_since_epoch().count());
setFieldVL (sfSigningPubKey, publicKey.slice());
@@ -65,6 +67,11 @@ uint256 STValidation::getLedgerHash () const
return getFieldH256 (sfLedgerHash);
}
uint256 STValidation::getConsensusHash () const
{
return getFieldH256 (sfConsensusHash);
}
NetClock::time_point
STValidation::getSignTime () const
{