diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/handlers.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/handlers.rs b/src/handlers.rs index 23adffb..e31a4ad 100644 --- a/src/handlers.rs +++ b/src/handlers.rs | |||
@@ -548,11 +548,11 @@ pub async fn propose_block( | |||
548 | let mut users_store = RwLockUpgradableReadGuard::upgrade(users_store); | 548 | let mut users_store = RwLockUpgradableReadGuard::upgrade(users_store); |
549 | 549 | ||
550 | // Reward the block proposer | 550 | // Reward the block proposer |
551 | let coinbase_fingerprint = new_block.transaction_list.get(0).unwrap(); | 551 | // All unwrap calls here are guaranteed to succeed because they are already checked above |
552 | 552 | // See: internal_user_fingerprint, internal_user | |
553 | if let Some(coinbase_user) = users_store.get_mut(coinbase_fingerprint) { | 553 | let coinbase = pending_transactions.get(&new_block.transaction_list[0]).unwrap(); |
554 | coinbase_user.balance += BLOCK_REWARD; | 554 | let mut coinbase_user = users_store.get_mut(&coinbase.source).unwrap(); |
555 | } | 555 | coinbase_user.balance += BLOCK_REWARD; |
556 | 556 | ||
557 | let mut holding: HashMap<String, Transaction> = HashMap::new(); | 557 | let mut holding: HashMap<String, Transaction> = HashMap::new(); |
558 | 558 | ||