Skip to content

Commit

Permalink
make slash resolve to treasury defensive
Browse files Browse the repository at this point in the history
  • Loading branch information
Ank4n committed Sep 19, 2024
1 parent 3ca1081 commit 7a16988
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions substrate/frame/treasury/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ use frame_support::{
dispatch::{DispatchResult, DispatchResultWithPostInfo},
ensure, print,
traits::{
fungible::Credit, tokens::Pay, Currency, ExistenceRequirement::KeepAlive, Get, Imbalance,
OnUnbalanced, ReservableCurrency, WithdrawReasons,
fungible::Credit, tokens::Pay, Currency, Defensive, ExistenceRequirement::KeepAlive, Get,
Imbalance, OnUnbalanced, ReservableCurrency, WithdrawReasons,
},
weights::Weight,
BoundedVec, PalletId,
Expand Down Expand Up @@ -995,8 +995,7 @@ impl<T: Config> OnUnbalanced<Credit<T::AccountId, T::Currency>> for FungibleComp
use frame_support::traits::fungible::Balanced;
let numeric_amount = credit.peek();

// can't do much if following errors since the calling function is infallible.
let _ = T::Currency::resolve(&Pallet::<T>::account_id(), credit);
let _ = T::Currency::resolve(&Pallet::<T>::account_id(), credit).defensive();

Pallet::<T>::deposit_event(Event::Deposit { value: numeric_amount });
}
Expand Down

0 comments on commit 7a16988

Please sign in to comment.