-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
routerrpc: optionally return the new payment status #8177
routerrpc: optionally return the new payment status #8177
Conversation
This commit is a pure refactoring which sorts the fields in `SendPaymentRequest` so it's easier to see what number to use when adding a new field.
a639b79
to
9de6608
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice fix for a tricky upgrade situation 🌷
Wondering whether this could introduce a race in the trackpayment itest?
- The standard
Alice
/Bob
nodes are set up to send this new status, but we assert that we getIN_FLIGHT
first. - Since SubscribePayment just grabs whatever state we currently have, the first status we get could be initiated or in flight?
Perhaps that's okay because it hasn't happened since the PR with the new state was added, but may come back to haunt us.
// | ||
// TODO(yy): remove this config after the new status code is fully | ||
// deployed to the network(v0.20.0). | ||
UseStatusInitiated bool `long:"usestatusinitiated" description:"If true, the router will send Payment_INITIATED for new payments, otherwise Payment_In_FLIGHT will be sent for compatibility concerns."` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the plan here to default this to true in 19 and then remove in 20?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah think it'd give people enough time to upgrade? The other approach is to let users specify an RPC version in SendPayment
request, but that would end up being messy. My concern is, if people do not use this new flag in the coming versions, we'd still have this compatibility issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah think it'd give people enough time to upgrade? The other approach is to let users specify an RPC version in SendPayment request, but that would end up being messy.
Makes sense! Agree that putting it on the RPC is going to be ugly, we use the payment state in too many places (eg, would also need it in ListPayments
, for example).
My concern is, if people do not use this new flag in the coming versions, we'd still have this compatibility issue.
Yah this is tough. Could force it more by making this flag DisableStatusInitiated
and then people have to set it to prevent the breaking change, but there really is no easy path :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be part of every release notes (under breaking changes) until v0.20 in order for devs to check for any unwanted behavior, otherwise there won't be any real deployment process. DisableStatusInitiated
would be too dangerous, I think.
9b41f43
to
cc7948a
Compare
Nice catch @carlaKC ! I think this is indeed a case we need to fix. Turns out we need to notify the subscribers when a new payment is made, so I updated the |
cc7948a
to
484bd45
Compare
This commit adds a new config value to signal that the user understands the new payment status `StatusInitiated`.
This commit fixes `InitPayment` method to make sure the subscribers get notified when new payments are created.
This commit adds an itest case to make sure when the flag `routerrpc.usestatusinitiated` is not set, the new status is not sent.
484bd45
to
9935431
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, only one comment on strategy for getting folks upgraded (opt in vs opt out), but it's a weak opinion weakly held.
@bitromortac: review reminder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉 Concerning the transition period for the removal of the flag, it would be good to add a permanent entry in the change log under breaking changes until v0.20 saying that developers should check any unexpected behavior of their software when enabling the flag (we could link to the issue of this PR as well).
// | ||
// TODO(yy): remove this config after the new status code is fully | ||
// deployed to the network(v0.20.0). | ||
UseStatusInitiated bool `long:"usestatusinitiated" description:"If true, the router will send Payment_INITIATED for new payments, otherwise Payment_In_FLIGHT will be sent for compatibility concerns."` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be part of every release notes (under breaking changes) until v0.20 in order for devs to check for any unwanted behavior, otherwise there won't be any real deployment process. DisableStatusInitiated
would be too dangerous, I think.
Sorry to chime in a bit late. But I'm not sure I understand how this flag actually helps us with the compatibility issue? Or am I completely misunderstanding something here? |
@guggero so the idea here is if users don't explicit set this config then the new status won't be served so the clients should be able to understand the status field since nothing is changed.
yeah exactly. From client application's perspective, they set this config to know that
If the client doesn't understand it, it won't be served. Things would break, however, if
There're offline discussions that rpc flag and config flag can both work(actually using RPC flag was the initial approach), while upgrading via config has several advantages:
|
Okay, so I guess the goal of the flag then is to be able to test the new functionality (in manual or integration tests). I guess in terms of implementation simplicity that is easier indeed. My main worry would be that we wouldn't discover most issues in the wild as 99.9% of the users wouldn't turn on the flag, even after upgrading their whole stack. But we can turn this on in |
yeah i'm almost certain this would be the case😂, which is the concern mentioned here. I think a future strategy of upgrading our RPCs could be,
So in this case, this could be,
or something like that. |
Sounds good to me 👍 Thanks for all the explanations! |
Fixes #8143, this PR adds a new config value to signal whether to use the new payment status.