mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 22:44:29 +01:00
streamline decode of uploaded psbt file + fix action button alginment
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using NBitcoin;
|
||||
@@ -36,19 +37,9 @@ namespace BTCPayServer.Models.WalletViewModels
|
||||
{
|
||||
if (UploadedPSBTFile.Length > 500 * 1024)
|
||||
return null;
|
||||
byte[] bytes = new byte[UploadedPSBTFile.Length];
|
||||
using (var stream = UploadedPSBTFile.OpenReadStream())
|
||||
{
|
||||
await stream.ReadAsync(bytes, 0, (int)UploadedPSBTFile.Length);
|
||||
}
|
||||
try
|
||||
{
|
||||
return NBitcoin.PSBT.Load(bytes, network);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
using var stream = new StreamReader(UploadedPSBTFile.OpenReadStream());
|
||||
PSBT = await stream.ReadToEndAsync();
|
||||
}
|
||||
if (!string.IsNullOrEmpty(PSBT))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user