Closed dimxy closed 1 year ago
As I remember we are already discussed this case, to fix the issue, need to use one-line division instead of two divisions in succession, like change:
interest = Amount::<NonNegative>::try_from(numerator / denominator as u64).expect("div should be ok");
interest = (interest / COIN as u64).expect("div should be ok");
on
interest = Amount::<NonNegative>::try_from(numerator / denominator as u64 / COIN as u64).expect("div should be ok");
Could you plz make the following changes directly in your branch dimxy:dimxy-nn-hf
? Or I can do such PR into it by myself.
okay I will do myself
I fixed the issue almost immediately before I read your answer, so please close the PR if it is no longer needed.
added missed overflowing_mul in this commit too 7301d441c982320cc75f2e5585b4297ee64bd529
Crash when syncing PR #2 with mainnet The application panicked (crashed). Message: div should be ok: Constraint { value: 22252604240282685, range: 0..=20000000000000000 } Location: zebra-chain/src/interest.rs:109
this commit: 7ce0f2e482d641def26abeebbfb46f6cd184ac1e