Skip to content

Commit

Permalink
integrity hashes were not using the determinisitic snapshot row types…
Browse files Browse the repository at this point in the history
… which meant internal implementation differences were invalidating it for some types of rows
  • Loading branch information
b1bart committed Oct 17, 2018
1 parent 629a987 commit fe382c6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
5 changes: 3 additions & 2 deletions libraries/chain/authorization_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ namespace eosio { namespace chain {

void authorization_manager::calculate_integrity_hash( fc::sha256::encoder& enc ) const {
authorization_index_set::walk_indices([this, &enc]( auto utils ){
decltype(utils)::walk(_db, [&enc]( const auto &row ) {
fc::raw::pack(enc, row);
decltype(utils)::walk(_db, [this, &enc]( const auto &row ) {
using row_type = std::decay_t<decltype(row)>;
fc::raw::pack(enc, detail::snapshot_row_traits<row_type>::to_snapshot_row(row, _db));
});
});
}
Expand Down
10 changes: 6 additions & 4 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,9 @@ struct controller_impl {

auto tid_key = boost::make_tuple(table_row.id);
auto next_tid_key = boost::make_tuple(table_id_object::id_type(table_row.id._id + 1));
decltype(utils)::template walk_range<by_table_id>(db, tid_key, next_tid_key, [&enc](const auto& row){
fc::raw::pack(enc, row);
decltype(utils)::template walk_range<by_table_id>(db, tid_key, next_tid_key, [this, &enc](const auto& row){
using row_type = std::decay_t<decltype(row)>;
fc::raw::pack(enc, detail::snapshot_row_traits<row_type>::to_snapshot_row(row, db));
});
});
});
Expand Down Expand Up @@ -501,8 +502,9 @@ struct controller_impl {
return;
}

decltype(utils)::walk(db, [&enc]( const auto &row ) {
fc::raw::pack(enc, row);
decltype(utils)::walk(db, [this, &enc]( const auto &row ) {
using row_type = std::decay_t<decltype(row)>;
fc::raw::pack(enc, detail::snapshot_row_traits<row_type>::to_snapshot_row(row, db));
});
});

Expand Down
5 changes: 3 additions & 2 deletions libraries/chain/resource_limits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ void resource_limits_manager::initialize_database() {

void resource_limits_manager::calculate_integrity_hash( fc::sha256::encoder& enc ) const {
resource_index_set::walk_indices([this, &enc]( auto utils ){
decltype(utils)::walk(_db, [&enc]( const auto &row ) {
fc::raw::pack(enc, row);
decltype(utils)::walk(_db, [this, &enc]( const auto &row ) {
using row_type = std::decay_t<decltype(row)>;
fc::raw::pack(enc, detail::snapshot_row_traits<row_type>::to_snapshot_row(row, _db));
});
});
}
Expand Down

0 comments on commit fe382c6

Please sign in to comment.