Skip to content

Commit a9a6288

Browse files
committed
minor enhancement
1 parent 99798b0 commit a9a6288

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ pub fn extract_shard_metadata(
2525
if let Some(fiv) = shard.file(i) {
2626
let file_dict = PyDict::new(py);
2727
let h: MerkleHash = fiv.file_hash();
28-
file_dict.set_item("file_hash", PyBytes::new(py, h.as_bytes()))?;
28+
file_dict.set_item("file_hash", h.hex())?;
2929

3030
let segments = PyList::empty(py);
3131
for j in 0..fiv.num_entries() {
3232
let seg = fiv.entry(j);
3333
let seg_dict = PyDict::new(py);
3434
let xh: MerkleHash = seg.xorb_hash;
35-
seg_dict.set_item("h", PyBytes::new(py, xh.as_bytes()))?;
35+
seg_dict.set_item("h", xh.hex())?;
3636
seg_dict.set_item("s", seg.chunk_index_start)?;
3737
seg_dict.set_item("e", seg.chunk_index_end)?;
3838
seg_dict.set_item("l", seg.unpacked_segment_bytes)?;
@@ -52,7 +52,7 @@ pub fn extract_shard_metadata(
5252
if let Some(xiv) = shard.xorb(i) {
5353
let xorb_dict = PyDict::new(py);
5454
let xh: MerkleHash = xiv.xorb_hash();
55-
xorb_dict.set_item("xorb_hash", PyBytes::new(py, xh.as_bytes()))?;
55+
xorb_dict.set_item("xorb_hash", xh.hex())?;
5656

5757
let layout = PyList::empty(py);
5858
for j in 0..xiv.num_entries() {
@@ -80,7 +80,7 @@ pub fn extract_shard_metadata(
8080
let chunk_list = PyList::empty(py);
8181
for hash in eligible_chunks {
8282
let ch: MerkleHash = hash;
83-
chunk_list.append(PyBytes::new(py, ch.as_bytes()))?;
83+
chunk_list.append(ch.hex())?;
8484
}
8585
root_dict.set_item("eligible_chunks", chunk_list)?;
8686

0 commit comments

Comments
 (0)