Do not reuse outpoint used in ongoing pending transactions (#6699)

This commit is contained in:
Nicolas Dorier
2025-04-28 16:17:23 +09:00
committed by GitHub
parent ee83769a7b
commit 41e1eb1be2
5 changed files with 13 additions and 4 deletions

View File

@@ -24,7 +24,12 @@ namespace BTCPayServer.Controllers
public partial class UIWalletsController
{
[NonAction]
public async Task<CreatePSBTResponse> CreatePSBT(BTCPayNetwork network, DerivationSchemeSettings derivationSettings, WalletSendModel sendModel, CancellationToken cancellationToken)
[Obsolete("Use CreatePSBT(string storeId, BTCPayNetwork network, DerivationSchemeSettings derivationSettings, WalletSendModel sendModel, CancellationToken cancellationToken) instead")]
public Task<CreatePSBTResponse> CreatePSBT(BTCPayNetwork network, DerivationSchemeSettings derivationSettings, WalletSendModel sendModel,
CancellationToken cancellationToken)
=> CreatePSBT(null, network, derivationSettings, sendModel, cancellationToken);
[NonAction]
public async Task<CreatePSBTResponse> CreatePSBT(string storeId, BTCPayNetwork network, DerivationSchemeSettings derivationSettings, WalletSendModel sendModel, CancellationToken cancellationToken)
{
var nbx = ExplorerClientProvider.GetExplorerClient(network);
var psbtRequest = new CreatePSBTRequest()
@@ -46,6 +51,8 @@ namespace BTCPayServer.Controllers
psbtDestination.SubstractFees = transactionOutput.SubtractFeesFromOutput;
}
var pending = await _pendingTransactionService.GetPendingTransactions(network.CryptoCode, storeId ?? "");
psbtRequest.ExcludeOutpoints = pending.SelectMany(p => p.OutpointsUsed).Select(OutPoint.Parse).ToList();
psbtRequest.FeePreference = new FeePreference();
if (sendModel.FeeSatoshiPerByte is decimal v and > decimal.Zero)
{