mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
Allow excluding unconfirmed UTXOs when creating a new transaction with Greenfield API
See original request: https://github.com/btcpayserver/btcpayserver/discussions/3737
This commit is contained in:
committed by
Andrew Camilleri
parent
fd3d389557
commit
d0e01768ab
@@ -376,10 +376,20 @@ namespace BTCPayServer.Controllers.Greenfield
|
||||
return this.CreateValidationError(ModelState);
|
||||
}
|
||||
|
||||
if (request.SelectedInputs != null && request.ExcludeUnconfirmed == true)
|
||||
{
|
||||
ModelState.AddModelError(
|
||||
nameof(request.ExcludeUnconfirmed),
|
||||
"Can't automatically exclude unconfirmed UTXOs while selection custom inputs"
|
||||
);
|
||||
|
||||
return this.CreateValidationError(ModelState);
|
||||
}
|
||||
|
||||
var explorerClient = _explorerClientProvider.GetExplorerClient(cryptoCode);
|
||||
var wallet = _btcPayWalletProvider.GetWallet(network);
|
||||
|
||||
var utxos = await wallet.GetUnspentCoins(derivationScheme.AccountDerivation);
|
||||
var utxos = await wallet.GetUnspentCoins(derivationScheme.AccountDerivation, request.ExcludeUnconfirmed);
|
||||
if (request.SelectedInputs != null || !utxos.Any())
|
||||
{
|
||||
utxos = utxos.Where(coin => request.SelectedInputs?.Contains(coin.OutPoint) ?? true)
|
||||
|
||||
Reference in New Issue
Block a user