streamline decode of uploaded psbt file + fix action button alginment

This commit is contained in:
Kukks
2020-07-14 09:18:40 +02:00
parent 88af6c441f
commit d393cee732
2 changed files with 15 additions and 23 deletions

View File

@@ -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))
{