lnrpc: remove receipt field from invoice

This commit is contained in:
Conner Fromknecht 2019-11-22 02:23:24 -08:00
parent 6f9fcfaccc
commit 76a2dfd8a6
No known key found for this signature in database
GPG key ID: E7D737B67FA592C7
7 changed files with 554 additions and 596 deletions

View file

@ -2580,10 +2580,6 @@ var addInvoiceCommand = cli.Command{
Usage: "a description of the payment to attach along " +
"with the invoice (default=\"\")",
},
cli.StringFlag{
Name: "receipt",
Usage: "an optional cryptographic receipt of payment",
},
cli.StringFlag{
Name: "preimage",
Usage: "the hex-encoded preimage (32 byte) which will " +
@ -2628,7 +2624,6 @@ func addInvoice(ctx *cli.Context) error {
var (
preimage []byte
descHash []byte
receipt []byte
amt int64
err error
)
@ -2665,14 +2660,8 @@ func addInvoice(ctx *cli.Context) error {
return fmt.Errorf("unable to parse description_hash: %v", err)
}
receipt, err = hex.DecodeString(ctx.String("receipt"))
if err != nil {
return fmt.Errorf("unable to parse receipt: %v", err)
}
invoice := &lnrpc.Invoice{
Memo: ctx.String("memo"),
Receipt: receipt,
RPreimage: preimage,
Value: amt,
DescriptionHash: descHash,

View file

@ -57,10 +57,6 @@ type AddInvoiceData struct {
// description_hash field is not being used.
Memo string
// Deprecated. An optional cryptographic receipt of payment which is not
// implemented.
Receipt []byte
// The preimage which will allow settling an incoming HTLC payable to
// this preimage. If Preimage is set, Hash should be nil. If both
// Preimage and Hash are nil, a random preimage is generated.
@ -154,10 +150,6 @@ func AddInvoice(ctx context.Context, cfg *AddInvoiceConfig,
return nil, nil, fmt.Errorf("memo too large: %v bytes "+
"(maxsize=%v)", len(invoice.Memo), channeldb.MaxMemoSize)
}
if len(invoice.Receipt) > channeldb.MaxReceiptSize {
return nil, nil, fmt.Errorf("receipt too large: %v bytes "+
"(maxsize=%v)", len(invoice.Receipt), channeldb.MaxReceiptSize)
}
if len(invoice.DescriptionHash) > 0 && len(invoice.DescriptionHash) != 32 {
return nil, nil, fmt.Errorf("description hash is %v bytes, must be 32",
len(invoice.DescriptionHash))
@ -392,7 +384,6 @@ func AddInvoice(ctx context.Context, cfg *AddInvoiceConfig,
newInvoice := &channeldb.Invoice{
CreationDate: creationDate,
Memo: []byte(invoice.Memo),
Receipt: invoice.Receipt,
PaymentRequest: []byte(payReqString),
FinalCltvDelta: int32(payReq.MinFinalCLTVExpiry()),
Expiry: payReq.Expiry(),

View file

@ -94,7 +94,6 @@ func CreateRPCInvoice(invoice *channeldb.Invoice,
rpcInvoice := &lnrpc.Invoice{
Memo: string(invoice.Memo[:]),
Receipt: invoice.Receipt[:],
RHash: decoded.PaymentHash[:],
Value: int64(satAmt),
ValueMsat: int64(invoice.Terms.Value),

File diff suppressed because it is too large Load diff

View file

@ -2217,10 +2217,7 @@ message Invoice {
*/
string memo = 1 [json_name = "memo"];
/** Deprecated. An optional cryptographic receipt of payment which is not
implemented.
*/
bytes receipt = 2 [json_name = "receipt", deprecated = true];
reserved 2;
/**
The hex-encoded preimage (32 byte) which will allow settling an incoming

View file

@ -2660,11 +2660,6 @@
"type": "string",
"description": "*\nAn optional memo to attach along with the invoice. Used for record keeping\npurposes for the invoice's creator, and will also be set in the description\nfield of the encoded payment request if the description_hash field is not\nbeing used."
},
"receipt": {
"type": "string",
"format": "byte",
"description": "* Deprecated. An optional cryptographic receipt of payment which is not\nimplemented."
},
"r_preimage": {
"type": "string",
"format": "byte",

View file

@ -3599,7 +3599,6 @@ func (r *rpcServer) AddInvoice(ctx context.Context,
addInvoiceData := &invoicesrpc.AddInvoiceData{
Memo: invoice.Memo,
Receipt: invoice.Receipt,
Value: value,
DescriptionHash: invoice.DescriptionHash,
Expiry: invoice.Expiry,