Minor fixup in coinjoins (#6692)

This commit is contained in:
Nicolas Dorier
2025-04-23 17:39:49 +09:00
committed by GitHub
parent 5df76b9c00
commit 8e26845fa9
2 changed files with 6 additions and 9 deletions

View File

@@ -4,26 +4,21 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using BTCPayServer;
using BTCPayServer.Client.Models;
using BTCPayServer.Data;
using BTCPayServer.Events;
using BTCPayServer.HostedServices;
using BTCPayServer.Logging;
using BTCPayServer.Payments.PayJoin;
using BTCPayServer.Plugins.Altcoins;
using BTCPayServer.Services;
using BTCPayServer.Services.Invoices;
using BTCPayServer.Services.Wallets;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using NBitcoin;
using NBitcoin.Altcoins;
using NBitcoin.RPC;
using NBXplorer;
using NBXplorer.DerivationStrategy;
using NBXplorer.Models;
using Newtonsoft.Json.Linq;
namespace BTCPayServer.Payments.Bitcoin
{
@@ -259,7 +254,6 @@ namespace BTCPayServer.Payments.Bitcoin
.ToArray(), true);
bool? originalPJBroadcasted = null;
bool? originalPJBroadcastable = null;
bool cjPJBroadcasted = false;
PayjoinInformation payjoinInformation = null;
var paymentEntitiesByPrevOut = new Dictionary<OutPoint, PaymentEntity>();
foreach (var payment in invoice.GetPayments(false).Where(p => p.PaymentMethodId == pmi))
@@ -357,9 +351,10 @@ namespace BTCPayServer.Payments.Bitcoin
// If the origin tx of a payjoin has been broadcasted, then we know we can
// reuse our outpoint for another PJ
if (originalPJBroadcasted is true ||
// If the original tx is not broadcastable anymore and nor does the coinjoin
// reuse our outpoint for another PJ
(originalPJBroadcastable is false && !cjPJBroadcasted))
// If the original tx is not broadcastable anymore, we can just unlock the utxos
// If the PJ succeeded those outpoints won't be selected anymore.
// If the PJ didn't, then those endpoints are reusable.
originalPJBroadcastable is false)
{
await _utxoLocker.TryUnlock(payjoinInformation.ContributedOutPoints);
}

View File

@@ -1,5 +1,7 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LNURL/@EntryIndexedValue">LNURL</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NB/@EntryIndexedValue">NBX</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NBXplorer/@EntryIndexedValue">NBXplorer</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PSBT/@EntryIndexedValue">PSBT</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=TX/@EntryIndexedValue">TX</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=UI/@EntryIndexedValue">UI</s:String></wpf:ResourceDictionary>