Skip to content

Commit

Permalink
Merge pull request #644 from eosnetworkfoundation/backport_pop_a_delta
Browse files Browse the repository at this point in the history
[3.2] Backport: pop a delta with empty rows
  • Loading branch information
ndcgundlach authored Jul 12, 2022
2 parents 3a80532 + d3905d5 commit 79ca9d7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libraries/state_history/create_deltas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ std::vector<table_delta> create_deltas(const chainbase::database& db, bool full_
for (auto& row : undo.new_values) {
delta.rows.obj.emplace_back(true, pack_row(row));
}

if(delta.rows.obj.empty()) {
deltas.pop_back();
}
}
};

Expand Down
10 changes: 10 additions & 0 deletions unittests/state_history_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ class table_deltas_tester : public tester {
deltas_vector v;
};

BOOST_AUTO_TEST_CASE(test_deltas_not_empty) {
table_deltas_tester chain;

auto deltas = eosio::state_history::create_deltas(chain.control->db(), false);

for(const auto &delta: deltas) {
BOOST_REQUIRE(!delta.rows.obj.empty());
}
}

BOOST_AUTO_TEST_CASE(test_deltas_account_creation) {
table_deltas_tester chain;
chain.produce_block();
Expand Down

0 comments on commit 79ca9d7

Please sign in to comment.