From 145215d4ab0383fac0323aa3229ec9196bbffd76 Mon Sep 17 00:00:00 2001 From: Ed Hennis Date: Wed, 19 Mar 2025 21:04:01 -0400 Subject: [PATCH] Fix bug in new invariant --- src/xrpld/app/tx/detail/InvariantCheck.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/xrpld/app/tx/detail/InvariantCheck.cpp b/src/xrpld/app/tx/detail/InvariantCheck.cpp index 4598cf4b0a..a451705a27 100644 --- a/src/xrpld/app/tx/detail/InvariantCheck.cpp +++ b/src/xrpld/app/tx/detail/InvariantCheck.cpp @@ -1602,12 +1602,13 @@ NoModifiedUnmodifiableFields::finalize( ReadView const& view, beast::Journal const& j) { - static auto const fieldChanged = [](auto const& before, - auto const& after, - auto const& field) { - return before->isFieldPresent(field) != after->isFieldPresent(field) || - before->at(field) != after->at(field); - }; + static auto const fieldChanged = + [](auto const& before, auto const& after, auto const& field) { + bool const beforeField = before->isFieldPresent(field); + bool const afterField = after->isFieldPresent(field); + return beforeField != afterField || + (afterField && before->at(field) != after->at(field)); + }; for (auto const& slePair : changedEntries_) { auto const& before = slePair.first;