Skip to content

Commit

Permalink
Merge pull request #2297 from sisuresh/disable_inflation
Browse files Browse the repository at this point in the history
disable inflation

Reviewed-by: MonsieurNicolas
  • Loading branch information
latobarita committed Sep 30, 2019
2 parents 8d16810 + 4699e73 commit de0b21c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
6 changes: 6 additions & 0 deletions src/transactions/InflationOpFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ InflationOpFrame::doCheckValid(uint32_t ledgerVersion)
return true;
}

bool
InflationOpFrame::isVersionSupported(uint32_t protocolVersion) const
{
return protocolVersion < 12;
}

ThresholdLevel
InflationOpFrame::getThresholdLevel() const
{
Expand Down
1 change: 1 addition & 0 deletions src/transactions/InflationOpFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class InflationOpFrame : public OperationFrame

bool doApply(AbstractLedgerTxn& ltx) override;
bool doCheckValid(uint32_t ledgerVersion) override;
bool isVersionSupported(uint32_t protocolVersion) const override;

static InflationResultCode
getInnerCode(OperationResult const& res)
Expand Down
23 changes: 14 additions & 9 deletions src/transactions/test/InflationTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ TEST_CASE("inflation", "[tx][inflation]")

SECTION("not time")
{
for_all_versions(*app, [&] {
for_versions_to(11, *app, [&] {
closeLedgerOn(*app, 2, 30, 6, 2014);
REQUIRE_THROWS_AS(root.inflation(), ex_INFLATION_NOT_TIME);

Expand Down Expand Up @@ -433,7 +433,7 @@ TEST_CASE("inflation", "[tx][inflation]")
getTotalCoins() + inflationError);
});

for_versions_from(8, *app, [&] {
for_versions(8, 11, *app, [&] {
closeLedgerOn(*app, 4, 21, 7, 2014, {inflationTx});

REQUIRE(getFeePool() == 95361000000301);
Expand Down Expand Up @@ -467,7 +467,7 @@ TEST_CASE("inflation", "[tx][inflation]")

SECTION("inflation scenarios")
{
for_all_versions(*app, [&] {
for_versions_to(11, *app, [&] {
std::function<int(int)> voteFunc;
std::function<int64(int)> balanceFunc;
int nbAccounts = 0;
Expand Down Expand Up @@ -607,24 +607,22 @@ TEST_CASE("inflation", "[tx][inflation]")
{
for_versions_to(9, *app,
[&] { inflationWithLiabilities(0, maxPayout); });
for_versions_from(10, *app,
[&] { inflationWithLiabilities(0, 0); });
for_versions(10, 11, *app, [&] { inflationWithLiabilities(0, 0); });
}

SECTION("small available balance less than payout")
{
for_versions_to(9, *app,
[&] { inflationWithLiabilities(1, maxPayout); });
for_versions_from(10, *app,
[&] { inflationWithLiabilities(1, 1); });
for_versions(10, 11, *app, [&] { inflationWithLiabilities(1, 1); });
}

SECTION("large available balance less than payout")
{
for_versions_to(9, *app, [&] {
inflationWithLiabilities(maxPayout - 1, maxPayout);
});
for_versions_from(10, *app, [&] {
for_versions(10, 11, *app, [&] {
inflationWithLiabilities(maxPayout - 1, maxPayout - 1);
});
}
Expand All @@ -634,9 +632,16 @@ TEST_CASE("inflation", "[tx][inflation]")
for_versions_to(9, *app, [&] {
inflationWithLiabilities(maxPayout + 1, maxPayout);
});
for_versions_from(10, *app, [&] {
for_versions(10, 11, *app, [&] {
inflationWithLiabilities(maxPayout + 1, maxPayout);
});
}
}

SECTION("not supported")
{
for_versions_from(12, *app, [&] {
REQUIRE_THROWS_AS(root.inflation(), ex_opNOT_SUPPORTED);
});
}
}

0 comments on commit de0b21c

Please sign in to comment.