Skip to content

Commit

Permalink
fix(inventory): persist blocks into storage using versioned hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
drcpu-github committed Nov 12, 2024
1 parent 36c1a6f commit 678b5d7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion node/src/actors/inventory_manager/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ use witnet_data_structures::{
chain::{
Block, Epoch, Hash, Hashable, InventoryEntry, InventoryItem, PointerToBlock, SuperBlock,
},
get_protocol_version,
proto::versioning::VersionedHashable,
transaction::Transaction,
};

Expand Down Expand Up @@ -42,7 +44,9 @@ impl InventoryManager {

match item {
StoreInventoryItem::Block(block) => {
let block_hash = block.hash();
let block_hash = block.versioned_hash(get_protocol_version(Some(
block.block_header.beacon.checkpoint,
)));
let key = match block_hash {
Hash::SHA256(h) => h.to_vec(),
};
Expand Down

0 comments on commit 678b5d7

Please # to comment.