Skip to content

Commit

Permalink
Fix siblings formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
EvgenKor committed Dec 19, 2022
1 parent b06df58 commit f6b7da0
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions libzkbob-rs-node/src/merkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,20 +249,13 @@ pub fn merkle_get_left_siblings(mut cx: FunctionContext) -> JsResult<JsValue> {
let result: Result<Vec<String>, String> = val
.into_iter()
.map(|node| {
let height = format!("{:#04x}", node.height);
let index = format!("{:#014x}", node.index);

let mut node_bytes = vec![];
node.value.serialize(&mut node_bytes).unwrap();
node_bytes.reverse();
let node_string = hex::encode(node_bytes);


let res = format!("{}{}{}",
height.strip_prefix("0x").unwrap_or(&height),
index.strip_prefix("0x").unwrap_or(&index),
node_string
);
let res = format!("{:02x}{:012x}{}", node.height, node.index, node_string);

if res.len() != 78 {
return Err(format!("Internal error (sibling length {} is invalid)", res.len()));
Expand Down

0 comments on commit f6b7da0

Please sign in to comment.