From 3d8adaef95e7cade15e2fb275eed7f10718e9ec8 Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Mon, 30 Sep 2019 09:20:55 +0200 Subject: [PATCH] routing: embed TimedPairResult in snapshot data --- lnrpc/routerrpc/router_server.go | 2 +- routing/missioncontrol.go | 19 ++++--------------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/lnrpc/routerrpc/router_server.go b/lnrpc/routerrpc/router_server.go index 77a701bb..51691edf 100644 --- a/lnrpc/routerrpc/router_server.go +++ b/lnrpc/routerrpc/router_server.go @@ -478,7 +478,7 @@ func (s *Server) QueryMissionControl(ctx context.Context, MinPenalizeAmtSat: int64( pair.MinPenalizeAmt.ToSatoshis(), ), - LastAttemptSuccessful: pair.LastAttemptSuccessful, + LastAttemptSuccessful: pair.Success, } rpcPairs = append(rpcPairs, &rpcPair) diff --git a/routing/missioncontrol.go b/routing/missioncontrol.go index 705305f7..c772e0fc 100644 --- a/routing/missioncontrol.go +++ b/routing/missioncontrol.go @@ -159,16 +159,8 @@ type MissionControlPairSnapshot struct { // Pair is the node pair of which the state is described. Pair DirectedNodePair - // Timestamp is the time of last result. - Timestamp time.Time - - // MinPenalizeAmt is the minimum amount for which the channel will be - // penalized. - MinPenalizeAmt lnwire.MilliSatoshi - - // LastAttemptSuccessful indicates whether the last payment attempt - // through this pair was successful. - LastAttemptSuccessful bool + // TimedPairResult contains the data for this pair. + TimedPairResult } // paymentResult is the information that becomes available when a payment @@ -345,14 +337,11 @@ func (m *MissionControl) GetHistorySnapshot() *MissionControlSnapshot { for fromNode, fromPairs := range m.lastPairResult { for toNode, result := range fromPairs { - pair := NewDirectedNodePair(fromNode, toNode) pairSnapshot := MissionControlPairSnapshot{ - Pair: pair, - MinPenalizeAmt: result.MinPenalizeAmt, - Timestamp: result.Timestamp, - LastAttemptSuccessful: result.Success, + Pair: pair, + TimedPairResult: result, } pairs = append(pairs, pairSnapshot)