From 90ed0fe54c103a00ec884d48941ddba490d8060d Mon Sep 17 00:00:00 2001 From: Elle Mouton Date: Mon, 18 Nov 2024 21:06:06 +0200 Subject: [PATCH] lntest: nil check edges --- lntest/harness_assertion.go | 4 ++-- lntest/node/state.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lntest/harness_assertion.go b/lntest/harness_assertion.go index b487e7e32..1b079fea1 100644 --- a/lntest/harness_assertion.go +++ b/lntest/harness_assertion.go @@ -255,10 +255,10 @@ func (h *HarnessTest) AssertNumActiveEdges(hn *node.HarnessNode, // filterDisabled is a helper closure that filters out disabled // channels. filterDisabled := func(edge *lnrpc.ChannelEdge) bool { - if edge.Node1Policy.Disabled { + if edge.Node1Policy != nil && edge.Node1Policy.Disabled { return false } - if edge.Node2Policy.Disabled { + if edge.Node2Policy != nil && edge.Node2Policy.Disabled { return false } diff --git a/lntest/node/state.go b/lntest/node/state.go index 6b9446240..a89ab7d2c 100644 --- a/lntest/node/state.go +++ b/lntest/node/state.go @@ -312,10 +312,10 @@ func (s *State) updateEdgeStats() { // filterDisabled is a helper closure that filters out disabled // channels. filterDisabled := func(edge *lnrpc.ChannelEdge) bool { - if edge.Node1Policy.Disabled { + if edge.Node1Policy != nil && edge.Node1Policy.Disabled { return false } - if edge.Node2Policy.Disabled { + if edge.Node2Policy != nil && edge.Node2Policy.Disabled { return false }