Skip to content

Commit 46fb6e4

Browse files
authored
Fix feePool upgrade logic past p24 (#4984)
# Description The fee pool upgrade should only be applied for p24. <!--- Describe what this pull request does, which issue it's resolving (usually applicable for code changes). ---> # Checklist - [ ] Reviewed the [contributing](https://github.com/stellar/stellar-core/blob/master/CONTRIBUTING.md#submitting-changes) document - [ ] Rebased on top of master (no merge commits) - [ ] Ran `clang-format` v8.0.0 (via `make format` or the Visual Studio extension) - [ ] Compiles - [ ] Ran all tests - [ ] If change impacts performance, include supporting evidence per the [performance document](https://github.com/stellar/stellar-core/blob/master/performance-eval/performance-eval.md)
2 parents 720aff0 + 330e947 commit 46fb6e4

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/herder/Upgrades.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1240,7 +1240,8 @@ Upgrades::applyVersionUpgrade(Application& app, AbstractLedgerTxn& ltx,
12401240
ltx);
12411241
}
12421242

1243-
if (protocolVersionStartsFrom(newVersion, ProtocolVersion::V_24) &&
1243+
if (protocolVersionEquals(prevVersion, ProtocolVersion::V_23) &&
1244+
protocolVersionEquals(newVersion, ProtocolVersion::V_24) &&
12441245
gIsProductionNetwork)
12451246
{
12461247
auto header = ltx.loadHeader();

src/herder/test/UpgradesTests.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2691,7 +2691,8 @@ TEST_CASE("upgrade to version 12", "[upgrades][acceptance]")
26912691
}
26922692
}
26932693

2694-
TEST_CASE("upgrade to version 24 and check feePool", "[upgrades]")
2694+
TEST_CASE("upgrade to 24 and then latest from 23 and check feePool",
2695+
"[upgrades]")
26952696
{
26962697
VirtualClock clock;
26972698
auto cfg = getTestConfig();
@@ -2708,7 +2709,13 @@ TEST_CASE("upgrade to version 24 and check feePool", "[upgrades]")
27082709
auto p23feePool = lm.getLastClosedLedgerHeader().header.feePool;
27092710

27102711
executeUpgrade(*app, makeProtocolVersionUpgrade(24));
2712+
REQUIRE(lm.getLastClosedLedgerHeader().header.feePool ==
2713+
p23feePool + 31879035);
2714+
2715+
executeUpgrade(*app, makeProtocolVersionUpgrade(
2716+
Config::CURRENT_LEDGER_PROTOCOL_VERSION));
27112717

2718+
// No change
27122719
REQUIRE(lm.getLastClosedLedgerHeader().header.feePool ==
27132720
p23feePool + 31879035);
27142721
}

0 commit comments

Comments
 (0)