Skip to content

Commit

Permalink
GH-8 Shortcut out on id > extension_id
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Apr 23, 2024
1 parent 484d40e commit 914f117
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libraries/chain/block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,16 @@ namespace eosio::chain {
return results;
}

// Does not validate ordering, assumes validate_and_extract_extensions() has been called in verify_qc_claim()
std::optional<block_extension> signed_block::extract_extension(uint16_t extension_id)const {
using decompose_t = block_extension_types::decompose_t;

for( size_t i = 0; i < block_extensions.size(); ++i ) {
const auto& e = block_extensions[i];
auto id = e.first;

if (id > extension_id)
break;
if (id != extension_id)
continue;

Expand Down
3 changes: 3 additions & 0 deletions libraries/chain/block_header.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,16 @@ namespace eosio { namespace chain {
return results;
}

// Does not validate ordering, assumes validate_and_extract_header_extensions() has been called in block_state creation
std::optional<block_header_extension> block_header::extract_header_extension(uint16_t extension_id)const {
using decompose_t = block_header_extension_types::decompose_t;

for( size_t i = 0; i < header_extensions.size(); ++i ) {
const auto& e = header_extensions[i];
auto id = e.first;

if (id > extension_id)
break;
if (id != extension_id)
continue;

Expand Down

0 comments on commit 914f117

Please sign in to comment.