Skip to content

Commit

Permalink
Merge pull request lightningnetwork#3996 from guggero/lncli-json
Browse files Browse the repository at this point in the history
lncli+proto: use original name in jsonpb marshaler and remove json_name fields in proto
  • Loading branch information
cfromknecht authored Mar 7, 2020
2 parents ecf7d82 + 9aff896 commit 8a5d846
Show file tree
Hide file tree
Showing 20 changed files with 1,939 additions and 1,887 deletions.
2 changes: 1 addition & 1 deletion cmd/lncli/cmd_query_probability.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func queryProb(ctx *cli.Context) error {
return err
}

printJSON(response)
printRespJSON(response)

return nil
}
1 change: 1 addition & 0 deletions cmd/lncli/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ func printJSON(resp interface{}) {
func printRespJSON(resp proto.Message) {
jsonMarshaler := &jsonpb.Marshaler{
EmitDefaults: true,
OrigName: true,
Indent: " ",
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/lncli/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ type Utxo struct {
// printed in base64.
func NewUtxoFromProto(utxo *lnrpc.Utxo) *Utxo {
return &Utxo{
Type: utxo.Type,
Type: utxo.AddressType,
Address: utxo.Address,
AmountSat: utxo.AmountSat,
PkScript: utxo.PkScript,
Expand Down
63 changes: 32 additions & 31 deletions lnrpc/autopilotrpc/autopilot.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 22 additions & 20 deletions lnrpc/autopilotrpc/autopilot.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,68 +11,70 @@ service Autopilot {
/**
Status returns whether the daemon's autopilot agent is active.
*/
rpc Status(StatusRequest) returns (StatusResponse);
rpc Status (StatusRequest) returns (StatusResponse);

/**
ModifyStatus is used to modify the status of the autopilot agent, like
enabling or disabling it.
*/
rpc ModifyStatus(ModifyStatusRequest) returns (ModifyStatusResponse);
rpc ModifyStatus (ModifyStatusRequest) returns (ModifyStatusResponse);

/**
QueryScores queries all available autopilot heuristics, in addition to any
active combination of these heruristics, for the scores they would give to
the given nodes.
*/
rpc QueryScores(QueryScoresRequest) returns (QueryScoresResponse);
rpc QueryScores (QueryScoresRequest) returns (QueryScoresResponse);

/**
SetScores attempts to set the scores used by the running autopilot agent,
if the external scoring heuristic is enabled.
*/
rpc SetScores(SetScoresRequest) returns (SetScoresResponse);
rpc SetScores (SetScoresRequest) returns (SetScoresResponse);
}

message StatusRequest{
message StatusRequest {
}

message StatusResponse{
message StatusResponse {
/// Indicates whether the autopilot is active or not.
bool active = 1 [json_name = "active"];
bool active = 1;
}

message ModifyStatusRequest{
message ModifyStatusRequest {
/// Whether the autopilot agent should be enabled or not.
bool enable = 1 [json_name = "enable"];
bool enable = 1;
}

message ModifyStatusResponse {}
message ModifyStatusResponse {
}

message QueryScoresRequest{
repeated string pubkeys = 1 [json_name = "pubkeys"];
message QueryScoresRequest {
repeated string pubkeys = 1;

/// If set, we will ignore the local channel state when calculating scores.
bool ignore_local_state = 2 [json_name = "no_state"];
bool ignore_local_state = 2;
}

message QueryScoresResponse {
message HeuristicResult {
string heuristic = 1 [json_name = "heuristic"];
map<string, double> scores= 2 [json_name = "scores"];
string heuristic = 1;
map<string, double> scores = 2;
}

repeated HeuristicResult results = 1 [json_name = "results"];
repeated HeuristicResult results = 1;
}

message SetScoresRequest{
message SetScoresRequest {
/// The name of the heuristic to provide scores to.
string heuristic = 1 [json_name = "heuristic"];
string heuristic = 1;

/**
A map from hex-encoded public keys to scores. Scores must be in the range
[0.0, 1.0].
*/
map<string, double> scores = 2 [json_name = "scores"];
map<string, double> scores = 2;
}

message SetScoresResponse {}
message SetScoresResponse {
}
6 changes: 3 additions & 3 deletions lnrpc/chainrpc/chainnotifier.proto
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ service ChainNotifier {
particular transaction by its hash or for an output script by specifying a
zero hash.
*/
rpc RegisterConfirmationsNtfn(ConfRequest) returns (stream ConfEvent);
rpc RegisterConfirmationsNtfn (ConfRequest) returns (stream ConfEvent);

/*
RegisterSpendNtfn is a synchronous response-streaming RPC that registers an
Expand All @@ -160,7 +160,7 @@ service ChainNotifier {
A client can specify whether the spend request should be for a particular
outpoint or for an output script by specifying a zero outpoint.
*/
rpc RegisterSpendNtfn(SpendRequest) returns (stream SpendEvent);
rpc RegisterSpendNtfn (SpendRequest) returns (stream SpendEvent);

/*
RegisterBlockEpochNtfn is a synchronous response-streaming RPC that
Expand All @@ -173,5 +173,5 @@ service ChainNotifier {
point. This allows clients to be idempotent by ensuring that they do not
missing processing a single block within the chain.
*/
rpc RegisterBlockEpochNtfn(BlockEpoch) returns (stream BlockEpoch);
rpc RegisterBlockEpochNtfn (BlockEpoch) returns (stream BlockEpoch);
}
Loading

0 comments on commit 8a5d846

Please sign in to comment.