diff --git a/Consensus_8cpp_source.html b/Consensus_8cpp_source.html
index a0cf5b55f0..1d82340853 100644
--- a/Consensus_8cpp_source.html
+++ b/Consensus_8cpp_source.html
@@ -217,11 +217,11 @@ $(function() {
-
-
-
-
-
+
+
+
+
+
149 CLOG(clog) <<
"consensus stalled. ";
diff --git a/Consensus_8h_source.html b/Consensus_8h_source.html
index 3ac5b13376..6299369a45 100644
--- a/Consensus_8h_source.html
+++ b/Consensus_8h_source.html
@@ -1406,197 +1406,211 @@ $(function() {
1712 <<
", disagree=" << disagree;
-
- 1716 bool const stalled = haveCloseTimeConsensus_ &&
-
- 1718 [
this, &parms](
auto const& dispute) {
- 1719 return dispute.second.stalled(
-
- 1721 mode_.get() == ConsensusMode::proposing,
- 1722 peerUnchangedCounter_);
-
-
-
-
-
-
-
-
-
- 1732 result_->roundTime.read(),
-
-
-
-
-
+
+
+
+ 1718 bool const stalled = haveCloseTimeConsensus_ &&
+ 1719 !result_->disputes.empty() &&
+
+ 1721 [
this, &parms, &
clog](
auto const& dispute) {
+ 1722 return dispute.second.stalled(
+
+ 1724 mode_.get() == ConsensusMode::proposing,
+ 1725 peerUnchangedCounter_,
+
+
+
+
+
+
+ 1732 ss <<
"Consensus detects as stalled with " << (agree + disagree) <<
"/"
+ 1733 << prevProposers_ <<
" proposers, and " << result_->disputes.size()
+ 1734 <<
" stalled disputed transactions.";
+
+
+
-
-
- 1741 CLOG(
clog) <<
"No consensus. ";
-
-
-
-
-
-
- 1748 static auto const minimumCounter =
-
-
- 1751 if (establishCounter_ < minimumCounter)
-
-
-
-
-
-
-
-
- 1760 ss <<
"Consensus time has expired in round " << establishCounter_
- 1761 <<
"; continue until round " << minimumCounter <<
". "
-
-
- 1764 CLOG(
clog) << ss.
str() <<
". ";
-
-
-
-
- 1769 CLOG(
clog) << ss.
str() <<
". ";
- 1770 leaveConsensus(
clog);
-
-
-
-
-
- 1776 JLOG(j_.
error()) <<
"Unable to reach consensus";
-
- 1778 CLOG(
clog) <<
"Unable to reach consensus "
-
-
-
- 1782 CLOG(
clog) <<
"Consensus has been reached. ";
-
-
-
- 1786template <
class Adaptor>
-
-
-
-
-
-
- 1793 if (result_ && !result_->position.isBowOut())
-
- 1795 result_->position.bowOut(now_);
- 1796 adaptor_.propose(result_->position);
-
-
-
- 1800 JLOG(j_.
info()) <<
"Bowing out of consensus";
- 1801 CLOG(
clog) <<
"Bowing out of consensus. ";
-
-
-
- 1805template <
class Adaptor>
-
-
-
-
-
-
- 1812 XRPL_ASSERT(result_,
"ripple::Consensus::createDisputes : result is set");
-
-
- 1815 auto const emplaced = result_->compares.emplace(o.id()).second;
- 1816 CLOG(
clog) <<
"createDisputes: new set? " << !emplaced <<
". ";
-
-
-
-
- 1821 if (result_->txns.id() == o.id())
-
- 1823 CLOG(
clog) <<
"both sets are identical. ";
-
-
-
- 1827 CLOG(
clog) <<
"comparing existing with new set: " << result_->txns.id()
- 1828 <<
',' << o.id() <<
". ";
- 1829 JLOG(j_.
debug()) <<
"createDisputes " << result_->txns.id() <<
" to "
-
-
- 1832 auto differences = result_->txns.compare(o);
+
+
+
+
+
+
+
+ 1746 result_->roundTime.read(),
+
+
+
+
+
+
+
+
+ 1755 CLOG(
clog) <<
"No consensus. ";
+
+
+
+
+
+
+ 1762 static auto const minimumCounter =
+
+
+ 1765 if (establishCounter_ < minimumCounter)
+
+
+
+
+
+
+
+
+ 1774 ss <<
"Consensus time has expired in round " << establishCounter_
+ 1775 <<
"; continue until round " << minimumCounter <<
". "
+
+
+ 1778 CLOG(
clog) << ss.
str() <<
". ";
+
+
+
+
+ 1783 CLOG(
clog) << ss.
str() <<
". ";
+ 1784 leaveConsensus(
clog);
+
+
+
+
+
+ 1790 JLOG(j_.
error()) <<
"Unable to reach consensus";
+
+ 1792 CLOG(
clog) <<
"Unable to reach consensus "
+
+
+
+ 1796 CLOG(
clog) <<
"Consensus has been reached. ";
+
+
+
+ 1800template <
class Adaptor>
+
+
+
+
+
+
+ 1807 if (result_ && !result_->position.isBowOut())
+
+ 1809 result_->position.bowOut(now_);
+ 1810 adaptor_.propose(result_->position);
+
+
+
+ 1814 JLOG(j_.
info()) <<
"Bowing out of consensus";
+ 1815 CLOG(
clog) <<
"Bowing out of consensus. ";
+
+
+
+ 1819template <
class Adaptor>
+
+
+
+
+
+
+ 1826 XRPL_ASSERT(result_,
"ripple::Consensus::createDisputes : result is set");
+
+
+ 1829 auto const emplaced = result_->compares.emplace(o.id()).second;
+ 1830 CLOG(
clog) <<
"createDisputes: new set? " << !emplaced <<
". ";
+
+
-
-
- 1836 for (
auto const& [txId, inThisSet] : differences)
-
-
-
-
- 1841 (inThisSet && result_->txns.find(txId) && !o.find(txId)) ||
- 1842 (!inThisSet && !result_->txns.find(txId) && o.find(txId)),
- 1843 "ripple::Consensus::createDisputes : has disputed transactions");
-
- 1845 Tx_t tx = inThisSet ? result_->txns.find(txId) : o.find(txId);
- 1846 auto txID = tx.id();
+
+ 1835 if (result_->txns.id() == o.id())
+
+ 1837 CLOG(
clog) <<
"both sets are identical. ";
+
+
+
+ 1841 CLOG(
clog) <<
"comparing existing with new set: " << result_->txns.id()
+ 1842 <<
',' << o.id() <<
". ";
+ 1843 JLOG(j_.
debug()) <<
"createDisputes " << result_->txns.id() <<
" to "
+
+
+ 1846 auto differences = result_->txns.compare(o);
- 1848 if (result_->disputes.find(txID) != result_->disputes.end())
-
-
- 1851 JLOG(j_.
debug()) <<
"Transaction " << txID <<
" is disputed";
-
-
-
- 1855 result_->txns.exists(txID),
- 1856 std::max(prevProposers_, currPeerPositions_.size()),
-
+
+
+ 1850 for (
auto const& [txId, inThisSet] : differences)
+
+
+
+
+ 1855 (inThisSet && result_->txns.find(txId) && !o.find(txId)) ||
+ 1856 (!inThisSet && !result_->txns.find(txId) && o.find(txId)),
+ 1857 "ripple::Consensus::createDisputes : has disputed transactions");
-
- 1860 for (
auto const& [nodeId, peerPos] : currPeerPositions_)
-
- 1862 Proposal_t const& peerProp = peerPos.proposal();
- 1863 auto const cit = acquired_.find(peerProp.
position());
- 1864 if (cit != acquired_.end() &&
- 1865 dtx.setVote(nodeId, cit->second.exists(txID)))
- 1866 peerUnchangedCounter_ = 0;
-
- 1868 adaptor_.share(dtx.tx());
-
- 1870 result_->disputes.emplace(txID, std::move(dtx));
-
- 1872 JLOG(j_.
debug()) << dc <<
" differences found";
- 1873 CLOG(
clog) <<
"disputes: " << dc <<
". ";
-
-
- 1876template <
class Adaptor>
-
-
-
-
- 1881 XRPL_ASSERT(result_,
"ripple::Consensus::updateDisputes : result is set");
-
-
-
- 1885 if (result_->compares.find(other.id()) == result_->compares.end())
- 1886 createDisputes(other);
-
- 1888 for (
auto& it : result_->disputes)
-
- 1890 auto& d = it.second;
- 1891 if (d.setVote(node, other.exists(d.tx().id())))
- 1892 peerUnchangedCounter_ = 0;
-
-
-
- 1896template <
class Adaptor>
-
-
-
-
-
-
-
-
-
+ 1859 Tx_t tx = inThisSet ? result_->txns.find(txId) : o.find(txId);
+ 1860 auto txID = tx.id();
+
+ 1862 if (result_->disputes.find(txID) != result_->disputes.end())
+
+
+ 1865 JLOG(j_.
debug()) <<
"Transaction " << txID <<
" is disputed";
+
+
+
+ 1869 result_->txns.exists(txID),
+ 1870 std::max(prevProposers_, currPeerPositions_.size()),
+
+
+
+ 1874 for (
auto const& [nodeId, peerPos] : currPeerPositions_)
+
+ 1876 Proposal_t const& peerProp = peerPos.proposal();
+ 1877 auto const cit = acquired_.find(peerProp.
position());
+ 1878 if (cit != acquired_.end() &&
+ 1879 dtx.setVote(nodeId, cit->second.exists(txID)))
+ 1880 peerUnchangedCounter_ = 0;
+
+ 1882 adaptor_.share(dtx.tx());
+
+ 1884 result_->disputes.emplace(txID, std::move(dtx));
+
+ 1886 JLOG(j_.
debug()) << dc <<
" differences found";
+ 1887 CLOG(
clog) <<
"disputes: " << dc <<
". ";
+
+
+ 1890template <
class Adaptor>
+
+
+
+
+ 1895 XRPL_ASSERT(result_,
"ripple::Consensus::updateDisputes : result is set");
+
+
+
+ 1899 if (result_->compares.find(other.id()) == result_->compares.end())
+ 1900 createDisputes(other);
+
+ 1902 for (
auto& it : result_->disputes)
+
+ 1904 auto& d = it.second;
+ 1905 if (d.setVote(node, other.exists(d.tx().id())))
+ 1906 peerUnchangedCounter_ = 0;
+
+
+
+ 1910template <
class Adaptor>
+
+
+
+
+
+
+
+
+
@@ -1636,8 +1650,8 @@ $(function() {
NetClock::time_point prevCloseTime_
clock_type const & clock_
-void leaveConsensus(std::unique_ptr< std::stringstream > const &clog)
-void updateDisputes(NodeID_t const &node, TxSet_t const &other)
+void leaveConsensus(std::unique_ptr< std::stringstream > const &clog)
+void updateDisputes(NodeID_t const &node, TxSet_t const &other)
typename Adaptor::TxSet_t TxSet_t
ConsensusParms::AvalancheState closeTimeAvalancheState_
@@ -1656,9 +1670,9 @@ $(function() {
Consensus(Consensus &&) noexcept=default
NetClock::time_point now_
std::size_t prevProposers_
-NetClock::time_point asCloseTime(NetClock::time_point raw) const
+NetClock::time_point asCloseTime(NetClock::time_point raw) const
-void createDisputes(TxSet_t const &o, std::unique_ptr< std::stringstream > const &clog={})
+void createDisputes(TxSet_t const &o, std::unique_ptr< std::stringstream > const &clog={})
void gotTxSet(NetClock::time_point const &now, TxSet_t const &txSet)
Process a transaction set acquired from the network.
typename Adaptor::Ledger_t Ledger_t
diff --git a/Consensus__test_8cpp_source.html b/Consensus__test_8cpp_source.html
index 9056a592ad..4610632baf 100644
--- a/Consensus__test_8cpp_source.html
+++ b/Consensus__test_8cpp_source.html
@@ -1212,307 +1212,410 @@ $(function() {
-
-
-
-
-
-
- 1145 Dispute proposingTrue{txTrue.id(),
true, numPeers, journal_};
- 1146 Dispute proposingFalse{txFalse.id(),
false, numPeers, journal_};
- 1147 Dispute followingTrue{
- 1148 txFollowingTrue.id(),
true, numPeers, journal_};
- 1149 Dispute followingFalse{
- 1150 txFollowingFalse.id(),
false, numPeers, journal_};
- 1151 BEAST_EXPECT(proposingTrue.ID() == 99);
- 1152 BEAST_EXPECT(proposingFalse.ID() == 98);
- 1153 BEAST_EXPECT(followingTrue.ID() == 97);
- 1154 BEAST_EXPECT(followingFalse.ID() == 96);
-
-
- 1157 for (
int i = 0; i < numPeers; ++i)
-
- 1159 BEAST_EXPECT(proposingTrue.setVote(PeerID(i), i < 50));
- 1160 BEAST_EXPECT(proposingFalse.setVote(PeerID(i), i < 50));
- 1161 BEAST_EXPECT(followingTrue.setVote(PeerID(i), i < 50));
- 1162 BEAST_EXPECT(followingFalse.setVote(PeerID(i), i < 50));
-
-
- 1165 BEAST_EXPECT(proposingTrue.setVote(PeerID(50),
true));
- 1166 BEAST_EXPECT(proposingFalse.setVote(PeerID(49),
false));
- 1167 BEAST_EXPECT(followingTrue.setVote(PeerID(50),
true));
- 1168 BEAST_EXPECT(followingFalse.setVote(PeerID(49),
false));
-
-
- 1171 BEAST_EXPECT(proposingTrue.getOurVote() ==
true);
- 1172 BEAST_EXPECT(proposingFalse.getOurVote() ==
false);
- 1173 BEAST_EXPECT(followingTrue.getOurVote() ==
true);
- 1174 BEAST_EXPECT(followingFalse.getOurVote() ==
false);
- 1175 BEAST_EXPECT(!proposingTrue.stalled(p,
true, peersUnchanged));
- 1176 BEAST_EXPECT(!proposingFalse.stalled(p,
true, peersUnchanged));
- 1177 BEAST_EXPECT(!followingTrue.stalled(p,
false, peersUnchanged));
- 1178 BEAST_EXPECT(!followingFalse.stalled(p,
false, peersUnchanged));
-
-
- 1181 BEAST_EXPECT(!proposingTrue.updateVote(5,
true, p));
- 1182 BEAST_EXPECT(!proposingFalse.updateVote(5,
true, p));
- 1183 BEAST_EXPECT(!followingTrue.updateVote(5,
false, p));
- 1184 BEAST_EXPECT(!followingFalse.updateVote(5,
false, p));
-
- 1186 BEAST_EXPECT(!proposingTrue.updateVote(10,
true, p));
- 1187 BEAST_EXPECT(!proposingFalse.updateVote(10,
true, p));
- 1188 BEAST_EXPECT(!followingTrue.updateVote(10,
false, p));
- 1189 BEAST_EXPECT(!followingFalse.updateVote(10,
false, p));
-
-
- 1192 BEAST_EXPECT(!proposingTrue.stalled(p,
true, peersUnchanged));
- 1193 BEAST_EXPECT(!proposingFalse.stalled(p,
true, peersUnchanged));
- 1194 BEAST_EXPECT(!followingTrue.stalled(p,
false, peersUnchanged));
- 1195 BEAST_EXPECT(!followingFalse.stalled(p,
false, peersUnchanged));
-
-
-
- 1199 BEAST_EXPECT(proposingTrue.updateVote(55,
true, p));
- 1200 BEAST_EXPECT(!proposingFalse.updateVote(55,
true, p));
- 1201 BEAST_EXPECT(!followingTrue.updateVote(55,
false, p));
- 1202 BEAST_EXPECT(!followingFalse.updateVote(55,
false, p));
-
- 1204 BEAST_EXPECT(proposingTrue.getOurVote() ==
false);
- 1205 BEAST_EXPECT(proposingFalse.getOurVote() ==
false);
- 1206 BEAST_EXPECT(followingTrue.getOurVote() ==
true);
- 1207 BEAST_EXPECT(followingFalse.getOurVote() ==
false);
-
- 1209 for (
int i = 0; i < 16; ++i)
-
- 1211 auto pTrue = PeerID(numPeers - i - 1);
- 1212 auto pFalse = PeerID(i);
- 1213 BEAST_EXPECT(proposingTrue.setVote(pTrue,
true));
- 1214 BEAST_EXPECT(proposingFalse.setVote(pFalse,
false));
- 1215 BEAST_EXPECT(followingTrue.setVote(pTrue,
true));
- 1216 BEAST_EXPECT(followingFalse.setVote(pFalse,
false));
-
-
- 1219 BEAST_EXPECT(proposingTrue.updateVote(60,
true, p));
- 1220 BEAST_EXPECT(!proposingFalse.updateVote(60,
true, p));
- 1221 BEAST_EXPECT(!followingTrue.updateVote(60,
false, p));
- 1222 BEAST_EXPECT(!followingFalse.updateVote(60,
false, p));
-
- 1224 BEAST_EXPECT(proposingTrue.getOurVote() ==
true);
- 1225 BEAST_EXPECT(proposingFalse.getOurVote() ==
false);
- 1226 BEAST_EXPECT(followingTrue.getOurVote() ==
true);
- 1227 BEAST_EXPECT(followingFalse.getOurVote() ==
false);
-
-
- 1230 BEAST_EXPECT(proposingTrue.updateVote(86,
true, p));
- 1231 BEAST_EXPECT(!proposingFalse.updateVote(86,
true, p));
- 1232 BEAST_EXPECT(!followingTrue.updateVote(86,
false, p));
- 1233 BEAST_EXPECT(!followingFalse.updateVote(86,
false, p));
-
- 1235 BEAST_EXPECT(proposingTrue.getOurVote() ==
false);
- 1236 BEAST_EXPECT(proposingFalse.getOurVote() ==
false);
- 1237 BEAST_EXPECT(followingTrue.getOurVote() ==
true);
- 1238 BEAST_EXPECT(followingFalse.getOurVote() ==
false);
-
-
- 1241 for (
int i = 16; i < 21; ++i)
-
- 1243 auto pTrue = PeerID(numPeers - i - 1);
- 1244 auto pFalse = PeerID(i);
- 1245 BEAST_EXPECT(proposingTrue.setVote(pTrue,
true));
- 1246 BEAST_EXPECT(proposingFalse.setVote(pFalse,
false));
- 1247 BEAST_EXPECT(followingTrue.setVote(pTrue,
true));
- 1248 BEAST_EXPECT(followingFalse.setVote(pFalse,
false));
-
-
-
- 1252 BEAST_EXPECT(proposingTrue.updateVote(90,
true, p));
- 1253 BEAST_EXPECT(!proposingFalse.updateVote(90,
true, p));
- 1254 BEAST_EXPECT(!followingTrue.updateVote(90,
false, p));
- 1255 BEAST_EXPECT(!followingFalse.updateVote(90,
false, p));
-
- 1257 BEAST_EXPECT(proposingTrue.getOurVote() ==
true);
- 1258 BEAST_EXPECT(proposingFalse.getOurVote() ==
false);
- 1259 BEAST_EXPECT(followingTrue.getOurVote() ==
true);
- 1260 BEAST_EXPECT(followingFalse.getOurVote() ==
false);
-
-
- 1263 BEAST_EXPECT(!proposingTrue.updateVote(150,
true, p));
- 1264 BEAST_EXPECT(!proposingFalse.updateVote(150,
true, p));
- 1265 BEAST_EXPECT(!followingTrue.updateVote(150,
false, p));
- 1266 BEAST_EXPECT(!followingFalse.updateVote(150,
false, p));
-
- 1268 BEAST_EXPECT(proposingTrue.getOurVote() ==
true);
- 1269 BEAST_EXPECT(proposingFalse.getOurVote() ==
false);
- 1270 BEAST_EXPECT(followingTrue.getOurVote() ==
true);
- 1271 BEAST_EXPECT(followingFalse.getOurVote() ==
false);
-
-
- 1274 BEAST_EXPECT(!proposingTrue.updateVote(190,
true, p));
- 1275 BEAST_EXPECT(!proposingFalse.updateVote(190,
true, p));
- 1276 BEAST_EXPECT(!followingTrue.updateVote(190,
false, p));
- 1277 BEAST_EXPECT(!followingFalse.updateVote(190,
false, p));
-
- 1279 BEAST_EXPECT(proposingTrue.getOurVote() ==
true);
- 1280 BEAST_EXPECT(proposingFalse.getOurVote() ==
false);
- 1281 BEAST_EXPECT(followingTrue.getOurVote() ==
true);
- 1282 BEAST_EXPECT(followingFalse.getOurVote() ==
false);
-
-
- 1285 BEAST_EXPECT(!proposingTrue.stalled(p,
true, peersUnchanged));
- 1286 BEAST_EXPECT(!proposingFalse.stalled(p,
true, peersUnchanged));
- 1287 BEAST_EXPECT(!followingTrue.stalled(p,
false, peersUnchanged));
- 1288 BEAST_EXPECT(!followingFalse.stalled(p,
false, peersUnchanged));
-
-
- 1291 BEAST_EXPECT(proposingTrue.updateVote(220,
true, p));
- 1292 BEAST_EXPECT(!proposingFalse.updateVote(220,
true, p));
- 1293 BEAST_EXPECT(!followingTrue.updateVote(220,
false, p));
- 1294 BEAST_EXPECT(!followingFalse.updateVote(220,
false, p));
-
- 1296 BEAST_EXPECT(proposingTrue.getOurVote() ==
false);
- 1297 BEAST_EXPECT(proposingFalse.getOurVote() ==
false);
- 1298 BEAST_EXPECT(followingTrue.getOurVote() ==
true);
- 1299 BEAST_EXPECT(followingFalse.getOurVote() ==
false);
-
-
- 1302 for (
int i = 21; i < 46; ++i)
-
- 1304 auto pTrue = PeerID(numPeers - i - 1);
- 1305 auto pFalse = PeerID(i);
- 1306 BEAST_EXPECT(proposingTrue.setVote(pTrue,
true));
- 1307 BEAST_EXPECT(proposingFalse.setVote(pFalse,
false));
- 1308 BEAST_EXPECT(followingTrue.setVote(pTrue,
true));
- 1309 BEAST_EXPECT(followingFalse.setVote(pFalse,
false));
-
-
-
- 1313 BEAST_EXPECT(proposingTrue.updateVote(250,
true, p));
- 1314 BEAST_EXPECT(!proposingFalse.updateVote(250,
true, p));
- 1315 BEAST_EXPECT(!followingTrue.updateVote(250,
false, p));
- 1316 BEAST_EXPECT(!followingFalse.updateVote(250,
false, p));
-
- 1318 BEAST_EXPECT(proposingTrue.getOurVote() ==
true);
- 1319 BEAST_EXPECT(proposingFalse.getOurVote() ==
false);
- 1320 BEAST_EXPECT(followingTrue.getOurVote() ==
true);
- 1321 BEAST_EXPECT(followingFalse.getOurVote() ==
false);
-
- 1323 for (peersUnchanged = 0; peersUnchanged < 6; ++peersUnchanged)
-
- 1325 BEAST_EXPECT(!proposingTrue.stalled(p,
true, peersUnchanged));
- 1326 BEAST_EXPECT(!proposingFalse.stalled(p,
true, peersUnchanged));
- 1327 BEAST_EXPECT(!followingTrue.stalled(p,
false, peersUnchanged));
- 1328 BEAST_EXPECT(!followingFalse.stalled(p,
false, peersUnchanged));
+
+ 1140 auto j = logs->journal(
"Test");
+ 1141 auto clog = std::make_unique<std::stringstream>();
+
+
+
+
+
+
+
+ 1149 Dispute proposingTrue{txTrue.id(),
true, numPeers, journal_};
+ 1150 Dispute proposingFalse{txFalse.id(),
false, numPeers, journal_};
+ 1151 Dispute followingTrue{
+ 1152 txFollowingTrue.id(),
true, numPeers, journal_};
+ 1153 Dispute followingFalse{
+ 1154 txFollowingFalse.id(),
false, numPeers, journal_};
+ 1155 BEAST_EXPECT(proposingTrue.ID() == 99);
+ 1156 BEAST_EXPECT(proposingFalse.ID() == 98);
+ 1157 BEAST_EXPECT(followingTrue.ID() == 97);
+ 1158 BEAST_EXPECT(followingFalse.ID() == 96);
+
+
+ 1161 for (
int i = 0; i < numPeers; ++i)
+
+ 1163 BEAST_EXPECT(proposingTrue.setVote(PeerID(i), i < 50));
+ 1164 BEAST_EXPECT(proposingFalse.setVote(PeerID(i), i < 50));
+ 1165 BEAST_EXPECT(followingTrue.setVote(PeerID(i), i < 50));
+ 1166 BEAST_EXPECT(followingFalse.setVote(PeerID(i), i < 50));
+
+
+ 1169 BEAST_EXPECT(proposingTrue.setVote(PeerID(50),
true));
+ 1170 BEAST_EXPECT(proposingFalse.setVote(PeerID(49),
false));
+ 1171 BEAST_EXPECT(followingTrue.setVote(PeerID(50),
true));
+ 1172 BEAST_EXPECT(followingFalse.setVote(PeerID(49),
false));
+
+
+ 1175 BEAST_EXPECT(proposingTrue.getOurVote() ==
true);
+ 1176 BEAST_EXPECT(proposingFalse.getOurVote() ==
false);
+ 1177 BEAST_EXPECT(followingTrue.getOurVote() ==
true);
+ 1178 BEAST_EXPECT(followingFalse.getOurVote() ==
false);
+
+ 1180 !proposingTrue.stalled(p,
true, peersUnchanged, j,
clog));
+
+ 1182 !proposingFalse.stalled(p,
true, peersUnchanged, j,
clog));
+
+ 1184 !followingTrue.stalled(p,
false, peersUnchanged, j,
clog));
+
+ 1186 !followingFalse.stalled(p,
false, peersUnchanged, j,
clog));
+ 1187 BEAST_EXPECT(
clog->str() ==
"");
+
+
+ 1190 BEAST_EXPECT(!proposingTrue.updateVote(5,
true, p));
+ 1191 BEAST_EXPECT(!proposingFalse.updateVote(5,
true, p));
+ 1192 BEAST_EXPECT(!followingTrue.updateVote(5,
false, p));
+ 1193 BEAST_EXPECT(!followingFalse.updateVote(5,
false, p));
+
+ 1195 BEAST_EXPECT(!proposingTrue.updateVote(10,
true, p));
+ 1196 BEAST_EXPECT(!proposingFalse.updateVote(10,
true, p));
+ 1197 BEAST_EXPECT(!followingTrue.updateVote(10,
false, p));
+ 1198 BEAST_EXPECT(!followingFalse.updateVote(10,
false, p));
+
+
+
+ 1202 !proposingTrue.stalled(p,
true, peersUnchanged, j,
clog));
+
+ 1204 !proposingFalse.stalled(p,
true, peersUnchanged, j,
clog));
+
+ 1206 !followingTrue.stalled(p,
false, peersUnchanged, j,
clog));
+
+ 1208 !followingFalse.stalled(p,
false, peersUnchanged, j,
clog));
+ 1209 BEAST_EXPECT(
clog->str() ==
"");
+
+
+
+ 1213 BEAST_EXPECT(proposingTrue.updateVote(55,
true, p));
+ 1214 BEAST_EXPECT(!proposingFalse.updateVote(55,
true, p));
+ 1215 BEAST_EXPECT(!followingTrue.updateVote(55,
false, p));
+ 1216 BEAST_EXPECT(!followingFalse.updateVote(55,
false, p));
+
+ 1218 BEAST_EXPECT(proposingTrue.getOurVote() ==
false);
+ 1219 BEAST_EXPECT(proposingFalse.getOurVote() ==
false);
+ 1220 BEAST_EXPECT(followingTrue.getOurVote() ==
true);
+ 1221 BEAST_EXPECT(followingFalse.getOurVote() ==
false);
+
+ 1223 for (
int i = 0; i < 16; ++i)
+
+ 1225 auto pTrue = PeerID(numPeers - i - 1);
+ 1226 auto pFalse = PeerID(i);
+ 1227 BEAST_EXPECT(proposingTrue.setVote(pTrue,
true));
+ 1228 BEAST_EXPECT(proposingFalse.setVote(pFalse,
false));
+ 1229 BEAST_EXPECT(followingTrue.setVote(pTrue,
true));
+ 1230 BEAST_EXPECT(followingFalse.setVote(pFalse,
false));
+
+
+ 1233 BEAST_EXPECT(proposingTrue.updateVote(60,
true, p));
+ 1234 BEAST_EXPECT(!proposingFalse.updateVote(60,
true, p));
+ 1235 BEAST_EXPECT(!followingTrue.updateVote(60,
false, p));
+ 1236 BEAST_EXPECT(!followingFalse.updateVote(60,
false, p));
+
+ 1238 BEAST_EXPECT(proposingTrue.getOurVote() ==
true);
+ 1239 BEAST_EXPECT(proposingFalse.getOurVote() ==
false);
+ 1240 BEAST_EXPECT(followingTrue.getOurVote() ==
true);
+ 1241 BEAST_EXPECT(followingFalse.getOurVote() ==
false);
+
+
+ 1244 BEAST_EXPECT(proposingTrue.updateVote(86,
true, p));
+ 1245 BEAST_EXPECT(!proposingFalse.updateVote(86,
true, p));
+ 1246 BEAST_EXPECT(!followingTrue.updateVote(86,
false, p));
+ 1247 BEAST_EXPECT(!followingFalse.updateVote(86,
false, p));
+
+ 1249 BEAST_EXPECT(proposingTrue.getOurVote() ==
false);
+ 1250 BEAST_EXPECT(proposingFalse.getOurVote() ==
false);
+ 1251 BEAST_EXPECT(followingTrue.getOurVote() ==
true);
+ 1252 BEAST_EXPECT(followingFalse.getOurVote() ==
false);
+
+
+ 1255 for (
int i = 16; i < 21; ++i)
+
+ 1257 auto pTrue = PeerID(numPeers - i - 1);
+ 1258 auto pFalse = PeerID(i);
+ 1259 BEAST_EXPECT(proposingTrue.setVote(pTrue,
true));
+ 1260 BEAST_EXPECT(proposingFalse.setVote(pFalse,
false));
+ 1261 BEAST_EXPECT(followingTrue.setVote(pTrue,
true));
+ 1262 BEAST_EXPECT(followingFalse.setVote(pFalse,
false));
+
+
+
+ 1266 BEAST_EXPECT(proposingTrue.updateVote(90,
true, p));
+ 1267 BEAST_EXPECT(!proposingFalse.updateVote(90,
true, p));
+ 1268 BEAST_EXPECT(!followingTrue.updateVote(90,
false, p));
+ 1269 BEAST_EXPECT(!followingFalse.updateVote(90,
false, p));
+
+ 1271 BEAST_EXPECT(proposingTrue.getOurVote() ==
true);
+ 1272 BEAST_EXPECT(proposingFalse.getOurVote() ==
false);
+ 1273 BEAST_EXPECT(followingTrue.getOurVote() ==
true);
+ 1274 BEAST_EXPECT(followingFalse.getOurVote() ==
false);
+
+
+ 1277 BEAST_EXPECT(!proposingTrue.updateVote(150,
true, p));
+ 1278 BEAST_EXPECT(!proposingFalse.updateVote(150,
true, p));
+ 1279 BEAST_EXPECT(!followingTrue.updateVote(150,
false, p));
+ 1280 BEAST_EXPECT(!followingFalse.updateVote(150,
false, p));
+
+ 1282 BEAST_EXPECT(proposingTrue.getOurVote() ==
true);
+ 1283 BEAST_EXPECT(proposingFalse.getOurVote() ==
false);
+ 1284 BEAST_EXPECT(followingTrue.getOurVote() ==
true);
+ 1285 BEAST_EXPECT(followingFalse.getOurVote() ==
false);
+
+
+ 1288 BEAST_EXPECT(!proposingTrue.updateVote(190,
true, p));
+ 1289 BEAST_EXPECT(!proposingFalse.updateVote(190,
true, p));
+ 1290 BEAST_EXPECT(!followingTrue.updateVote(190,
false, p));
+ 1291 BEAST_EXPECT(!followingFalse.updateVote(190,
false, p));
+
+ 1293 BEAST_EXPECT(proposingTrue.getOurVote() ==
true);
+ 1294 BEAST_EXPECT(proposingFalse.getOurVote() ==
false);
+ 1295 BEAST_EXPECT(followingTrue.getOurVote() ==
true);
+ 1296 BEAST_EXPECT(followingFalse.getOurVote() ==
false);
+
+
+
+ 1300 !proposingTrue.stalled(p,
true, peersUnchanged, j,
clog));
+
+ 1302 !proposingFalse.stalled(p,
true, peersUnchanged, j,
clog));
+
+ 1304 !followingTrue.stalled(p,
false, peersUnchanged, j,
clog));
+
+ 1306 !followingFalse.stalled(p,
false, peersUnchanged, j,
clog));
+ 1307 BEAST_EXPECT(
clog->str() ==
"");
+
+
+ 1310 BEAST_EXPECT(proposingTrue.updateVote(220,
true, p));
+ 1311 BEAST_EXPECT(!proposingFalse.updateVote(220,
true, p));
+ 1312 BEAST_EXPECT(!followingTrue.updateVote(220,
false, p));
+ 1313 BEAST_EXPECT(!followingFalse.updateVote(220,
false, p));
+
+ 1315 BEAST_EXPECT(proposingTrue.getOurVote() ==
false);
+ 1316 BEAST_EXPECT(proposingFalse.getOurVote() ==
false);
+ 1317 BEAST_EXPECT(followingTrue.getOurVote() ==
true);
+ 1318 BEAST_EXPECT(followingFalse.getOurVote() ==
false);
+
+
+ 1321 for (
int i = 21; i < 46; ++i)
+
+ 1323 auto pTrue = PeerID(numPeers - i - 1);
+ 1324 auto pFalse = PeerID(i);
+ 1325 BEAST_EXPECT(proposingTrue.setVote(pTrue,
true));
+ 1326 BEAST_EXPECT(proposingFalse.setVote(pFalse,
false));
+ 1327 BEAST_EXPECT(followingTrue.setVote(pTrue,
true));
+ 1328 BEAST_EXPECT(followingFalse.setVote(pFalse,
false));
- 1331 for (
int i = 0; i < 1; ++i)
-
- 1333 BEAST_EXPECT(!proposingTrue.updateVote(250 + 10 * i,
true, p));
- 1334 BEAST_EXPECT(!proposingFalse.updateVote(250 + 10 * i,
true, p));
- 1335 BEAST_EXPECT(!followingTrue.updateVote(250 + 10 * i,
false, p));
-
- 1337 !followingFalse.updateVote(250 + 10 * i,
false, p));
-
- 1339 BEAST_EXPECT(proposingTrue.getOurVote() ==
true);
- 1340 BEAST_EXPECT(proposingFalse.getOurVote() ==
false);
- 1341 BEAST_EXPECT(followingTrue.getOurVote() ==
true);
- 1342 BEAST_EXPECT(followingFalse.getOurVote() ==
false);
-
-
- 1345 BEAST_EXPECT(!proposingTrue.stalled(p,
true, 0));
-
-
-
- 1349 BEAST_EXPECT(proposingFalse.stalled(p,
true, 0));
- 1350 BEAST_EXPECT(followingTrue.stalled(p,
false, 0));
- 1351 BEAST_EXPECT(followingFalse.stalled(p,
false, 0));
-
-
- 1354 BEAST_EXPECT(!proposingTrue.stalled(p,
true, peersUnchanged));
-
-
-
- 1358 BEAST_EXPECT(proposingFalse.stalled(p,
true, peersUnchanged));
- 1359 BEAST_EXPECT(followingTrue.stalled(p,
false, peersUnchanged));
- 1360 BEAST_EXPECT(followingFalse.stalled(p,
false, peersUnchanged));
-
- 1362 for (
int i = 1; i < 3; ++i)
-
- 1364 BEAST_EXPECT(!proposingTrue.updateVote(250 + 10 * i,
true, p));
- 1365 BEAST_EXPECT(!proposingFalse.updateVote(250 + 10 * i,
true, p));
- 1366 BEAST_EXPECT(!followingTrue.updateVote(250 + 10 * i,
false, p));
-
- 1368 !followingFalse.updateVote(250 + 10 * i,
false, p));
-
- 1370 BEAST_EXPECT(proposingTrue.getOurVote() ==
true);
- 1371 BEAST_EXPECT(proposingFalse.getOurVote() ==
false);
- 1372 BEAST_EXPECT(followingTrue.getOurVote() ==
true);
- 1373 BEAST_EXPECT(followingFalse.getOurVote() ==
false);
-
-
-
- 1377 BEAST_EXPECT(!proposingTrue.stalled(p,
true, 0));
-
- 1379 BEAST_EXPECT(proposingFalse.stalled(p,
true, 0));
- 1380 BEAST_EXPECT(followingTrue.stalled(p,
false, 0));
- 1381 BEAST_EXPECT(followingFalse.stalled(p,
false, 0));
-
-
-
- 1385 BEAST_EXPECT(proposingTrue.stalled(p,
true, peersUnchanged));
-
- 1387 BEAST_EXPECT(proposingFalse.stalled(p,
true, peersUnchanged));
- 1388 BEAST_EXPECT(followingTrue.stalled(p,
false, peersUnchanged));
- 1389 BEAST_EXPECT(followingFalse.stalled(p,
false, peersUnchanged));
-
- 1391 for (
int i = 3; i < 5; ++i)
-
- 1393 BEAST_EXPECT(!proposingTrue.updateVote(250 + 10 * i,
true, p));
- 1394 BEAST_EXPECT(!proposingFalse.updateVote(250 + 10 * i,
true, p));
- 1395 BEAST_EXPECT(!followingTrue.updateVote(250 + 10 * i,
false, p));
-
- 1397 !followingFalse.updateVote(250 + 10 * i,
false, p));
-
- 1399 BEAST_EXPECT(proposingTrue.getOurVote() ==
true);
- 1400 BEAST_EXPECT(proposingFalse.getOurVote() ==
false);
- 1401 BEAST_EXPECT(followingTrue.getOurVote() ==
true);
- 1402 BEAST_EXPECT(followingFalse.getOurVote() ==
false);
-
- 1404 BEAST_EXPECT(proposingTrue.stalled(p,
true, 0));
- 1405 BEAST_EXPECT(proposingFalse.stalled(p,
true, 0));
- 1406 BEAST_EXPECT(followingTrue.stalled(p,
false, 0));
- 1407 BEAST_EXPECT(followingFalse.stalled(p,
false, 0));
-
- 1409 BEAST_EXPECT(proposingTrue.stalled(p,
true, peersUnchanged));
- 1410 BEAST_EXPECT(proposingFalse.stalled(p,
true, peersUnchanged));
- 1411 BEAST_EXPECT(followingTrue.stalled(p,
false, peersUnchanged));
- 1412 BEAST_EXPECT(followingFalse.stalled(p,
false, peersUnchanged));
-
-
-
-
-
-
-
- 1420 testShouldCloseLedger();
- 1421 testCheckConsensus();
-
-
-
-
- 1426 testCloseTimeDisagree();
-
- 1428 testConsensusCloseTimeRounding();
-
-
- 1431 testPreferredByBranch();
- 1432 testPauseForLaggards();
-
-
-
-
-
-
-
+
+ 1332 BEAST_EXPECT(proposingTrue.updateVote(250,
true, p));
+ 1333 BEAST_EXPECT(!proposingFalse.updateVote(250,
true, p));
+ 1334 BEAST_EXPECT(!followingTrue.updateVote(250,
false, p));
+ 1335 BEAST_EXPECT(!followingFalse.updateVote(250,
false, p));
+
+ 1337 BEAST_EXPECT(proposingTrue.getOurVote() ==
true);
+ 1338 BEAST_EXPECT(proposingFalse.getOurVote() ==
false);
+ 1339 BEAST_EXPECT(followingTrue.getOurVote() ==
true);
+ 1340 BEAST_EXPECT(followingFalse.getOurVote() ==
false);
+
+ 1342 for (peersUnchanged = 0; peersUnchanged < 6; ++peersUnchanged)
+
+
+ 1345 !proposingTrue.stalled(p,
true, peersUnchanged, j,
clog));
+
+ 1347 !proposingFalse.stalled(p,
true, peersUnchanged, j,
clog));
+
+ 1349 !followingTrue.stalled(p,
false, peersUnchanged, j,
clog));
+
+ 1351 !followingFalse.stalled(p,
false, peersUnchanged, j,
clog));
+ 1352 BEAST_EXPECT(
clog->str() ==
"");
+
+
+ 1355 auto expectStalled = [
this, &
clog](
+
+
+
+
+
+
+ 1362 using namespace std::string_literals;
+
+ 1364 auto const s =
clog->str();
+ 1365 expect(s.find(
"stalled"), s, __FILE__, line);
+
+
+
+
+
+
+ 1372 s.find(
"voting "s + (ourVote ?
"YES" :
"NO")) != s.npos,
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1395 clog = std::make_unique<std::stringstream>();
+
+
+ 1398 for (
int i = 0; i < 1; ++i)
+
+ 1400 BEAST_EXPECT(!proposingTrue.updateVote(250 + 10 * i,
true, p));
+ 1401 BEAST_EXPECT(!proposingFalse.updateVote(250 + 10 * i,
true, p));
+ 1402 BEAST_EXPECT(!followingTrue.updateVote(250 + 10 * i,
false, p));
+
+ 1404 !followingFalse.updateVote(250 + 10 * i,
false, p));
+
+ 1406 BEAST_EXPECT(proposingTrue.getOurVote() ==
true);
+ 1407 BEAST_EXPECT(proposingFalse.getOurVote() ==
false);
+ 1408 BEAST_EXPECT(followingTrue.getOurVote() ==
true);
+ 1409 BEAST_EXPECT(followingFalse.getOurVote() ==
false);
+
+
+ 1412 BEAST_EXPECT(!proposingTrue.stalled(p,
true, 0, j,
clog));
+ 1413 BEAST_EXPECT(
clog->str() ==
"");
+
+
+
+ 1417 BEAST_EXPECT(proposingFalse.stalled(p,
true, 0, j,
clog));
+ 1418 expectStalled(98,
false, 11, 0, 2, __LINE__);
+ 1419 BEAST_EXPECT(followingTrue.stalled(p,
false, 0, j,
clog));
+ 1420 expectStalled(97,
true, 11, 0, 97, __LINE__);
+ 1421 BEAST_EXPECT(followingFalse.stalled(p,
false, 0, j,
clog));
+ 1422 expectStalled(96,
false, 11, 0, 3, __LINE__);
+
+
+
+ 1426 !proposingTrue.stalled(p,
true, peersUnchanged, j,
clog));
+ 1427 BEAST_EXPECTS(
clog->str() ==
"",
clog->str());
+
+
+
+
+ 1432 proposingFalse.stalled(p,
true, peersUnchanged, j,
clog));
+ 1433 expectStalled(98,
false, 11, 6, 2, __LINE__);
+
+ 1435 followingTrue.stalled(p,
false, peersUnchanged, j,
clog));
+ 1436 expectStalled(97,
true, 11, 6, 97, __LINE__);
+
+ 1438 followingFalse.stalled(p,
false, peersUnchanged, j,
clog));
+ 1439 expectStalled(96,
false, 11, 6, 3, __LINE__);
+
+ 1441 for (
int i = 1; i < 3; ++i)
+
+ 1443 BEAST_EXPECT(!proposingTrue.updateVote(250 + 10 * i,
true, p));
+ 1444 BEAST_EXPECT(!proposingFalse.updateVote(250 + 10 * i,
true, p));
+ 1445 BEAST_EXPECT(!followingTrue.updateVote(250 + 10 * i,
false, p));
+
+ 1447 !followingFalse.updateVote(250 + 10 * i,
false, p));
+
+ 1449 BEAST_EXPECT(proposingTrue.getOurVote() ==
true);
+ 1450 BEAST_EXPECT(proposingFalse.getOurVote() ==
false);
+ 1451 BEAST_EXPECT(followingTrue.getOurVote() ==
true);
+ 1452 BEAST_EXPECT(followingFalse.getOurVote() ==
false);
+
+
+
+ 1456 BEAST_EXPECT(!proposingTrue.stalled(p,
true, 0, j,
clog));
+ 1457 BEAST_EXPECTS(
clog->str() ==
"",
clog->str());
+
+ 1459 BEAST_EXPECT(proposingFalse.stalled(p,
true, 0, j,
clog));
+ 1460 expectStalled(98,
false, 11 + i, 0, 2, __LINE__);
+ 1461 BEAST_EXPECT(followingTrue.stalled(p,
false, 0, j,
clog));
+ 1462 expectStalled(97,
true, 11 + i, 0, 97, __LINE__);
+ 1463 BEAST_EXPECT(followingFalse.stalled(p,
false, 0, j,
clog));
+ 1464 expectStalled(96,
false, 11 + i, 0, 3, __LINE__);
+
+
+
+
+ 1469 proposingTrue.stalled(p,
true, peersUnchanged, j,
clog));
+ 1470 expectStalled(99,
true, 1 + i, 6, 97, __LINE__);
+
+
+ 1473 proposingFalse.stalled(p,
true, peersUnchanged, j,
clog));
+ 1474 expectStalled(98,
false, 11 + i, 6, 2, __LINE__);
+
+ 1476 followingTrue.stalled(p,
false, peersUnchanged, j,
clog));
+ 1477 expectStalled(97,
true, 11 + i, 6, 97, __LINE__);
+
+ 1479 followingFalse.stalled(p,
false, peersUnchanged, j,
clog));
+ 1480 expectStalled(96,
false, 11 + i, 6, 3, __LINE__);
+
+ 1482 for (
int i = 3; i < 5; ++i)
+
+ 1484 BEAST_EXPECT(!proposingTrue.updateVote(250 + 10 * i,
true, p));
+ 1485 BEAST_EXPECT(!proposingFalse.updateVote(250 + 10 * i,
true, p));
+ 1486 BEAST_EXPECT(!followingTrue.updateVote(250 + 10 * i,
false, p));
+
+ 1488 !followingFalse.updateVote(250 + 10 * i,
false, p));
+
+ 1490 BEAST_EXPECT(proposingTrue.getOurVote() ==
true);
+ 1491 BEAST_EXPECT(proposingFalse.getOurVote() ==
false);
+ 1492 BEAST_EXPECT(followingTrue.getOurVote() ==
true);
+ 1493 BEAST_EXPECT(followingFalse.getOurVote() ==
false);
+
+ 1495 BEAST_EXPECT(proposingTrue.stalled(p,
true, 0, j,
clog));
+ 1496 expectStalled(99,
true, 1 + i, 0, 97, __LINE__);
+ 1497 BEAST_EXPECT(proposingFalse.stalled(p,
true, 0, j,
clog));
+ 1498 expectStalled(98,
false, 11 + i, 0, 2, __LINE__);
+ 1499 BEAST_EXPECT(followingTrue.stalled(p,
false, 0, j,
clog));
+ 1500 expectStalled(97,
true, 11 + i, 0, 97, __LINE__);
+ 1501 BEAST_EXPECT(followingFalse.stalled(p,
false, 0, j,
clog));
+ 1502 expectStalled(96,
false, 11 + i, 0, 3, __LINE__);
+
+
+ 1505 proposingTrue.stalled(p,
true, peersUnchanged, j,
clog));
+ 1506 expectStalled(99,
true, 1 + i, 6, 97, __LINE__);
+
+ 1508 proposingFalse.stalled(p,
true, peersUnchanged, j,
clog));
+ 1509 expectStalled(98,
false, 11 + i, 6, 2, __LINE__);
+
+ 1511 followingTrue.stalled(p,
false, peersUnchanged, j,
clog));
+ 1512 expectStalled(97,
true, 11 + i, 6, 97, __LINE__);
+
+ 1514 followingFalse.stalled(p,
false, peersUnchanged, j,
clog));
+ 1515 expectStalled(96,
false, 11 + i, 6, 3, __LINE__);
+
+
+
+
+
+
+
+ 1523 testShouldCloseLedger();
+ 1524 testCheckConsensus();
+
+
+
+
+ 1529 testCloseTimeDisagree();
+
+ 1531 testConsensusCloseTimeRounding();
+
+
+ 1534 testPreferredByBranch();
+ 1535 testPauseForLaggards();
+
+
+
+
+
+
+
testcase_t testcase
Memberspace for declaring test cases.
Generic implementation of consensus algorithm.
@@ -1526,7 +1629,7 @@ $(function() {
void testPauseForLaggards()
-void run() override
Runs the suite.
+void run() override
Runs the suite.
void testConsensusCloseTimeRounding()
@@ -1542,10 +1645,12 @@ $(function() {
A group of simulation Peers.
void disconnect(PeerGroup const &o)
Destroy network connection.
void connect(PeerGroup const &o, SimDuration delay)
Establish network connection.
+
+
typename SimClock::duration SimDuration
typename SimClock::time_point SimTime
@@ -1583,6 +1688,7 @@ $(function() {
Ledger ledger
The new fully validated ledger.
A single peer in the simulation.
+
diff --git a/DisputedTx_8h_source.html b/DisputedTx_8h_source.html
index 3a6b52bdba..1eef64b500 100644
--- a/DisputedTx_8h_source.html
+++ b/DisputedTx_8h_source.html
@@ -138,261 +138,284 @@ $(function() {
-
-
-
-
-
-
-
-
-
-
- 98 if (nextCutoff.consensusTime > currentCutoff.consensusTime ||
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 103 if (nextCutoff.consensusTime > currentCutoff.consensusTime ||
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 123 int const weight = support / total;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 153 setVote(NodeID_t
const& peer,
bool votesYes);
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 128 int const weight = support / total;
+
+
+
+
+
+
+
+
+
+
+ 139 s <<
"Transaction " <<
ID() <<
" is stalled. We have been voting "
+
+ 141 <<
" rounds. Peers have not changed their votes in "
+ 142 << peersUnchanged <<
" rounds. The transaction has " << weight
+
+
+ 145 CLOG(clog) << s.
str();
+
+
+
+
+
+
+
+
+
+
+
- 160 unVote(NodeID_t
const& peer);
-
-
-
+
+
+
+
+
+
+ 174 setVote(NodeID_t
const& peer,
bool votesYes);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 196template <
class Tx_t,
class NodeID_t>
-
-
-
- 200 auto const [it, inserted] = votes_.insert(
std::make_pair(peer, votesYes));
-
-
-
-
-
-
- 207 JLOG(j_.
debug()) <<
"Peer " << peer <<
" votes YES on " << tx_.id();
-
-
-
-
- 212 JLOG(j_.
debug()) <<
"Peer " << peer <<
" votes NO on " << tx_.id();
-
-
-
-
-
- 218 else if (votesYes && !it->second)
-
- 220 JLOG(j_.
debug()) <<
"Peer " << peer <<
" now votes YES on " << tx_.id();
-
-
-
-
-
-
- 227 else if (!votesYes && it->second)
-
- 229 JLOG(j_.
debug()) <<
"Peer " << peer <<
" now votes NO on " << tx_.id();
-
-
-
-
-
-
-
-
-
- 239template <
class Tx_t,
class NodeID_t>
-
-
-
- 243 auto it = votes_.find(peer);
-
- 245 if (it != votes_.end())
-
-
-
-
-
-
-
-
-
-
- 256template <
class Tx_t,
class NodeID_t>
-
-
-
-
-
-
- 263 if (ourVote_ && (nays_ == 0))
-
+
+ 181 unVote(NodeID_t
const& peer);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 217template <
class Tx_t,
class NodeID_t>
+
+
+
+ 221 auto const [it, inserted] = votes_.insert(
std::make_pair(peer, votesYes));
+
+
+
+
+
+
+ 228 JLOG(j_.
debug()) <<
"Peer " << peer <<
" votes YES on " << tx_.id();
+
+
+
+
+ 233 JLOG(j_.
debug()) <<
"Peer " << peer <<
" votes NO on " << tx_.id();
+
+
+
+
+
+ 239 else if (votesYes && !it->second)
+
+ 241 JLOG(j_.
debug()) <<
"Peer " << peer <<
" now votes YES on " << tx_.id();
+
+
+
+
+
+
+ 248 else if (!votesYes && it->second)
+
+ 250 JLOG(j_.
debug()) <<
"Peer " << peer <<
" now votes NO on " << tx_.id();
+
+
+
+
+
+
+
+
+
+ 260template <
class Tx_t,
class NodeID_t>
+
+
+
+ 264 auto it = votes_.find(peer);
- 266 if (!ourVote_ && (yays_ == 0))
-
-
-
-
-
-
-
-
-
-
-
-
- 279 p, avalancheState_, percentTime, ++avalancheCounter_, p.
avMIN_ROUNDS);
-
-
- 282 avalancheState_ = *newState;
- 283 avalancheCounter_ = 0;
-
-
-
-
-
- 289 weight = (yays_ * 100 + (ourVote_ ? 100 : 0)) / (nays_ + yays_ + 1);
-
- 291 newPosition = weight > requiredPct;
-
-
-
-
-
- 297 newPosition = yays_ > nays_;
-
-
- 300 if (newPosition == ourVote_)
-
- 302 ++currentVoteCounter_;
- 303 JLOG(j_.
info()) <<
"No change (" << (ourVote_ ?
"YES" :
"NO") <<
") on "
- 304 << tx_.id() <<
" : weight " << weight <<
", percent "
-
- 306 <<
", round(s) with this vote: " << currentVoteCounter_;
-
-
-
-
- 311 currentVoteCounter_ = 0;
- 312 ourVote_ = newPosition;
- 313 JLOG(j_.
debug()) <<
"We now vote " << (ourVote_ ?
"YES" :
"NO") <<
" on "
-
-
-
-
-
- 319template <
class Tx_t,
class NodeID_t>
-
-
-
-
-
-
-
-
-
- 329 ret[
"our_vote"] = ourVote_;
-
-
-
-
- 334 for (
auto const& [nodeId, vote] : votes_)
-
- 336 ret[
"votes"] = std::move(votesj);
-
-
-
-
-
-
-
-
+ 266 if (it != votes_.end())
+
+
+
+
+
+
+
+
+
+
+ 277template <
class Tx_t,
class NodeID_t>
+
+
+
+
+
+
+ 284 if (ourVote_ && (nays_ == 0))
+
+
+ 287 if (!ourVote_ && (yays_ == 0))
+
+
+
+
+
+
+
+
+
+
+
+
+ 300 p, avalancheState_, percentTime, ++avalancheCounter_, p.
avMIN_ROUNDS);
+
+
+ 303 avalancheState_ = *newState;
+ 304 avalancheCounter_ = 0;
+
+
+
+
+
+ 310 weight = (yays_ * 100 + (ourVote_ ? 100 : 0)) / (nays_ + yays_ + 1);
+
+ 312 newPosition = weight > requiredPct;
+
+
+
+
+
+ 318 newPosition = yays_ > nays_;
+
+
+ 321 if (newPosition == ourVote_)
+
+ 323 ++currentVoteCounter_;
+ 324 JLOG(j_.
info()) <<
"No change (" << (ourVote_ ?
"YES" :
"NO") <<
") on "
+ 325 << tx_.id() <<
" : weight " << weight <<
", percent "
+
+ 327 <<
", round(s) with this vote: " << currentVoteCounter_;
+
+
+
+
+ 332 currentVoteCounter_ = 0;
+ 333 ourVote_ = newPosition;
+ 334 JLOG(j_.
debug()) <<
"We now vote " << (ourVote_ ?
"YES" :
"NO") <<
" on "
+
+
+
+
+
+ 340template <
class Tx_t,
class NodeID_t>
+
+
+
+
+
+
+
+
+
+ 350 ret[
"our_vote"] = ourVote_;
+
+
+
+
+ 355 for (
auto const& [nodeId, vote] : votes_)
+
+ 357 ret[
"votes"] = std::move(votesj);
+
+
+
+
+
+
+
+
+
Decorator for streaming out compact json.
A generic endpoint for log messages.
+
A transaction discovered to be in dispute during consensus.
-
-std::size_t avalancheCounter_
How long we have been in the current acceptance phase.
-std::size_t currentVoteCounter_
The number of rounds we've gone without changing our vote.
-Json::Value getJson() const
JSON representation of dispute, used for debugging.
-
-bool updateVote(int percentTime, bool proposing, ConsensusParms const &p)
Update our vote given progression of consensus.
+
+std::size_t avalancheCounter_
How long we have been in the current acceptance phase.
+std::size_t currentVoteCounter_
The number of rounds we've gone without changing our vote.
+Json::Value getJson() const
JSON representation of dispute, used for debugging.
+
+bool updateVote(int percentTime, bool proposing, ConsensusParms const &p)
Update our vote given progression of consensus.
boost::container::flat_map< NodeID_t, bool > Map_t
-bool setVote(NodeID_t const &peer, bool votesYes)
Change a peer's vote.
-ConsensusParms::AvalancheState avalancheState_
Which minimum acceptance percentage phase we are currently in.
-
-Tx_t const & tx() const
The disputed transaction.
+bool setVote(NodeID_t const &peer, bool votesYes)
Change a peer's vote.
+ConsensusParms::AvalancheState avalancheState_
Which minimum acceptance percentage phase we are currently in.
+
+Tx_t const & tx() const
The disputed transaction.
+bool stalled(ConsensusParms const &p, bool proposing, int peersUnchanged, beast::Journal j, std::unique_ptr< std::stringstream > const &clog) const
Are we and our peers "stalled" where we probably won't change our vote?
DisputedTx(Tx_t const &tx, bool ourVote, std::size_t numPeers, beast::Journal j)
Constructor.
-
+
bool getOurVote() const
Our vote on whether the transaction should be included.
-void setOurVote(bool o)
Change our vote.
-
+void setOurVote(bool o)
Change our vote.
+
TxID_t const & ID() const
The unique id/hash of the disputed transaction.
-void unVote(NodeID_t const &peer)
Remove a peer's vote.
-bool stalled(ConsensusParms const &p, bool proposing, int peersUnchanged) const
Are we and our peers "stalled" where we probably won't change our vote?
-
+void unVote(NodeID_t const &peer)
Remove a peer's vote.
+
@ objectValue
object value (collection of name/value pairs).
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
@@ -401,6 +424,7 @@ $(function() {
std::string to_string(base_uint< Bits, Tag > const &a)
Json::Value getJson(LedgerFill const &fill)
Return a new Json::Value representing the ledger with given options.
+
Consensus algorithm parameters.
std::size_t const avSTALLED_ROUNDS
Number of rounds before a stuck vote is considered unlikely to change because voting stalled.
std::size_t const avMIN_ROUNDS
Number of rounds before certain actions can happen.
@@ -409,6 +433,7 @@ $(function() {
std::size_t const minCONSENSUS_PCT
The percentage threshold above which we can declare consensus.
std::map< AvalancheState, AvalancheCutoff > const avalancheCutoffs
Map the consensus requirement avalanche state to the amount of time that must pass before moving to t...
+