From 8239fd7e0e7ef8b9a0f8c7e199c28d9e07919748 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Tue, 25 Aug 2020 14:53:01 +0900 Subject: [PATCH] InvoiceEntity blob should not be indented when saved into DB --- BTCPayServer/Services/Invoices/InvoiceRepository.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/BTCPayServer/Services/Invoices/InvoiceRepository.cs b/BTCPayServer/Services/Invoices/InvoiceRepository.cs index 674de619a..8bd644c52 100644 --- a/BTCPayServer/Services/Invoices/InvoiceRepository.cs +++ b/BTCPayServer/Services/Invoices/InvoiceRepository.cs @@ -12,13 +12,19 @@ using DBriize; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using NBitcoin; +using Newtonsoft.Json; using Encoders = NBitcoin.DataEncoders.Encoders; namespace BTCPayServer.Services.Invoices { public class InvoiceRepository : IDisposable { - + static JsonSerializerSettings DefaultSerializerSettings; + static InvoiceRepository() + { + DefaultSerializerSettings = new JsonSerializerSettings(); + NBitcoin.JsonConverters.Serializer.RegisterFrontConverters(DefaultSerializerSettings); + } private readonly DBriizeEngine _Engine; public DBriizeEngine Engine @@ -746,7 +752,7 @@ retry: { if (network == null) { - return NBitcoin.JsonConverters.Serializer.ToString(data, null); + return JsonConvert.SerializeObject(data, DefaultSerializerSettings); } return network.ToString(data); }