mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-01-31 11:54:24 +01:00
Fix potential migration crashes
This commit is contained in:
@@ -142,6 +142,7 @@ namespace BTCPayServer.Data
|
||||
"LightningLike" or "LightningNetwork" => $"{cryptoCode}-LN",
|
||||
"LNURLPAY" => $"{cryptoCode}-LNURL",
|
||||
"EthereumLike" => $"{cryptoCode}-LEGACY",
|
||||
"CHAIN" or "LNURL" or "LN" => paymentMethodId,
|
||||
_ => throw new NotSupportedException("Unknown payment type " + paymentType)
|
||||
};
|
||||
}
|
||||
@@ -159,6 +160,7 @@ namespace BTCPayServer.Data
|
||||
"BTCLike" or "MoneroLike" or "ZcashLike" => $"{cryptoCode}-CHAIN",
|
||||
"LightningLike" or "LightningNetwork" => $"{cryptoCode}-LN",
|
||||
"LNURLPAY" => $"{cryptoCode}-LNURL",
|
||||
"EthereumLike" => $"{cryptoCode}-LEGACY",
|
||||
_ => paymentMethodId
|
||||
};
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class InvoiceBlobMigratorHostedService : BlobMigratorHostedService<Invoic
|
||||
}
|
||||
pay.SetBlob(paymentEntity);
|
||||
|
||||
if (pay.PaymentMethodId != pay.MigratedPaymentMethodId)
|
||||
if (pay.MigratedPaymentMethodId is not null && pay.PaymentMethodId != pay.MigratedPaymentMethodId)
|
||||
{
|
||||
ctx.Add(pay);
|
||||
ctx.Payments.Remove(new PaymentData() { Id = pay.Id, PaymentMethodId = pay.MigratedPaymentMethodId });
|
||||
|
||||
Reference in New Issue
Block a user