mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-10 14:17:56 +01:00
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:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user