-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix transaction payment fee/tip unbalanceds #8860
Conversation
impl OnUnbalanced<pallet_balances::NegativeImbalance<Runtime>> for DealWithFees { | ||
fn on_unbalanceds<B>( | ||
mut fees_then_tips: impl Iterator<Item=pallet_balances::NegativeImbalance<Runtime>> | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we not make this "smarter", aka better.
trait OnUnbalanced<V, R> where R: IntoIterator<Item=V> {
fn on_unbalanceds<B>(whatever: R) {}
}
So we could have:
struct TransactionPayment {
pub fees,
pub tips,
}
Than we could in DealWithFees
directly use this struct? While others could still use the generic approach with the iterator?
Do you understand what I want to do? :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And R
would be TransactionPayment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, good idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
opened this issue https://github.com/paritytech/substrate/issues/8861
Merging for now since it's an important one. Can refactor in a second PR. |
* fix and test * fmt
Fix #8854
contrary to the doc, the on unbalanced handler is given the tip first and then the fee. This PR fix it, and test it.