Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Commit

Permalink
Add assertions on fee collections
Browse files Browse the repository at this point in the history
  • Loading branch information
nazar-pc committed Dec 14, 2021
1 parent 1fa2132 commit 76818e3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions crates/pallet-transaction-fees/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,10 @@ where
// Issue storage fees reward.
let storage_fees_reward = storage_fees_escrow_reward + collected_storage_fees_reward;
if !storage_fees_reward.is_zero() {
let _ = T::Currency::deposit_into_existing(&block_author, storage_fees_reward);
T::Currency::deposit_into_existing(&block_author, storage_fees_reward).expect(
"Farmer account must have already received the block reward before fees are \
collected; qed",
);
Self::deposit_event(Event::<T>::StorageFeesReward {
who: block_author.clone(),
amount: storage_fees_reward,
Expand All @@ -235,7 +238,8 @@ where

// Issue compute fees reward.
if !collected_fees.compute.is_zero() {
let _ = T::Currency::deposit_into_existing(&block_author, collected_fees.compute);
T::Currency::deposit_into_existing(&block_author, collected_fees.compute)
.expect("Executor account must already exist before they execute the block; qed");
Self::deposit_event(Event::<T>::ComputeFeesReward {
who: block_author.clone(),
amount: collected_fees.compute,
Expand All @@ -244,7 +248,8 @@ where

// Issue tips reward.
if !collected_fees.tips.is_zero() {
let _ = T::Currency::deposit_into_existing(&block_author, collected_fees.tips);
T::Currency::deposit_into_existing(&block_author, collected_fees.tips)
.expect("Executor account must already exist before they execute the block; qed");
Self::deposit_event(Event::<T>::TipsReward {
who: block_author,
amount: collected_fees.tips,
Expand Down

0 comments on commit 76818e3

Please sign in to comment.