Skip to content

Commit

Permalink
Add completed_block construction for IF mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
greg7mdp committed Jan 13, 2024
1 parent 71cf33c commit 8934a42
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
19 changes: 6 additions & 13 deletions libraries/chain/block_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,13 @@ block_state::block_state(const block_header_state& prev, signed_block_ptr b, con
, block(std::move(b))
{}

#if 0
block_state::block_state(pending_block_header_state&& cur,
signed_block_ptr&& b,
deque<transaction_metadata_ptr>&& trx_metas,
const protocol_feature_set& pfs,
const validator_t& validator,
const signer_callback_type& signer
)
:block_header_state( inject_additional_signatures( std::move(cur), *b, pfs, validator, signer ) )
,block( std::move(b) )
,_pub_keys_recovered( true ) // called by produce_block so signature recovery of trxs must have been done
,cached_trxs( std::move(trx_metas) )
block_state::block_state(const block_header_state& bhs, deque<transaction_metadata_ptr>&& trx_metas,
deque<transaction_receipt>&& trx_receipts)
: block_header_state(bhs)
, block(std::make_shared<signed_block>(signed_block_header{bhs.header})) // [greg todo] do we need signatures?
, pub_keys_recovered(true) // probably not needed
, cached_trxs(std::move(trx_metas))
{}
#endif

deque<transaction_metadata_ptr> block_state::extract_trxs_metas() {
pub_keys_recovered = false;
Expand Down
4 changes: 3 additions & 1 deletion libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,9 @@ struct assembled_block {
return completed_block{std::move(bsp)};
},
[&](assembled_block_if& ab) {
return completed_block{}; /* [greg todo] */
auto bsp = std::make_shared<block_state>(ab.bhs, std::move(ab.trx_metas),
std::move(ab.trx_receipts));
return completed_block{std::move(bsp)};
}},
v);
}
Expand Down
3 changes: 3 additions & 0 deletions libraries/chain/include/eosio/chain/block_state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ struct block_state : public block_header_state { // block_header_state provi

block_state(const block_header_state& prev, signed_block_ptr b, const protocol_feature_set& pfs,
const validator_t& validator, bool skip_validate_signee);

block_state(const block_header_state& bhs, deque<transaction_metadata_ptr>&& trx_metas,
deque<transaction_receipt>&& trx_receipts);
};

using block_state_ptr = std::shared_ptr<block_state>;
Expand Down

0 comments on commit 8934a42

Please sign in to comment.