-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
good first issueGood for newcomersGood for newcomers
Description
When you run the program in debug mode, create transactions and commit them into a block, you will get the following error:
thread 'main' panicked at 'attempt to subtract with overflow', src/handlers.rs:592:37
The faulty code at src/handlers.rs:592:37 is:
if let Some(from) = users_store.get_mut(source) {
from.balance -= transaction.amount - db.config.tx_traffic_reward;
}As @yigitsever suspected, this works correctly in release mode because these u32 values act like i32.
However, this is actually an undefined behavior. Hence it causes the error above in debug mode.
Although this requires some proficiency in Rust, I think it's a good first issue for beginners.
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomers