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

channeldb+lnrpc: invoice state #2354

Merged
merged 2 commits into from
Jan 4, 2019

Conversation

joostjager
Copy link
Contributor

This PR converts the invoice settled boolean into a state. This is a preparation that enables creation of new invoice states.

@joostjager joostjager changed the title Invoice state channeldb+lnrpc: invoice state Dec 20, 2018
@joostjager joostjager force-pushed the invoice-state branch 2 times, most recently from f6c8849 to f890ff7 Compare December 20, 2018 09:05
channeldb/invoices.go Outdated Show resolved Hide resolved
@@ -2334,7 +2334,7 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg,
// TODO(conner): track ownership of settlements to
// properly recover from failures? or add batch invoice
// settlement
if invoice.Terms.Settled {
if invoice.Terms.State != channeldb.ContractOpen {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this intended? Comment should possibly be updated to reflect change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. In this PR both are equivalent, but I am inverting the condition as a preparation for the hold invoice.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same for comment below

invoiceregistry.go Outdated Show resolved Hide resolved
invoiceregistry.go Outdated Show resolved Hide resolved
invoiceregistry.go Show resolved Hide resolved
invoiceregistry.go Show resolved Hide resolved
@joostjager
Copy link
Contributor Author

comments processed

@joostjager
Copy link
Contributor Author

also added String() for ContractState type

@Roasbeef Roasbeef added database Related to the database/storage of LND payments Related to invoices/payments P2 should be fixed if one has time labels Dec 21, 2018
Roasbeef
Roasbeef previously approved these changes Jan 3, 2019
Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

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

LGTM 🐝

One minor nit/clarification, but generally good on my end!


// ContractSettled means the htlc is settled and the invoice has been
// paid.
ContractSettled = 1
Copy link
Member

Choose a reason for hiding this comment

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

I think this one also needs to be explicitly specified as the prior one isn't using iota?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@Roasbeef
Copy link
Member

Roasbeef commented Jan 4, 2019

Ready to land after sign+rebase! (may need to sync with some of the other PRs that also modify lnrpc protos)

This commit is a preparation for the addition of new invoice
states. A database migration is not needed because we keep
the same field length and values.
Expose the new invoice state field over rpc.
@joostjager
Copy link
Contributor Author

Ptal @Roasbeef

Copy link
Contributor

@halseth halseth left a comment

Choose a reason for hiding this comment

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

LGTM 💯

Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

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

LGTM 🍭

@Roasbeef Roasbeef merged commit 2e2d5fc into lightningnetwork:master Jan 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
database Related to the database/storage of LND P2 should be fixed if one has time payments Related to invoices/payments
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants