Skip to content

Commit

Permalink
rm wrong assertion and swap out file write fn call (#292)
Browse files Browse the repository at this point in the history
  • Loading branch information
segfaultdoc authored Apr 5, 2023
1 parent b1d3934 commit 9b08b00
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
5 changes: 0 additions & 5 deletions tip-distributor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,6 @@ impl TreeNode {
.collect::<Result<Vec<TreeNode>, MerkleRootGeneratorError>>()?,
);

let total_claim_amount = tree_nodes.iter().fold(0u64, |sum, tree_node| {
sum.checked_add(tree_node.amount).unwrap()
});
assert!(total_claim_amount < stake_meta.total_delegated);

Ok(Some(tree_nodes))
} else {
Ok(None)
Expand Down
2 changes: 1 addition & 1 deletion tip-distributor/src/merkle_root_generator_workflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fn write_to_json_file(
let file = File::create(file_path)?;
let mut writer = BufWriter::new(file);
let json = serde_json::to_string_pretty(&merkle_tree_coll).unwrap();
let _ = writer.write(json.as_bytes())?;
let _ = writer.write_all(json.as_bytes())?;
writer.flush()?;

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion tip-distributor/src/stake_meta_generator_workflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ fn write_to_json_file(
let file = File::create(out_path)?;
let mut writer = BufWriter::new(file);
let json = serde_json::to_string_pretty(&stake_meta_coll).unwrap();
let _ = writer.write(json.as_bytes())?;
let _ = writer.write_all(json.as_bytes())?;
writer.flush()?;

Ok(())
Expand Down

0 comments on commit 9b08b00

Please sign in to comment.