support both ChargeTransactionPayment and ChargeAssetTxPayment

This commit is contained in:
Tadeo hepperle
2023-10-24 13:50:01 +02:00
parent 0eabab9618
commit 58fd6543d6
2 changed files with 5 additions and 3 deletions
+5 -1
View File
@@ -668,7 +668,11 @@ impl<'a> ExtrinsicSignedExtensions<'a> {
/// The tip of an extrinsic, extracted from the ChargeTransactionPayment signed extension.
pub fn tip(&self) -> Option<u128> {
let tip = self.find("ChargeAssetTxPayment")?;
let tip = self
.find("ChargeTransactionPayment")
.or_else(|| self.find("ChargeAssetTxPayment"))?;
// Note: ChargeAssetTxPayment might have addition information in it (asset_id).
// But both should start with a compact encoded u128, so this decoding is fine.
let tip = Compact::<u128>::decode(&mut tip.bytes()).ok()?.0;
Some(tip)
}