Skip to content

Commit

Permalink
add network info in payment failure.
Browse files Browse the repository at this point in the history
  • Loading branch information
roeierez committed Dec 22, 2019
1 parent 0a7a2e1 commit 637b3c2
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions account/payments.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

"github.com/breez/breez/data"
"github.com/breez/breez/db"
"github.com/golang/protobuf/jsonpb"
"github.com/lightningnetwork/lnd/lnrpc"
)

Expand Down Expand Up @@ -216,6 +217,18 @@ func (a *Service) createPaymentTraceReport(paymentRequest string, amount int64,
return "", err
}

netInfo, err := lnclient.GetNetworkInfo(context.Background(), &lnrpc.NetworkInfoRequest{})
if err != nil {
a.log.Errorf("GetNetworkInfo error: %v", err)
return "", err
}
marshaller := jsonpb.Marshaler{}
netInfoData, err := marshaller.MarshalToString(netInfo)
if err != nil {
a.log.Errorf("failed to marshal network info: %v", err)
return "", err
}

if amount == 0 {
amount = decodedPayReq.NumSatoshis
}
Expand All @@ -225,6 +238,7 @@ func (a *Service) createPaymentTraceReport(paymentRequest string, amount int64,
"source_node": lnInfo.IdentityPubkey,
"amount": amount,
"payment_request": decodedPayReq,
"network_info": netInfoData,
},
}

Expand Down

0 comments on commit 637b3c2

Please sign in to comment.