From 88f844fd718e21b00a32f4aab7642253a52c31de Mon Sep 17 00:00:00 2001 From: Richard Holland Date: Mon, 19 Aug 2024 10:40:58 +1000 Subject: [PATCH] fix240918 --- src/ripple/app/misc/NetworkOPs.cpp | 14 +++++++++++--- src/ripple/app/rdb/impl/UnitaryShard.cpp | 12 +++++++----- src/ripple/app/rdb/impl/Wallet.cpp | 7 ++++--- src/ripple/app/tx/impl/Transactor.cpp | 10 ++++++++-- src/ripple/protocol/Feature.h | 3 ++- src/ripple/protocol/impl/Feature.cpp | 1 + src/ripple/server/impl/BaseWSPeer.h | 2 ++ 7 files changed, 35 insertions(+), 14 deletions(-) diff --git a/src/ripple/app/misc/NetworkOPs.cpp b/src/ripple/app/misc/NetworkOPs.cpp index 7a3175076..179b1ecbc 100644 --- a/src/ripple/app/misc/NetworkOPs.cpp +++ b/src/ripple/app/misc/NetworkOPs.cpp @@ -1142,8 +1142,12 @@ NetworkOPsImp::submitTransaction(std::shared_ptr const& iTrans) // Enforce Network bar for emitted txn if (view->rules().enabled(featureHooks) && hook::isEmittedTxn(*iTrans)) { - JLOG(m_journal.warn()) - << "Submitted transaction invalid: EmitDetails present."; + // RH NOTE: Warning removed here due to ConsesusSet using this function + // which continually triggers this bar. Doesn't seem dangerous, just + // annoying. + + // JLOG(m_journal.warn()) + // << "Submitted transaction invalid: EmitDetails present."; return; } @@ -1155,7 +1159,11 @@ NetworkOPsImp::submitTransaction(std::shared_ptr const& iTrans) if ((flags & SF_BAD) != 0) { - JLOG(m_journal.warn()) << "Submitted transaction cached bad"; + // RH NOTE: Warning removed here due to ConsesusSet using this function + // which continually triggers this bar. Doesn't seem dangerous, just + // annoying. + + // JLOG(m_journal.warn()) << "Submitted transaction cached bad"; return; } diff --git a/src/ripple/app/rdb/impl/UnitaryShard.cpp b/src/ripple/app/rdb/impl/UnitaryShard.cpp index 72441d0b7..56a14db58 100644 --- a/src/ripple/app/rdb/impl/UnitaryShard.cpp +++ b/src/ripple/app/rdb/impl/UnitaryShard.cpp @@ -173,6 +173,11 @@ updateLedgerDBs( auto const sParentHash{to_string(ledger->info().parentHash)}; auto const sDrops{to_string(ledger->info().drops)}; + auto const closingTime{ + ledger->info().closeTime.time_since_epoch().count()}; + auto const prevClosingTime{ + ledger->info().parentCloseTime.time_since_epoch().count()}; + auto const closeTimeRes{ledger->info().closeTimeResolution.count()}; auto const sAccountHash{to_string(ledger->info().accountHash)}; auto const sTxHash{to_string(ledger->info().txHash)}; @@ -188,11 +193,8 @@ updateLedgerDBs( ":closingTime, :prevClosingTime, :closeTimeRes," ":closeFlags, :accountSetHash, :transSetHash);", soci::use(sHash), soci::use(ledgerSeq), soci::use(sParentHash), - soci::use(sDrops), - soci::use(ledger->info().closeTime.time_since_epoch().count()), - soci::use( - ledger->info().parentCloseTime.time_since_epoch().count()), - soci::use(ledger->info().closeTimeResolution.count()), + soci::use(sDrops), soci::use(closingTime), + soci::use(prevClosingTime), soci::use(closeTimeRes), soci::use(ledger->info().closeFlags), soci::use(sAccountHash), soci::use(sTxHash); diff --git a/src/ripple/app/rdb/impl/Wallet.cpp b/src/ripple/app/rdb/impl/Wallet.cpp index 25a06bbd9..3715c4c74 100644 --- a/src/ripple/app/rdb/impl/Wallet.cpp +++ b/src/ripple/app/rdb/impl/Wallet.cpp @@ -205,19 +205,20 @@ insertPeerReservation( PublicKey const& nodeId, std::string const& description) { + auto const sNodeId = toBase58(TokenType::NodePublic, nodeId); session << "INSERT INTO PeerReservations (PublicKey, Description) " "VALUES (:nodeId, :desc) " "ON CONFLICT (PublicKey) DO UPDATE SET " "Description=excluded.Description", - soci::use(toBase58(TokenType::NodePublic, nodeId)), - soci::use(description); + soci::use(sNodeId), soci::use(description); } void deletePeerReservation(soci::session& session, PublicKey const& nodeId) { + auto const sNodeId = toBase58(TokenType::NodePublic, nodeId); session << "DELETE FROM PeerReservations WHERE PublicKey = :nodeId", - soci::use(toBase58(TokenType::NodePublic, nodeId)); + soci::use(sNodeId); } bool diff --git a/src/ripple/app/tx/impl/Transactor.cpp b/src/ripple/app/tx/impl/Transactor.cpp index f3ff68493..6c9337d07 100644 --- a/src/ripple/app/tx/impl/Transactor.cpp +++ b/src/ripple/app/tx/impl/Transactor.cpp @@ -1921,6 +1921,12 @@ Transactor::operator()() STObject const meta = metaRaw.getAsObject(); uint32_t lgrCur = view().seq(); + + bool const has240819 = view().rules().enabled(fix240819); + + auto const& sfRewardFields = + *(ripple::SField::knownCodeToField.at(917511 - has240819)); + // iterate all affected balances for (auto const& node : meta.getFieldArray(sfAffectedNodes)) { @@ -1932,7 +1938,7 @@ Transactor::operator()() if (nodeType != ltACCOUNT_ROOT || metaType == sfDeletedNode) continue; - if (!node.isFieldPresent(sfFinalFields) || + if (!node.isFieldPresent(sfRewardFields) || !node.isFieldPresent(sfLedgerIndex)) continue; @@ -1948,7 +1954,7 @@ Transactor::operator()() continue; STObject& finalFields = (const_cast(node)) - .getField(sfFinalFields) + .getField(sfRewardFields) .downcast(); if (!finalFields.isFieldPresent(sfBalance)) diff --git a/src/ripple/protocol/Feature.h b/src/ripple/protocol/Feature.h index 2d46df876..1ae142d30 100644 --- a/src/ripple/protocol/Feature.h +++ b/src/ripple/protocol/Feature.h @@ -74,7 +74,7 @@ namespace detail { // Feature.cpp. Because it's only used to reserve storage, and determine how // large to make the FeatureBitset, it MAY be larger. It MUST NOT be less than // the actual number of amendments. A LogicError on startup will verify this. -static constexpr std::size_t numFeatures = 70; +static constexpr std::size_t numFeatures = 71; /** Amendments that this server supports and the default voting behavior. Whether they are enabled depends on the Rules defined in the validated @@ -358,6 +358,7 @@ extern uint256 const fixXahauV2; extern uint256 const featureRemit; extern uint256 const featureZeroB2M; extern uint256 const fixNSDelete; +extern uint256 const fix240819; } // namespace ripple diff --git a/src/ripple/protocol/impl/Feature.cpp b/src/ripple/protocol/impl/Feature.cpp index 9cf82e316..e8769d977 100644 --- a/src/ripple/protocol/impl/Feature.cpp +++ b/src/ripple/protocol/impl/Feature.cpp @@ -464,6 +464,7 @@ REGISTER_FIX (fixXahauV2, Supported::yes, VoteBehavior::De REGISTER_FEATURE(Remit, Supported::yes, VoteBehavior::DefaultNo); REGISTER_FEATURE(ZeroB2M, Supported::yes, VoteBehavior::DefaultNo); REGISTER_FIX (fixNSDelete, Supported::yes, VoteBehavior::DefaultNo); +REGISTER_FIX (fix240819, Supported::yes, VoteBehavior::DefaultYes); // The following amendments are obsolete, but must remain supported // because they could potentially get enabled. diff --git a/src/ripple/server/impl/BaseWSPeer.h b/src/ripple/server/impl/BaseWSPeer.h index b2ba7dd65..688e0f693 100644 --- a/src/ripple/server/impl/BaseWSPeer.h +++ b/src/ripple/server/impl/BaseWSPeer.h @@ -256,6 +256,8 @@ BaseWSPeer::close( return post(strand_, [self = impl().shared_from_this(), reason] { self->close(reason); }); + if (do_close_) + return; do_close_ = true; if (wq_.empty()) {