@@ -1820,6 +1820,37 @@ func (h *HarnessTest) AssertZombieChannel(hn *node.HarnessNode, chanID uint64) {
18201820 require .NoError (h , err , "timeout while checking zombie channel" )
18211821}
18221822
1823+ // AssertNotInGraph asserts that a given channel is either not found at all in
1824+ // the graph or that it has been marked as a zombie.
1825+ func (h * HarnessTest ) AssertNotInGraph (hn * node.HarnessNode , chanID uint64 ) {
1826+ ctxt , cancel := context .WithTimeout (h .runCtx , DefaultTimeout )
1827+ defer cancel ()
1828+
1829+ err := wait .NoError (func () error {
1830+ _ , err := hn .RPC .LN .GetChanInfo (
1831+ ctxt , & lnrpc.ChanInfoRequest {ChanId : chanID },
1832+ )
1833+ if err == nil {
1834+ return fmt .Errorf ("expected error but got nil" )
1835+ }
1836+
1837+ switch {
1838+ case strings .Contains (err .Error (), "marked as zombie" ):
1839+ return nil
1840+
1841+ case strings .Contains (err .Error (), "edge not found" ):
1842+ return nil
1843+
1844+ default :
1845+ return fmt .Errorf ("expected error to contain either " +
1846+ "'%s' or '%s' but was: '%v'" , "marked as i" +
1847+ "zombie" , "edge not found" , err )
1848+ }
1849+ }, DefaultTimeout )
1850+ require .NoError (h , err , "timeout while checking that channel is not " +
1851+ "found in graph" )
1852+ }
1853+
18231854// AssertTxAtHeight gets all of the transactions that a node's wallet has a
18241855// record of at the target height, and finds and returns the tx with the target
18251856// txid, failing if it is not found.
0 commit comments