@@ -231,7 +231,7 @@ struct assembled_block {
231
231
block_id_type id;
232
232
pending_block_header_state_legacy pending_block_header_state;
233
233
deque<transaction_metadata_ptr> trx_metas;
234
- mutable_signed_block_ptr unsigned_block;
234
+ mutable_block_ptr unsigned_block;
235
235
236
236
// if the unsigned_block pre-dates block-signing authorities this may be present.
237
237
std::optional<producer_authority_schedule> new_producer_authority_cache;
@@ -728,7 +728,7 @@ struct building_block {
728
728
}
729
729
730
730
// in dpos, we create a signed_block here. In IF mode, we do it later (when we are ready to sign it)
731
- auto block_ptr = std::make_shared<signed_block> (bb.pending_block_header_state.make_block_header(
731
+ auto block_ptr = signed_block::create_mutable_block (bb.pending_block_header_state.make_block_header(
732
732
transaction_mroot, action_mroot, bb.new_pending_producer_schedule, std::move(new_finalizer_policy),
733
733
vector<digest_type>(bb.new_protocol_feature_activations), pfs));
734
734
@@ -1567,20 +1567,8 @@ struct controller_impl {
1567
1567
return irreversible_mode() || bsp->is_valid();
1568
1568
};
1569
1569
1570
- using packed_block_future = std::future<std::vector<char>>;
1571
- std::vector<packed_block_future> v;
1572
- if (!irreversible_mode()) {
1573
- v.reserve( branch.size() );
1574
- for( auto bitr = branch.rbegin(); bitr != branch.rend() && should_process(*bitr); ++bitr ) {
1575
- v.emplace_back( post_async_task( thread_pool.get_executor(), [b=(*bitr)->block]() { return fc::raw::pack(*b); } ) );
1576
- }
1577
- }
1578
- auto it = v.begin();
1579
-
1580
1570
for( auto bitr = branch.rbegin(); bitr != branch.rend() && should_process(*bitr); ++bitr ) {
1581
- packed_block_future f;
1582
1571
if (irreversible_mode()) {
1583
- f = post_async_task( thread_pool.get_executor(), [b=(*bitr)->block]() { return fc::raw::pack(*b); } );
1584
1572
result = apply_irreversible_block(fork_db, *bitr);
1585
1573
if (result != controller::apply_blocks_result::complete)
1586
1574
break;
@@ -1590,7 +1578,7 @@ struct controller_impl {
1590
1578
1591
1579
// blog.append could fail due to failures like running out of space.
1592
1580
// Do it before commit so that in case it throws, DB can be rolled back.
1593
- blog.append( (*bitr)->block, (*bitr)->id(), irreversible_mode() ? f.get() : it++->get () );
1581
+ blog.append( (*bitr)->block, (*bitr)->id(), (*bitr)->block->packed_signed_block () );
1594
1582
1595
1583
db.commit( (*bitr)->block_num() );
1596
1584
root_id = (*bitr)->id();
@@ -1659,7 +1647,7 @@ struct controller_impl {
1659
1647
auto head = std::make_shared<block_state_legacy>();
1660
1648
static_cast<block_header_state_legacy&>(*head) = genheader;
1661
1649
head->activated_protocol_features = std::make_shared<protocol_feature_activation_set>(); // no activated protocol features in genesis
1662
- head->block = std::make_shared< signed_block> (genheader.header);
1650
+ head->block = signed_block::create_signed_block( signed_block::create_mutable_block (genheader.header) );
1663
1651
chain_head = block_handle{head};
1664
1652
1665
1653
db.set_revision( chain_head.block_num() );
@@ -5549,7 +5537,7 @@ signed_block_ptr controller::fetch_block_by_number( uint32_t block_num )const {
5549
5537
5550
5538
std::vector<char> controller::fetch_serialized_block_by_number( uint32_t block_num)const { try {
5551
5539
if (signed_block_ptr b = my->fork_db_fetch_block_on_best_branch_by_num(block_num)) {
5552
- return fc::raw::pack(*b );
5540
+ return b->packed_signed_block( );
5553
5541
}
5554
5542
5555
5543
return my->blog.read_serialized_block_by_num(block_num);
0 commit comments