distribute_rent_to_validators checked_add_lamports unwrap (#16847)
* distribute_rent_to_validators checked_add_lamports unwrap * make rent disappear on add failure * add pubkey to message * update message text * don't store account that we failed to transfer to * format
This commit is contained in:
parent
763c04adf3
commit
01308cd890
|
@ -3374,7 +3374,18 @@ impl Bank {
|
||||||
let mut account = self
|
let mut account = self
|
||||||
.get_account_with_fixed_root(&pubkey)
|
.get_account_with_fixed_root(&pubkey)
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
account.lamports += rent_to_be_paid;
|
if account.checked_add_lamports(rent_to_be_paid).is_err() {
|
||||||
|
// overflow adding lamports
|
||||||
|
self.capitalization.fetch_sub(rent_to_be_paid, Relaxed);
|
||||||
|
error!(
|
||||||
|
"Burned {} rent lamports instead of sending to {}",
|
||||||
|
rent_to_be_paid, pubkey
|
||||||
|
);
|
||||||
|
inc_new_counter_error!(
|
||||||
|
"bank-burned_rent_lamports",
|
||||||
|
rent_to_be_paid as usize
|
||||||
|
);
|
||||||
|
} else {
|
||||||
self.store_account(&pubkey, &account);
|
self.store_account(&pubkey, &account);
|
||||||
rewards.push((
|
rewards.push((
|
||||||
pubkey,
|
pubkey,
|
||||||
|
@ -3385,6 +3396,7 @@ impl Bank {
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
self.rewards.write().unwrap().append(&mut rewards);
|
self.rewards.write().unwrap().append(&mut rewards);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue