Skip to content

Commit

Permalink
Rename RuneID fields (#3310)
Browse files Browse the repository at this point in the history
  • Loading branch information
casey committed Mar 18, 2024
1 parent 55c6094 commit 17ed330
Show file tree
Hide file tree
Showing 13 changed files with 247 additions and 326 deletions.
23 changes: 5 additions & 18 deletions src/index/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,12 @@ pub(super) type RuneIdValue = (u32, u16);
impl Entry for RuneId {
type Value = RuneIdValue;

fn load((height, index): Self::Value) -> Self {
Self { height, index }
fn load((block, tx): Self::Value) -> Self {
Self { block, tx }
}

fn store(self) -> Self::Value {
(self.height, self.index)
(self.block, self.tx)
}
}

Expand Down Expand Up @@ -554,22 +554,9 @@ mod tests {

#[test]
fn rune_id_entry() {
assert_eq!(
RuneId {
height: 1,
index: 2,
}
.store(),
(1, 2),
);
assert_eq!(RuneId { block: 1, tx: 2 }.store(), (1, 2),);

assert_eq!(
RuneId {
height: 1,
index: 2,
},
RuneId::load((1, 2)),
);
assert_eq!(RuneId { block: 1, tx: 2 }, RuneId::load((1, 2)),);
}

#[test]
Expand Down
4 changes: 2 additions & 2 deletions src/index/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ impl Context {
(
txid,
RuneId {
height: u32::try_from(block_count + usize::try_from(RUNE_COMMIT_INTERVAL).unwrap() + 1)
block: u32::try_from(block_count + usize::try_from(RUNE_COMMIT_INTERVAL).unwrap() + 1)
.unwrap(),
index: 1,
tx: 1,
},
)
}
Expand Down
Loading

0 comments on commit 17ed330

Please sign in to comment.