From e93562b1db69901ce9e64edb5d4d2379dce7c806 Mon Sep 17 00:00:00 2001 From: Kukks Date: Wed, 15 Sep 2021 07:27:43 +0200 Subject: [PATCH] Do not publish NewTransactionEvent if GetValidOutputs did not match with the network's. --- BTCPayServer/Payments/Bitcoin/NBXplorerListener.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/BTCPayServer/Payments/Bitcoin/NBXplorerListener.cs b/BTCPayServer/Payments/Bitcoin/NBXplorerListener.cs index 04632872e..5179a7a1d 100644 --- a/BTCPayServer/Payments/Bitcoin/NBXplorerListener.cs +++ b/BTCPayServer/Payments/Bitcoin/NBXplorerListener.cs @@ -145,8 +145,10 @@ namespace BTCPayServer.Payments.Bitcoin if (evt.DerivationStrategy != null) { wallet.InvalidateCache(evt.DerivationStrategy); - - foreach (var output in network.GetValidOutputs(evt)) + var validOutputs = network.GetValidOutputs(evt).ToList(); + if (!validOutputs.Any()) + break; + foreach (var output in validOutputs) { var key = output.Item1.ScriptPubKey.Hash + "#" + network.CryptoCode.ToUpperInvariant();