Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
state history plugin: permission_object bug #6495
Browse files Browse the repository at this point in the history
  • Loading branch information
tbfleming committed Dec 17, 2018
1 parent 147cdb9 commit 04655aa
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,20 @@ datastream<ST>& operator<<(datastream<ST>& ds, const history_serial_wrapper<eosi
fc::raw::pack(ds, fc::unsigned_int(0));
fc::raw::pack(ds, as_type<uint64_t>(obj.obj.owner.value));
fc::raw::pack(ds, as_type<uint64_t>(obj.obj.name.value));
if (obj.obj.parent._id)
fc::raw::pack(ds, as_type<uint64_t>(obj.db.get<eosio::chain::permission_object>(obj.obj.parent).name.value));
else
if (obj.obj.parent._id) {
auto& index = obj.db.get_index<eosio::chain::permission_index>();
const auto* parent = index.find(obj.obj.parent);
if (!parent) {
auto& undo = index.stack().back();
auto it = undo.removed_values.find(obj.obj.parent);
EOS_ASSERT(it != undo.removed_values.end(), eosio::chain::plugin_exception,
"can not find parent of permission_object");
parent = &it->second;
}
fc::raw::pack(ds, as_type<uint64_t>(parent->name.value));
} else {
fc::raw::pack(ds, as_type<uint64_t>(0));
}
fc::raw::pack(ds, as_type<fc::time_point>(obj.obj.last_updated));
fc::raw::pack(ds, make_history_serial_wrapper(obj.db, as_type<eosio::chain::shared_authority>(obj.obj.auth)));
return ds;
Expand Down

0 comments on commit 04655aa

Please sign in to comment.