mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
Upgrade Lightning lib; add and pass cancellation tokens in Greenfield
This commit is contained in:
committed by
Andrew Camilleri
parent
5328303c32
commit
5a4b675791
@@ -48,7 +48,7 @@ namespace BTCPayServer.Controllers.Greenfield
|
||||
});
|
||||
}
|
||||
|
||||
public virtual async Task<IActionResult> ConnectToNode(string cryptoCode, ConnectToNodeRequest request)
|
||||
public virtual async Task<IActionResult> ConnectToNode(string cryptoCode, ConnectToNodeRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var lightningClient = await GetLightningClient(cryptoCode, true);
|
||||
if (request?.NodeURI is null)
|
||||
@@ -61,7 +61,7 @@ namespace BTCPayServer.Controllers.Greenfield
|
||||
return this.CreateValidationError(ModelState);
|
||||
}
|
||||
|
||||
var result = await lightningClient.ConnectTo(request.NodeURI);
|
||||
var result = await lightningClient.ConnectTo(request.NodeURI, cancellationToken);
|
||||
switch (result)
|
||||
{
|
||||
case ConnectionResult.Ok:
|
||||
@@ -156,10 +156,10 @@ namespace BTCPayServer.Controllers.Greenfield
|
||||
return this.CreateAPIError(errorCode, errorMessage);
|
||||
}
|
||||
|
||||
public virtual async Task<IActionResult> GetDepositAddress(string cryptoCode)
|
||||
public virtual async Task<IActionResult> GetDepositAddress(string cryptoCode, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var lightningClient = await GetLightningClient(cryptoCode, true);
|
||||
return Ok(new JValue((await lightningClient.GetDepositAddress()).ToString()));
|
||||
return Ok(new JValue((await lightningClient.GetDepositAddress(cancellationToken)).ToString()));
|
||||
}
|
||||
|
||||
public virtual async Task<IActionResult> GetPayment(string cryptoCode, string paymentHash, CancellationToken cancellationToken = default)
|
||||
|
||||
Reference in New Issue
Block a user