From 5a6fea31d9eea8d240f5c4f534c7b7dc2b281cce Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Tue, 11 Feb 2020 13:57:40 +0100 Subject: [PATCH] invoicesrpc: format invoices.proto and remove json_name fields We now use the jsonpb marshaler to convert the RPC responses to JSON in lncli and REST. The jsonpb has a setting to use the original name as defined in the proto file and the explicit json_name definition is not necessary any more. The jsonpb setting is called OrigName and needs to be true. --- lnrpc/invoicesrpc/invoices.pb.go | 81 ++++++++++++++++---------------- lnrpc/invoicesrpc/invoices.proto | 42 +++++++++-------- 2 files changed, 63 insertions(+), 60 deletions(-) diff --git a/lnrpc/invoicesrpc/invoices.pb.go b/lnrpc/invoicesrpc/invoices.pb.go index a1e88054..97c25467 100644 --- a/lnrpc/invoicesrpc/invoices.pb.go +++ b/lnrpc/invoicesrpc/invoices.pb.go @@ -113,22 +113,22 @@ type AddHoldInvoiceRequest struct { //The value of this invoice in millisatoshis // //The fields value and value_msat are mutually exclusive. - ValueMsat int64 `protobuf:"varint,10,opt,name=value_msat,proto3" json:"value_msat,omitempty"` + ValueMsat int64 `protobuf:"varint,10,opt,name=value_msat,json=valueMsat,proto3" json:"value_msat,omitempty"` //* //Hash (SHA-256) of a description of the payment. Used if the description of //payment (memo) is too long to naturally fit within the description field //of an encoded payment request. - DescriptionHash []byte `protobuf:"bytes,4,opt,name=description_hash,proto3" json:"description_hash,omitempty"` + DescriptionHash []byte `protobuf:"bytes,4,opt,name=description_hash,json=descriptionHash,proto3" json:"description_hash,omitempty"` /// Payment request expiry time in seconds. Default is 3600 (1 hour). Expiry int64 `protobuf:"varint,5,opt,name=expiry,proto3" json:"expiry,omitempty"` /// Fallback on-chain address. - FallbackAddr string `protobuf:"bytes,6,opt,name=fallback_addr,proto3" json:"fallback_addr,omitempty"` + FallbackAddr string `protobuf:"bytes,6,opt,name=fallback_addr,json=fallbackAddr,proto3" json:"fallback_addr,omitempty"` /// Delta to use for the time-lock of the CLTV extended to the final hop. - CltvExpiry uint64 `protobuf:"varint,7,opt,name=cltv_expiry,proto3" json:"cltv_expiry,omitempty"` + CltvExpiry uint64 `protobuf:"varint,7,opt,name=cltv_expiry,json=cltvExpiry,proto3" json:"cltv_expiry,omitempty"` //* //Route hints that can each be individually used to assist in reaching the //invoice's destination. - RouteHints []*lnrpc.RouteHint `protobuf:"bytes,8,rep,name=route_hints,proto3" json:"route_hints,omitempty"` + RouteHints []*lnrpc.RouteHint `protobuf:"bytes,8,rep,name=route_hints,json=routeHints,proto3" json:"route_hints,omitempty"` /// Whether this invoice should include routing hints for private channels. Private bool `protobuf:"varint,9,opt,name=private,proto3" json:"private,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -236,7 +236,7 @@ type AddHoldInvoiceResp struct { //A bare-bones invoice for a payment within the Lightning Network. With the //details of the invoice, the sender has all the data necessary to send a //payment to the recipient. - PaymentRequest string `protobuf:"bytes,1,opt,name=payment_request,proto3" json:"payment_request,omitempty"` + PaymentRequest string `protobuf:"bytes,1,opt,name=payment_request,json=paymentRequest,proto3" json:"payment_request,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -347,7 +347,7 @@ var xxx_messageInfo_SettleInvoiceResp proto.InternalMessageInfo type SubscribeSingleInvoiceRequest struct { /// Hash corresponding to the (hold) invoice to subscribe to. - RHash []byte `protobuf:"bytes,2,opt,name=r_hash,proto3" json:"r_hash,omitempty"` + RHash []byte `protobuf:"bytes,2,opt,name=r_hash,json=rHash,proto3" json:"r_hash,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -398,40 +398,41 @@ func init() { func init() { proto.RegisterFile("invoicesrpc/invoices.proto", fileDescriptor_090ab9c4958b987d) } var fileDescriptor_090ab9c4958b987d = []byte{ - // 519 bytes of a gzipped FileDescriptorProto + // 541 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x53, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0x95, 0xd3, 0x34, 0x4d, 0x27, 0x6d, 0x09, 0x0b, 0x54, 0x96, 0x45, 0x8b, 0xb1, 0x38, 0x58, - 0x3d, 0xd8, 0x90, 0x8a, 0x23, 0x48, 0xc0, 0x25, 0x20, 0xc1, 0xc1, 0x11, 0x1c, 0xb8, 0x58, 0x1b, - 0x7b, 0xb1, 0x57, 0x5d, 0xef, 0x2e, 0xbb, 0x9b, 0x40, 0xbf, 0x92, 0x33, 0x7f, 0x83, 0xbc, 0x76, - 0x2a, 0xdb, 0x2d, 0xbd, 0xcd, 0xbc, 0x99, 0x79, 0x1e, 0xbf, 0x37, 0x0b, 0x1e, 0xe5, 0x5b, 0x41, - 0x33, 0xa2, 0x95, 0xcc, 0xe2, 0x5d, 0x1c, 0x49, 0x25, 0x8c, 0x40, 0xb3, 0x4e, 0xcd, 0x7b, 0x5a, - 0x08, 0x51, 0x30, 0x12, 0x63, 0x49, 0x63, 0xcc, 0xb9, 0x30, 0xd8, 0x50, 0xc1, 0xdb, 0x56, 0xef, - 0x50, 0xc9, 0xac, 0x09, 0x83, 0xd7, 0x30, 0xff, 0x80, 0x79, 0x46, 0xd8, 0xc7, 0x66, 0xfa, 0xb3, - 0x2e, 0xd0, 0x73, 0x38, 0x92, 0xf8, 0xba, 0x22, 0xdc, 0xa4, 0x25, 0xd6, 0xa5, 0xeb, 0xf8, 0x4e, - 0x78, 0x94, 0xcc, 0x5a, 0x6c, 0x89, 0x75, 0x19, 0x3c, 0x82, 0x87, 0xbd, 0xb1, 0x84, 0x68, 0x19, - 0xfc, 0x19, 0xc1, 0x93, 0x77, 0x79, 0xbe, 0x14, 0x2c, 0xbf, 0x81, 0x7f, 0x6e, 0x88, 0x36, 0x08, - 0xc1, 0xb8, 0x22, 0x95, 0xb0, 0x4c, 0x87, 0x89, 0x8d, 0x6b,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 0x75, 0xfb, 0xce, 0xa4, + 0x73, 0xfe, 0xa7, 0x03, 0x7d, 0xbb, 0xaf, 0xd0, 0x57, 0x38, 0xb9, 0x9b, 0x0a, 0xbd, 0x0c, 0x1a, + 0x87, 0x1b, 0xdc, 0xfb, 0x7b, 0xde, 0xd8, 0x9a, 0x69, 0xe1, 0x57, 0x0e, 0xfa, 0x0c, 0x87, 0xad, + 0x43, 0x44, 0xd3, 0x16, 0xdd, 0xee, 0x6d, 0x7b, 0x4f, 0xfe, 0x3f, 0x36, 0x06, 0x7f, 0x81, 0x71, + 0xdb, 0x76, 0xe4, 0xb7, 0x5e, 0xdc, 0x79, 0xdf, 0xde, 0xe9, 0xbd, 0x3b, 0x4a, 0x54, 0x32, 0x5b, + 0xf6, 0xee, 0xc8, 0xdc, 0x8d, 0x6a, 0x47, 0xe6, 0x3f, 0xc9, 0xbc, 0xbb, 0xf8, 0x76, 0x96, 0x51, + 0x9d, 0xaf, 0x57, 0x41, 0xc2, 0xcb, 0xb0, 0xa0, 0x59, 0xae, 0x19, 0x65, 0x19, 0x23, 0xfa, 0x27, + 0x97, 0xd7, 0x61, 0xc1, 0xd2, 0xd0, 0x38, 0x15, 0x36, 0x68, 0x56, 0x3d, 0xf3, 0xc9, 0x5f, 0xfc, + 0x0d, 0x00, 0x00, 0xff, 0xff, 0x56, 0x22, 0x58, 0xe6, 0x46, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/lnrpc/invoicesrpc/invoices.proto b/lnrpc/invoicesrpc/invoices.proto index 00d380d3..4876cb44 100644 --- a/lnrpc/invoicesrpc/invoices.proto +++ b/lnrpc/invoicesrpc/invoices.proto @@ -22,26 +22,27 @@ service Invoices { canceled, this call will succeed. If the invoice is already settled, it will fail. */ - rpc CancelInvoice(CancelInvoiceMsg) returns (CancelInvoiceResp); + rpc CancelInvoice (CancelInvoiceMsg) returns (CancelInvoiceResp); /** AddHoldInvoice creates a hold invoice. It ties the invoice to the hash supplied in the request. */ - rpc AddHoldInvoice(AddHoldInvoiceRequest) returns (AddHoldInvoiceResp); - + rpc AddHoldInvoice (AddHoldInvoiceRequest) returns (AddHoldInvoiceResp); + /** SettleInvoice settles an accepted invoice. If the invoice is already settled, this call will succeed. */ - rpc SettleInvoice(SettleInvoiceMsg) returns (SettleInvoiceResp); + rpc SettleInvoice (SettleInvoiceMsg) returns (SettleInvoiceResp); } message CancelInvoiceMsg { /// Hash corresponding to the (hold) invoice to cancel. bytes payment_hash = 1; -} -message CancelInvoiceResp {} +} +message CancelInvoiceResp { +} message AddHoldInvoiceRequest { /** @@ -50,49 +51,49 @@ message AddHoldInvoiceRequest { field of the encoded payment request if the description_hash field is not being used. */ - string memo = 1 [json_name = "memo"]; + string memo = 1; /// The hash of the preimage - bytes hash = 2 [json_name = "hash"]; + bytes hash = 2; /** The value of this invoice in satoshis The fields value and value_msat are mutually exclusive. */ - int64 value = 3 [json_name = "value"]; + int64 value = 3; /** The value of this invoice in millisatoshis The fields value and value_msat are mutually exclusive. */ - int64 value_msat = 10 [json_name = "value_msat"]; + int64 value_msat = 10; /** Hash (SHA-256) of a description of the payment. Used if the description of payment (memo) is too long to naturally fit within the description field of an encoded payment request. */ - bytes description_hash = 4 [json_name = "description_hash"]; + bytes description_hash = 4; /// Payment request expiry time in seconds. Default is 3600 (1 hour). - int64 expiry = 5 [json_name = "expiry"]; + int64 expiry = 5; /// Fallback on-chain address. - string fallback_addr = 6 [json_name = "fallback_addr"]; + string fallback_addr = 6; /// Delta to use for the time-lock of the CLTV extended to the final hop. - uint64 cltv_expiry = 7 [json_name = "cltv_expiry"]; + uint64 cltv_expiry = 7; /** Route hints that can each be individually used to assist in reaching the invoice's destination. */ - repeated lnrpc.RouteHint route_hints = 8 [json_name = "route_hints"]; + repeated lnrpc.RouteHint route_hints = 8; /// Whether this invoice should include routing hints for private channels. - bool private = 9 [json_name = "private"]; + bool private = 9; } message AddHoldInvoiceResp { @@ -101,19 +102,20 @@ message AddHoldInvoiceResp { details of the invoice, the sender has all the data necessary to send a payment to the recipient. */ - string payment_request = 1 [json_name = "payment_request"]; + string payment_request = 1; } message SettleInvoiceMsg { /// Externally discovered pre-image that should be used to settle the hold invoice. bytes preimage = 1; -} +} -message SettleInvoiceResp {} +message SettleInvoiceResp { +} message SubscribeSingleInvoiceRequest { reserved 1; /// Hash corresponding to the (hold) invoice to subscribe to. - bytes r_hash = 2 [json_name = "r_hash"]; + bytes r_hash = 2; }