Skip to content

Commit 678b5d7

Browse files
committed
fix(inventory): persist blocks into storage using versioned hashes
1 parent 36c1a6f commit 678b5d7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

node/src/actors/inventory_manager/handlers.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ use witnet_data_structures::{
44
chain::{
55
Block, Epoch, Hash, Hashable, InventoryEntry, InventoryItem, PointerToBlock, SuperBlock,
66
},
7+
get_protocol_version,
8+
proto::versioning::VersionedHashable,
79
transaction::Transaction,
810
};
911

@@ -42,7 +44,9 @@ impl InventoryManager {
4244

4345
match item {
4446
StoreInventoryItem::Block(block) => {
45-
let block_hash = block.hash();
47+
let block_hash = block.versioned_hash(get_protocol_version(Some(
48+
block.block_header.beacon.checkpoint,
49+
)));
4650
let key = match block_hash {
4751
Hash::SHA256(h) => h.to_vec(),
4852
};

0 commit comments

Comments
 (0)