mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
Do not reuse outpoint used in ongoing pending transactions (#6699)
This commit is contained in:
@@ -4,6 +4,8 @@ early_access: false
|
||||
enable_free_tier: true
|
||||
auto_resolve_threads: true
|
||||
reviews:
|
||||
summaries:
|
||||
include_walkthrough: false
|
||||
profile: chill
|
||||
request_changes_workflow: false
|
||||
high_level_summary: false
|
||||
|
||||
@@ -207,7 +207,7 @@ namespace BTCPayServer.Tests
|
||||
Assert.Equal("paid", invoice.Status);
|
||||
});
|
||||
var wallet = tester.PayTester.GetController<UIWalletsController>();
|
||||
var psbt = await wallet.CreatePSBT(btcNetwork, onchainBTC,
|
||||
var psbt = await wallet.CreatePSBT(storeId, btcNetwork, onchainBTC,
|
||||
new WalletSendModel()
|
||||
{
|
||||
Outputs = new List<WalletSendModel.TransactionOutput>
|
||||
|
||||
@@ -535,7 +535,7 @@ namespace BTCPayServer.Controllers.Greenfield
|
||||
CreatePSBTResponse psbt;
|
||||
try
|
||||
{
|
||||
psbt = await _walletsController.CreatePSBT(network, derivationScheme,
|
||||
psbt = await _walletsController.CreatePSBT(storeId, network, derivationScheme,
|
||||
new WalletSendModel()
|
||||
{
|
||||
SelectedInputs = request.SelectedInputs?.Select(point => point.ToString()),
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -1202,7 +1202,7 @@ namespace BTCPayServer.Controllers
|
||||
|
||||
try
|
||||
{
|
||||
psbtResponse = await CreatePSBT(network, derivationScheme, vm, cancellation);
|
||||
psbtResponse = await CreatePSBT(walletId.StoreId, network, derivationScheme, vm, cancellation);
|
||||
}
|
||||
catch (NBXplorerException ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user