Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invoices: return payment address and add index from addholdinvoice #5533

Conversation

ErikEk
Copy link
Contributor

@ErikEk ErikEk commented Jul 17, 2021

Fixes: #4820. This pr extends the response from addholdinvoice to mimic that of the addinvoice response. It adds AddIndex and PaymentAddr to AddHoldInvoiceResp.

Fixes: #4820

@ErikEk ErikEk changed the title invoices: returns payment address from addholdinvoice invoices: return payment address from addholdinvoice Jul 17, 2021
Copy link
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. I think the r_hash doesn't make any sense here. See my comments below.

// EDIT: Maybe I should read the issue this is trying to fix first :/

lnrpc/invoicesrpc/invoices.proto Outdated Show resolved Hide resolved
lnrpc/invoicesrpc/invoices.proto Outdated Show resolved Hide resolved
@carlaKC carlaKC self-requested a review July 19, 2021 08:48
Copy link
Collaborator

@carlaKC carlaKC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some fixups needed in the rpc changes!

Thanks for the PR! Going to be very useful to have this surfaced.

lnrpc/invoicesrpc/invoices.proto Outdated Show resolved Hide resolved
lnrpc/invoicesrpc/invoices.proto Outdated Show resolved Hide resolved
}{
PayReq: resp.PaymentRequest,
})
printRespJSON(resp)
Copy link
Contributor Author

@ErikEk ErikEk Jul 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, this update changes one of the json response items from "pay_req" to "payment_request", as defined in the proto file. I thought it was worth it, to mimic the response from addinvoice, as closely as possible.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's okay. Hopefully scripts use the gRPC interface directly and don't parse the output of lncli.

@ErikEk ErikEk force-pushed the invoices-return-payment-address-addholdinvoice branch from 99641f3 to 49094cf Compare July 19, 2021 14:56
@ErikEk
Copy link
Contributor Author

ErikEk commented Jul 19, 2021

Code has now been updated.

@ErikEk ErikEk force-pushed the invoices-return-payment-address-addholdinvoice branch from 49094cf to 850dee3 Compare July 19, 2021 15:05
@guggero guggero self-requested a review July 19, 2021 16:09
@carlaKC carlaKC self-requested a review July 20, 2021 07:25
Copy link
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks 🎉

}{
PayReq: resp.PaymentRequest,
})
printRespJSON(resp)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's okay. Hopefully scripts use the gRPC interface directly and don't parse the output of lncli.

@ErikEk ErikEk changed the title invoices: return payment address from addholdinvoice invoices: return payment address and add index from addholdinvoice Jul 20, 2021
Copy link
Collaborator

@carlaKC carlaKC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK

$ lncli addholdinvoice 74e03041f676fc0fe3d19980c6b7a06d947fbd91879b02c410fb8bf86cb79025                                                                                                                                                                          
{
    "payment_request": "lnbcrt1ps0d0empp5wnsrqs0kwm7qlc73nxqvddaqdk28l0v3s7ds93qslw9lsm9hjqjsdqqcqzpgxqyz5vqsp5se4cpj3qu29gnwr4xuyntc95q6w4kfk7j7zzx5vhy46pgqyzzx8s9qyyssq9ycn8ul5eugrftulj6wtgmhnge40epetcl5828kxvmsu2yz33huz0eeea28kwn0uhn4cu0pe97y0l45gwnaa0aagvwd8dtt7yx4wpmgpfm7ggk",
    "add_index": "11",
    "payment_addr": "866b80ca20e28a89b875370935e0b4069d5b26de97842351972574140082118f"
}

@guggero guggero added this to the v0.14.0 milestone Jul 20, 2021
@Roasbeef Roasbeef merged commit 30a0e6c into lightningnetwork:master Jul 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Return payment address when adding hold invoices
4 participants