routing: embed TimedPairResult in snapshot data

This commit is contained in:
Joost Jager committed 2019-10-29 12:32:15 +01:00
1 parent 57911faa98
commit 3d8adaef95
2 files changed
+5 -16

No files matched your search

+1 -1
View File
@@ -478,7 +478,7 @@ func (s *Server) QueryMissionControl(ctx context.Context,
MinPenalizeAmtSat: int64( MinPenalizeAmtSat: int64(
pair.MinPenalizeAmt.ToSatoshis(), pair.MinPenalizeAmt.ToSatoshis(),
), ),
LastAttemptSuccessful: pair.LastAttemptSuccessful, LastAttemptSuccessful: pair.Success,
} }
rpcPairs = append(rpcPairs, &rpcPair) rpcPairs = append(rpcPairs, &rpcPair)
+4 -15
View File
@@ -159,16 +159,8 @@ type MissionControlPairSnapshot struct {
// Pair is the node pair of which the state is described. // Pair is the node pair of which the state is described.
Pair DirectedNodePair Pair DirectedNodePair
// Timestamp is the time of last result. // TimedPairResult contains the data for this pair.
Timestamp time.Time TimedPairResult
// 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
} }
// paymentResult is the information that becomes available when a payment // 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 fromNode, fromPairs := range m.lastPairResult {
for toNode, result := range fromPairs { for toNode, result := range fromPairs {
pair := NewDirectedNodePair(fromNode, toNode) pair := NewDirectedNodePair(fromNode, toNode)
pairSnapshot := MissionControlPairSnapshot{ pairSnapshot := MissionControlPairSnapshot{
Pair: pair, Pair: pair,
MinPenalizeAmt: result.MinPenalizeAmt, TimedPairResult: result,
Timestamp: result.Timestamp,
LastAttemptSuccessful: result.Success,
} }
pairs = append(pairs, pairSnapshot) pairs = append(pairs, pairSnapshot)