mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-28 22:42:29 +02:00
routerrpc: create pair data proto message
With a separate proto message, it becomes possible to also return the pair data for a single pair. This prepares for the new mc probability querying rpc.
This commit is contained in:
@@ -472,13 +472,9 @@ func (s *Server) QueryMissionControl(ctx context.Context,
|
||||
pair := p
|
||||
|
||||
rpcPair := PairHistory{
|
||||
NodeFrom: pair.Pair.From[:],
|
||||
NodeTo: pair.Pair.To[:],
|
||||
Timestamp: pair.Timestamp.Unix(),
|
||||
MinPenalizeAmtSat: int64(
|
||||
pair.MinPenalizeAmt.ToSatoshis(),
|
||||
),
|
||||
LastAttemptSuccessful: pair.Success,
|
||||
NodeFrom: pair.Pair.From[:],
|
||||
NodeTo: pair.Pair.To[:],
|
||||
History: toRPCPairData(&pair.TimedPairResult),
|
||||
}
|
||||
|
||||
rpcPairs = append(rpcPairs, &rpcPair)
|
||||
@@ -491,6 +487,22 @@ func (s *Server) QueryMissionControl(ctx context.Context,
|
||||
return &response, nil
|
||||
}
|
||||
|
||||
// toRPCPairData marshalls mission control pair data to the rpc struct.
|
||||
func toRPCPairData(data *routing.TimedPairResult) *PairData {
|
||||
rpcData := PairData{
|
||||
MinPenalizeAmtSat: int64(
|
||||
data.MinPenalizeAmt.ToSatoshis(),
|
||||
),
|
||||
LastAttemptSuccessful: data.Success,
|
||||
}
|
||||
|
||||
if !data.Timestamp.IsZero() {
|
||||
rpcData.Timestamp = data.Timestamp.Unix()
|
||||
}
|
||||
|
||||
return &rpcData
|
||||
}
|
||||
|
||||
// TrackPayment returns a stream of payment state updates. The stream is
|
||||
// closed when the payment completes.
|
||||
func (s *Server) TrackPayment(request *TrackPaymentRequest,
|
||||
|
Reference in New Issue
Block a user