Better Disconnect
MODIFY
WalletWasabi/BitcoinCore/P2pNode.cs
WalletWasabi/BitcoinCore/P2pNode.cs
@@ -154,21 +154,24 @@ namespace WalletWasabi.BitcoinCore
/// It is not equivalent to Dispose, but it is being called from Dispose.
/// </summary>
public void Disconnect()
+ {
+ if (Node is { })
{
lock (SubscriptionLock)
{
MempoolService.TrustedNodeMode = false;
if (NodeEventsSubscribed)
+ {
+ if (TrustedP2pBehavior is { })
{
TrustedP2pBehavior.BlockInv -= TrustedP2pBehavior_BlockInv;
+ }
Node.Disconnected -= Node_DisconnectedAsync;
Node.StateChanged -= P2pNode_StateChanged;
NodeEventsSubscribed = false;
}
}
- if (Node != null)
- {
try
{
Node?.Disconnect();

Better Disconnect