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
|
enable_free_tier: true
|
||||||
auto_resolve_threads: true
|
auto_resolve_threads: true
|
||||||
reviews:
|
reviews:
|
||||||
|
summaries:
|
||||||
|
include_walkthrough: false
|
||||||
profile: chill
|
profile: chill
|
||||||
request_changes_workflow: false
|
request_changes_workflow: false
|
||||||
high_level_summary: false
|
high_level_summary: false
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ namespace BTCPayServer.Tests
|
|||||||
Assert.Equal("paid", invoice.Status);
|
Assert.Equal("paid", invoice.Status);
|
||||||
});
|
});
|
||||||
var wallet = tester.PayTester.GetController<UIWalletsController>();
|
var wallet = tester.PayTester.GetController<UIWalletsController>();
|
||||||
var psbt = await wallet.CreatePSBT(btcNetwork, onchainBTC,
|
var psbt = await wallet.CreatePSBT(storeId, btcNetwork, onchainBTC,
|
||||||
new WalletSendModel()
|
new WalletSendModel()
|
||||||
{
|
{
|
||||||
Outputs = new List<WalletSendModel.TransactionOutput>
|
Outputs = new List<WalletSendModel.TransactionOutput>
|
||||||
|
|||||||
@@ -535,7 +535,7 @@ namespace BTCPayServer.Controllers.Greenfield
|
|||||||
CreatePSBTResponse psbt;
|
CreatePSBTResponse psbt;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
psbt = await _walletsController.CreatePSBT(network, derivationScheme,
|
psbt = await _walletsController.CreatePSBT(storeId, network, derivationScheme,
|
||||||
new WalletSendModel()
|
new WalletSendModel()
|
||||||
{
|
{
|
||||||
SelectedInputs = request.SelectedInputs?.Select(point => point.ToString()),
|
SelectedInputs = request.SelectedInputs?.Select(point => point.ToString()),
|
||||||
|
|||||||
@@ -24,7 +24,12 @@ namespace BTCPayServer.Controllers
|
|||||||
public partial class UIWalletsController
|
public partial class UIWalletsController
|
||||||
{
|
{
|
||||||
[NonAction]
|
[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 nbx = ExplorerClientProvider.GetExplorerClient(network);
|
||||||
var psbtRequest = new CreatePSBTRequest()
|
var psbtRequest = new CreatePSBTRequest()
|
||||||
@@ -46,6 +51,8 @@ namespace BTCPayServer.Controllers
|
|||||||
psbtDestination.SubstractFees = transactionOutput.SubtractFeesFromOutput;
|
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();
|
psbtRequest.FeePreference = new FeePreference();
|
||||||
if (sendModel.FeeSatoshiPerByte is decimal v and > decimal.Zero)
|
if (sendModel.FeeSatoshiPerByte is decimal v and > decimal.Zero)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1202,7 +1202,7 @@ namespace BTCPayServer.Controllers
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
psbtResponse = await CreatePSBT(network, derivationScheme, vm, cancellation);
|
psbtResponse = await CreatePSBT(walletId.StoreId, network, derivationScheme, vm, cancellation);
|
||||||
}
|
}
|
||||||
catch (NBXplorerException ex)
|
catch (NBXplorerException ex)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user