discovery/test: update mock to support iterator-based UpdatesInHorizon

In this commit, we update the mockChannelGraphTimeSeries to implement
the new iterator-based UpdatesInHorizon interface. The mock maintains
its existing behavior of receiving messages through a channel and
returning them to the caller, but now wraps this in an iterator
function.

The implementation creates an iterator that pulls the entire message
slice from the mock's response channel, then yields each message
individually. This preserves the test semantics while conforming to the
new interface, ensuring all existing tests continue to pass without
modification.
This commit is contained in:
Olaoluwa Osuntokun
2025-09-10 18:23:28 -07:00
parent 77f3b35640
commit 0b3816afb9

View File

@@ -94,6 +94,8 @@ func (m *mockChannelGraphTimeSeries) UpdatesInHorizon(chain chainhash.Hash,
chain, startTime, endTime, chain, startTime, endTime,
} }
// We'll get the response from the channel, then yield it
// immediately.
msgs := <-m.horizonResp msgs := <-m.horizonResp
for _, msg := range msgs { for _, msg := range msgs {
if !yield(msg, nil) { if !yield(msg, nil) {