Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update transaction-payment #1021

Merged
merged 1 commit into from
May 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions modules/transaction-payment/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,11 @@ where
let tip = self.0;
let fee = Pallet::<T>::compute_fee(len as u32, info, tip);

// Only mess with balances if fee is not zero.
if fee.is_zero() {
return Ok((fee, None));
}

let reason = if tip.is_zero() {
WithdrawReasons::TRANSACTION_PAYMENT
} else {
Expand Down Expand Up @@ -758,12 +763,10 @@ where
// is gone in that case.
Err(_) => payed,
};
let imbalances = actual_payment.split(tip);
let (tip, fee) = actual_payment.split(tip);

// distribute fee
<T as Config>::OnTransactionPayment::on_unbalanceds(
Some(imbalances.0).into_iter().chain(Some(imbalances.1)),
);
<T as Config>::OnTransactionPayment::on_unbalanceds(Some(fee).into_iter().chain(Some(tip)));
}
Ok(())
}
Expand Down