@@ -1852,20 +1852,29 @@ func (s *SQLStore) FetchChannelEdgesByID(chanID uint64) (
1852
1852
if errors .Is (err , sql .ErrNoRows ) {
1853
1853
// First check if this edge is perhaps in the zombie
1854
1854
// index.
1855
- isZombie , err := db .IsZombieChannel (
1856
- ctx , sqlc.IsZombieChannelParams {
1855
+ zombie , err := db .GetZombieChannel (
1856
+ ctx , sqlc.GetZombieChannelParams {
1857
1857
Scid : chanIDB [:],
1858
1858
Version : int16 (ProtocolV1 ),
1859
1859
},
1860
1860
)
1861
- if err != nil {
1861
+ if errors .Is (err , sql .ErrNoRows ) {
1862
+ return ErrEdgeNotFound
1863
+ } else if err != nil {
1862
1864
return fmt .Errorf ("unable to check if " +
1863
1865
"channel is zombie: %w" , err )
1864
- } else if isZombie {
1865
- return ErrZombieEdge
1866
1866
}
1867
1867
1868
- return ErrEdgeNotFound
1868
+ // At this point, we know the channel is a zombie, so
1869
+ // we'll return an error indicating this, and we will
1870
+ // populate the edge info with the public keys of each
1871
+ // party as this is the only information we have about
1872
+ // it.
1873
+ edge = & models.ChannelEdgeInfo {}
1874
+ copy (edge .NodeKey1Bytes [:], zombie .NodeKey1 )
1875
+ copy (edge .NodeKey2Bytes [:], zombie .NodeKey2 )
1876
+
1877
+ return ErrZombieEdge
1869
1878
} else if err != nil {
1870
1879
return fmt .Errorf ("unable to fetch channel: %w" , err )
1871
1880
}
@@ -1903,7 +1912,10 @@ func (s *SQLStore) FetchChannelEdgesByID(chanID uint64) (
1903
1912
return nil
1904
1913
}, sqldb .NoOpReset )
1905
1914
if err != nil {
1906
- return nil , nil , nil , fmt .Errorf ("could not fetch channel: %w" ,
1915
+ // If we are returning the ErrZombieEdge, then we also need to
1916
+ // return the edge info as the method comment indicates that
1917
+ // this will be populated when the edge is a zombie.
1918
+ return edge , nil , nil , fmt .Errorf ("could not fetch channel: %w" ,
1907
1919
err )
1908
1920
}
1909
1921
0 commit comments