From b56d026fdb3d17877a6359c1e2c2904ef0c32e07 Mon Sep 17 00:00:00 2001 From: Kukks Date: Fri, 27 Mar 2020 14:58:01 +0100 Subject: [PATCH] small changes --- .../Payments/PayJoin/PayJoinEndpointController.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/BTCPayServer/Payments/PayJoin/PayJoinEndpointController.cs b/BTCPayServer/Payments/PayJoin/PayJoinEndpointController.cs index 0828bdb4a..6a9fdf118 100644 --- a/BTCPayServer/Payments/PayJoin/PayJoinEndpointController.cs +++ b/BTCPayServer/Payments/PayJoin/PayJoinEndpointController.cs @@ -76,7 +76,14 @@ namespace BTCPayServer.Payments.PayJoin if (psbt != null) { - transaction = psbt.ExtractTransaction(); + try + { + transaction = psbt.ExtractTransaction(); + } + catch (Exception e) + { + return UnprocessableEntity("invalid psbt"); + } } if (transaction.Check() != TransactionCheckResult.Success) @@ -109,9 +116,9 @@ namespace BTCPayServer.Payments.PayJoin var invoicePaymentMethod = matchingInvoice.GetPaymentMethod(paymentMethodId); //get outs to our current invoice address var currentPaymentMethodDetails = - invoicePaymentMethod.GetPaymentMethodDetails() as BitcoinLikeOnChainPaymentMethod; + (BitcoinLikeOnChainPaymentMethod) invoicePaymentMethod.GetPaymentMethodDetails(); - if (!currentPaymentMethodDetails.PayJoin.Enabled) + if (!currentPaymentMethodDetails.PayJoin?.Enabled is true) { return UnprocessableEntity($"cannot handle payjoin tx"); }