From c8e1db210208a70062eaeff7159c957cbe14afe4 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Wed, 11 Mar 2020 21:11:07 +0900 Subject: [PATCH] Better event messages --- BTCPayServer/Events/NewOnChainTransactionEvent.cs | 6 ++++++ BTCPayServer/Payments/Bitcoin/NBXplorerListener.cs | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/BTCPayServer/Events/NewOnChainTransactionEvent.cs b/BTCPayServer/Events/NewOnChainTransactionEvent.cs index b994f6b49..d695fac15 100644 --- a/BTCPayServer/Events/NewOnChainTransactionEvent.cs +++ b/BTCPayServer/Events/NewOnChainTransactionEvent.cs @@ -6,5 +6,11 @@ namespace BTCPayServer.Events { public NewTransactionEvent NewTransactionEvent { get; set; } public string CryptoCode { get; set; } + + public override string ToString() + { + var state = NewTransactionEvent.BlockId == null ? "Unconfirmed" : "Confirmed"; + return $"{CryptoCode}: New transaction {NewTransactionEvent.TransactionData.TransactionHash} ({state})"; + } } } diff --git a/BTCPayServer/Payments/Bitcoin/NBXplorerListener.cs b/BTCPayServer/Payments/Bitcoin/NBXplorerListener.cs index 7f0b82990..674f29810 100644 --- a/BTCPayServer/Payments/Bitcoin/NBXplorerListener.cs +++ b/BTCPayServer/Payments/Bitcoin/NBXplorerListener.cs @@ -346,7 +346,7 @@ namespace BTCPayServer.Payments.Bitcoin var address = await wallet.ReserveAddressAsync(strategy); btc.DepositAddress = address.Address.ToString(); await _InvoiceRepository.NewAddress(invoice.Id, btc, wallet.Network); - _Aggregator.Publish(new InvoiceNewAddressEvent(invoice.Id, address.ToString(), wallet.Network)); + _Aggregator.Publish(new InvoiceNewAddressEvent(invoice.Id, btc.DepositAddress, wallet.Network)); paymentMethod.SetPaymentMethodDetails(btc); invoice.SetPaymentMethod(paymentMethod); }