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

Commit

Permalink
Fix serialization of transaction_receipt_v0 and signed_block to signe…
Browse files Browse the repository at this point in the history
…d_block_v0 format
  • Loading branch information
heifner committed Mar 31, 2020
1 parent c0934af commit 855d83b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion libraries/chain/include/eosio/chain/abi_serializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ namespace impl {
std::is_same<T, packed_transaction_v0>::value ||
std::is_same<T, packed_transaction>::value ||
std::is_same<T, transaction_trace>::value ||
std::is_same<T, transaction_receipt_v0>::value ||
std::is_same<T, transaction_receipt>::value ||
std::is_same<T, action_trace>::value ||
std::is_same<T, signed_transaction>::value ||
Expand Down Expand Up @@ -531,7 +532,7 @@ namespace impl {
{
// TODO: this could be faster by going directly to variant
auto sb_v0 = block.to_signed_block_v0();
add( out, name, sb_v0, std::move( resolver ), ctx );
add( out, name, *sb_v0, std::move( resolver ), ctx );
}

/**
Expand Down Expand Up @@ -745,6 +746,14 @@ namespace impl {
"Failed to deserialize data for ${account}:${name}", ("account", act.account)("name", act.name));
}

template<typename Resolver>
static void extract( const variant& v, signed_block& sb, Resolver resolver, abi_traverse_context& ctx )
{
signed_block_v0 v0;
extract( v, v0, std::move( resolver ), ctx );
sb = signed_block( v0, true );
}

template<typename Resolver>
static void extract( const variant& v, packed_transaction& ptrx, Resolver resolver, abi_traverse_context& ctx )
{
Expand Down
1 change: 1 addition & 0 deletions libraries/chain/include/eosio/chain/block.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ namespace eosio { namespace chain {
signed_block( const signed_block_v0&, bool legacy );
signed_block( signed_block&& ) = default;
signed_block& operator=(const signed_block&) = delete;
signed_block& operator=(signed_block&&) = default;
signed_block clone() const { return *this; }
signed_block_v0_ptr to_signed_block_v0() const;

Expand Down

0 comments on commit 855d83b

Please sign in to comment.