Skip to content

Commit 6156ddd

Browse files
committed
Improved docs of withdraw_txfee
1 parent bf636fe commit 6156ddd

File tree

1 file changed

+5
-3
lines changed
  • substrate/frame/transaction-payment/src

1 file changed

+5
-3
lines changed

substrate/frame/transaction-payment/src/lib.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -711,9 +711,11 @@ impl<T: Config> Pallet<T> {
711711
/// # Warning
712712
///
713713
/// This is only useful if a pallet knows that the pre-dispatch weight was vastly
714-
/// overestimated. Drawing too much balance will cause the signer to underpay for the
715-
/// transaction. Too much means that not enough is left to pay for the fee with regard
716-
/// to the post dispatch weight.
714+
/// overestimated. Pallets need to make sure to leave enough balance to pay for the
715+
/// transaction fees. They can do that by first drawing as much as they need and then
716+
/// at the end of the transaction (when they know the post dispatch fee) return an error
717+
/// in case not enough is left. The error will automatically roll back all the storage
718+
/// changes done by the pallet including the balance drawn by calling this function.
717719
pub fn withdraw_txfee<Balance>(amount: Balance) -> Option<CreditOf<T>>
718720
where
719721
CreditOf<T>: Imbalance<Balance>,

0 commit comments

Comments
 (0)