channeldb: eliminate extra copy in QueryPayments
In this commit, we eliminate an extraneous copy in the `QueryPayments` method. Before this commit, we would copy each payment from the initial FetchPayments call into a new slice. However, pointers to payments are return from `FetchPayments`, so we can just maintain that same reference rather than copying again when we want to limit our response.
This commit is contained in:
2 files changed
+3
-3
No files matched your search
+1
-1
@@ -5191,7 +5191,7 @@ func (r *rpcServer) ListPayments(ctx context.Context,
|
||||
for _, payment := range paymentsQuerySlice.Payments {
|
||||
payment := payment
|
||||
|
||||
rpcPayment, err := r.routerBackend.MarshallPayment(&payment)
|
||||
rpcPayment, err := r.routerBackend.MarshallPayment(payment)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user