diff --git a/xcm/pallet-xcm/src/lib.rs b/xcm/pallet-xcm/src/lib.rs index 16766b7ab90f..ba97bd21e446 100644 --- a/xcm/pallet-xcm/src/lib.rs +++ b/xcm/pallet-xcm/src/lib.rs @@ -1691,8 +1691,16 @@ impl xcm_executor::traits::Enact for UnlockTicket { locks.swap_remove(remove_index); } LockedFungibles::::insert(&self.sovereign_account, locks); - let reasons = WithdrawReasons::all(); - T::Currency::set_lock(*b"py/xcmlk", &self.sovereign_account, locked, reasons); + + // A locked value of zero means we do not have any outstanding locks anymore + // in the LockedFungibles storage for this sovereign account. + // We can then remove the `xcmlk` lock from this account. + if locked.is_zero() { + T::Currency::remove_lock(*b"py/xcmlk", &self.sovereign_account); + } else { + let reasons = WithdrawReasons::all(); + T::Currency::set_lock(*b"py/xcmlk", &self.sovereign_account, locked, reasons); + } Ok(()) } }