Skip to content

Commit

Permalink
refactor(ledger): rename MerkleRootMeta.fromShred to fromFirstReceive…
Browse files Browse the repository at this point in the history
…dShred

This function assumes that the current shred is the first received shred. the function name should reflect that.
  • Loading branch information
dnut committed Sep 26, 2024
1 parent 7470f67 commit d6a9186
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/ledger/insert_shred.zig
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ pub const ShredInserter = struct {
self.metrics.num_inserted.inc();
const entry = try state.merkle_root_metas.getOrPut(erasure_set_id);
if (!entry.found_existing) {
entry.value_ptr.* = .{ .dirty = MerkleRootMeta.fromShred(shred) };
entry.value_ptr.* = .{ .dirty = MerkleRootMeta.fromFirstReceivedShred(shred) };
}
break :blk true;
} else |_| false;
Expand Down Expand Up @@ -687,7 +687,7 @@ pub const ShredInserter = struct {
);
const entry = try state.merkle_root_metas.getOrPut(erasure_set_id);
if (!entry.found_existing) {
entry.value_ptr.* = .{ .dirty = MerkleRootMeta.fromShred(shred) };
entry.value_ptr.* = .{ .dirty = MerkleRootMeta.fromFirstReceivedShred(shred) };
}
try state.just_inserted_shreds.put(shred.fields.id(), shred_union); // TODO check first?
index_meta_working_set_entry.did_insert_occur = true;
Expand Down
2 changes: 1 addition & 1 deletion src/ledger/meta.zig
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ pub const MerkleRootMeta = struct {
/// The shred type of the first received shred
first_received_shred_type: sig.ledger.shred.ShredType,

pub fn fromShred(shred: anytype) MerkleRootMeta {
pub fn fromFirstReceivedShred(shred: anytype) MerkleRootMeta {
comptime std.debug.assert(
@TypeOf(shred) == sig.ledger.shred.DataShred or
@TypeOf(shred) == sig.ledger.shred.CodeShred,
Expand Down

0 comments on commit d6a9186

Please sign in to comment.