mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Remove beast::Journal default constructor
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include <ripple/consensus/Consensus.h>
|
||||
#include <ripple/consensus/ConsensusProposal.h>
|
||||
#include <test/csf.h>
|
||||
#include <test/unit_test/SuiteJournal.h>
|
||||
#include <utility>
|
||||
|
||||
namespace ripple {
|
||||
@@ -28,7 +29,13 @@ namespace test {
|
||||
|
||||
class Consensus_test : public beast::unit_test::suite
|
||||
{
|
||||
SuiteJournal journal_;
|
||||
|
||||
public:
|
||||
Consensus_test ()
|
||||
: journal_ ("Consensus_test", *this)
|
||||
{ }
|
||||
|
||||
void
|
||||
testShouldCloseLedger()
|
||||
{
|
||||
@@ -36,36 +43,35 @@ public:
|
||||
|
||||
// Use default parameters
|
||||
ConsensusParms const p{};
|
||||
beast::Journal j;
|
||||
|
||||
// Bizarre times forcibly close
|
||||
BEAST_EXPECT(
|
||||
shouldCloseLedger(true, 10, 10, 10, -10s, 10s, 1s, 1s, p, j));
|
||||
shouldCloseLedger(true, 10, 10, 10, -10s, 10s, 1s, 1s, p, journal_));
|
||||
BEAST_EXPECT(
|
||||
shouldCloseLedger(true, 10, 10, 10, 100h, 10s, 1s, 1s, p, j));
|
||||
shouldCloseLedger(true, 10, 10, 10, 100h, 10s, 1s, 1s, p, journal_));
|
||||
BEAST_EXPECT(
|
||||
shouldCloseLedger(true, 10, 10, 10, 10s, 100h, 1s, 1s, p, j));
|
||||
shouldCloseLedger(true, 10, 10, 10, 10s, 100h, 1s, 1s, p, journal_));
|
||||
|
||||
// Rest of network has closed
|
||||
BEAST_EXPECT(
|
||||
shouldCloseLedger(true, 10, 3, 5, 10s, 10s, 10s, 10s, p, j));
|
||||
shouldCloseLedger(true, 10, 3, 5, 10s, 10s, 10s, 10s, p, journal_));
|
||||
|
||||
// No transactions means wait until end of internval
|
||||
BEAST_EXPECT(
|
||||
!shouldCloseLedger(false, 10, 0, 0, 1s, 1s, 1s, 10s, p, j));
|
||||
!shouldCloseLedger(false, 10, 0, 0, 1s, 1s, 1s, 10s, p, journal_));
|
||||
BEAST_EXPECT(
|
||||
shouldCloseLedger(false, 10, 0, 0, 1s, 10s, 1s, 10s, p, j));
|
||||
shouldCloseLedger(false, 10, 0, 0, 1s, 10s, 1s, 10s, p, journal_));
|
||||
|
||||
// Enforce minimum ledger open time
|
||||
BEAST_EXPECT(
|
||||
!shouldCloseLedger(true, 10, 0, 0, 10s, 10s, 1s, 10s, p, j));
|
||||
!shouldCloseLedger(true, 10, 0, 0, 10s, 10s, 1s, 10s, p, journal_));
|
||||
|
||||
// Don't go too much faster than last time
|
||||
BEAST_EXPECT(
|
||||
!shouldCloseLedger(true, 10, 0, 0, 10s, 10s, 3s, 10s, p, j));
|
||||
!shouldCloseLedger(true, 10, 0, 0, 10s, 10s, 3s, 10s, p, journal_));
|
||||
|
||||
BEAST_EXPECT(
|
||||
shouldCloseLedger(true, 10, 0, 0, 10s, 10s, 10s, 10s, p, j));
|
||||
shouldCloseLedger(true, 10, 0, 0, 10s, 10s, 10s, 10s, p, journal_));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -75,39 +81,38 @@ public:
|
||||
|
||||
// Use default parameterss
|
||||
ConsensusParms const p{};
|
||||
beast::Journal j;
|
||||
|
||||
// Not enough time has elapsed
|
||||
BEAST_EXPECT(
|
||||
ConsensusState::No ==
|
||||
checkConsensus(10, 2, 2, 0, 3s, 2s, p, true, j));
|
||||
checkConsensus(10, 2, 2, 0, 3s, 2s, p, true, journal_));
|
||||
|
||||
// If not enough peers have propsed, ensure
|
||||
// more time for proposals
|
||||
BEAST_EXPECT(
|
||||
ConsensusState::No ==
|
||||
checkConsensus(10, 2, 2, 0, 3s, 4s, p, true, j));
|
||||
checkConsensus(10, 2, 2, 0, 3s, 4s, p, true, journal_));
|
||||
|
||||
// Enough time has elapsed and we all agree
|
||||
BEAST_EXPECT(
|
||||
ConsensusState::Yes ==
|
||||
checkConsensus(10, 2, 2, 0, 3s, 10s, p, true, j));
|
||||
checkConsensus(10, 2, 2, 0, 3s, 10s, p, true, journal_));
|
||||
|
||||
// Enough time has elapsed and we don't yet agree
|
||||
BEAST_EXPECT(
|
||||
ConsensusState::No ==
|
||||
checkConsensus(10, 2, 1, 0, 3s, 10s, p, true, j));
|
||||
checkConsensus(10, 2, 1, 0, 3s, 10s, p, true, journal_));
|
||||
|
||||
// Our peers have moved on
|
||||
// Enough time has elapsed and we all agree
|
||||
BEAST_EXPECT(
|
||||
ConsensusState::MovedOn ==
|
||||
checkConsensus(10, 2, 1, 8, 3s, 10s, p, true, j));
|
||||
checkConsensus(10, 2, 1, 8, 3s, 10s, p, true, journal_));
|
||||
|
||||
// No peers makes it easy to agree
|
||||
BEAST_EXPECT(
|
||||
ConsensusState::Yes ==
|
||||
checkConsensus(0, 0, 0, 0, 3s, 10s, p, true, j));
|
||||
checkConsensus(0, 0, 0, 0, 3s, 10s, p, true, journal_));
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user