[GEN-524] Channel balances disrupted by disabled nodes#500
[GEN-524] Channel balances disrupted by disabled nodes#500
Conversation
| var result = new Dictionary<ulong, ChannelState>(); | ||
| foreach (var node in nodes) | ||
| { | ||
| var listChannelsResponse = await _lightningClientService.ListChannels(node); |
There was a problem hiding this comment.
This call is internally handling errors, catching an exception, logging it and then returning error.
So I believe we are safe from what the ticket says
Missing error handling in the UI: When lightning node returns an error or unexpected response, the lack of a try/catch block causes the entire balance rendering to break, preventing the user from seeing any channel balance information.
There was a problem hiding this comment.
Pull request overview
This PR addresses incorrect Lightning channel balance/state aggregation caused by including disabled nodes when computing channel states.
Changes:
- Update
LightningService.GetChannelsState()to fetch only non-disabled managed nodes fromINodeRepository.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| public async Task<Dictionary<ulong, ChannelState>> GetChannelsState() | ||
| { | ||
| var nodes = await _nodeRepository.GetAllManagedByNodeGuard(); | ||
| var nodes = await _nodeRepository.GetAllManagedByNodeGuard(withDisabled: false); |
There was a problem hiding this comment.
GetChannelsState() now excludes disabled nodes via withDisabled: false, but the current unit tests for GetChannelsState don’t assert this behavior. Please add a test case where GetAllManagedByNodeGuard returns both enabled and IsNodeDisabled=true nodes and verify disabled nodes are not queried for channels and do not affect the resulting channel balances/state (or verify the repository call is made with withDisabled: false).
| var nodes = await _nodeRepository.GetAllManagedByNodeGuard(withDisabled: false); | |
| var nodes = (await _nodeRepository.GetAllManagedByNodeGuard(withDisabled: false)) | |
| .Where(n => !n.IsNodeDisabled) | |
| .ToList(); |
No description provided.