autopilot: split channel definition into LocalChannel/ChannelEdge

Since non-local channels won't have a balance field, we split the
definitions in anticipation of adding one.
This commit is contained in:
Johan T. Halseth
2020-10-02 13:56:43 +02:00
parent 3e1755ee99
commit d40cf6b592
14 changed files with 66 additions and 72 deletions

View File

@@ -249,7 +249,7 @@ func initAutoPilot(svr *server, cfg *lncfg.AutoPilot,
return &autopilot.ManagerCfg{
Self: self,
PilotCfg: &pilotCfg,
ChannelState: func() ([]autopilot.Channel, error) {
ChannelState: func() ([]autopilot.LocalChannel, error) {
// We'll fetch the current state of open
// channels from the database to use as initial
// state for the auto-pilot agent.
@@ -257,10 +257,10 @@ func initAutoPilot(svr *server, cfg *lncfg.AutoPilot,
if err != nil {
return nil, err
}
chanState := make([]autopilot.Channel,
chanState := make([]autopilot.LocalChannel,
len(activeChannels))
for i, channel := range activeChannels {
chanState[i] = autopilot.Channel{
chanState[i] = autopilot.LocalChannel{
ChanID: channel.ShortChanID(),
Capacity: channel.Capacity,
Node: autopilot.NewNodeID(