We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 558b538 commit 4a9f247Copy full SHA for 4a9f247
asset-registry/src/lib.rs
@@ -248,7 +248,12 @@ impl<W: WeightToFeeConverter, R: TakeRevenue> WeightTrader for AssetRegistryTrad
248
249
if let Some(amount) = W::convert_weight_to_fee(location, new_weight) {
250
let fee_increase = amount.saturating_sub(existing_fee);
251
- if let Ok(unused) = payment.clone().checked_sub((asset.clone(), fee_increase).into()) {
+ if fee_increase == 0 {
252
+ // if the fee is set very low it lead to zero fees, in which case constructing
253
+ // the fee asset item to subtract from payment would fail. Therefore, provide
254
+ // early exit
255
+ return Ok(payment);
256
+ } else if let Ok(unused) = payment.clone().checked_sub((asset.clone(), fee_increase).into()) {
257
self.bought_weight = Some(BoughtWeight {
258
amount,
259
weight: new_weight,
0 commit comments