routing: invalid channels updatechanpolicy call
This commit is contained in:
1 parent
03bce2129b
commit
46e9481e6c
9 files changed
+1787
-1342
No files matched your search
+16
-1
@@ -2311,7 +2311,22 @@ func updateChannelPolicy(ctx *cli.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
printRespJSON(resp)
|
||||
// Parse the response into the final json object that will be printed
|
||||
// to stdout. At the moment, this filters out the raw txid bytes from
|
||||
// each failed update's outpoint and only prints the txid string.
|
||||
var listFailedUpdateResp = struct {
|
||||
FailedUpdates []*FailedUpdate `json:"failed_updates"`
|
||||
}{
|
||||
FailedUpdates: make([]*FailedUpdate, 0, len(resp.FailedUpdates)),
|
||||
}
|
||||
for _, protoUpdate := range resp.FailedUpdates {
|
||||
failedUpdate := NewFailedUpdateFromProto(protoUpdate)
|
||||
listFailedUpdateResp.FailedUpdates = append(
|
||||
listFailedUpdateResp.FailedUpdates, failedUpdate)
|
||||
}
|
||||
|
||||
printJSON(listFailedUpdateResp)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -66,3 +66,22 @@ func NewUtxoFromProto(utxo *lnrpc.Utxo) *Utxo {
|
||||
Confirmations: utxo.Confirmations,
|
||||
}
|
||||
}
|
||||
|
||||
// FailedUpdate displays information about a failed update, including its
|
||||
// address, reason and update error.
|
||||
type FailedUpdate struct {
|
||||
OutPoint OutPoint `json:"outpoint"`
|
||||
Reason string `json:"reason"`
|
||||
UpdateError string `json:"update_error"`
|
||||
}
|
||||
|
||||
// NewFailedUpdateFromProto creates a display from the FailedUpdate
|
||||
// proto. This filters out the raw txid bytes from the provided outpoint,
|
||||
// which will otherwise be printed in base64.
|
||||
func NewFailedUpdateFromProto(update *lnrpc.FailedUpdate) *FailedUpdate {
|
||||
return &FailedUpdate{
|
||||
OutPoint: NewOutPointFromProto(update.Outpoint),
|
||||
Reason: update.Reason.String(),
|
||||
UpdateError: update.UpdateError,
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user