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

Static key refactoring #1463

Merged
merged 3 commits into from
Jun 22, 2020
Merged

Static key refactoring #1463

merged 3 commits into from
Jun 22, 2020

Conversation

pm47
Copy link
Member

@pm47 pm47 commented Jun 19, 2020

See commits description. They are independent and can be reviewed separately.

pm47 added 3 commits June 19, 2020 14:09
Use `getOrElse` on the option value to decide between static/dynamic
payment point, instead of the `ChannelVersion` bit.
Also reduce visibility of a few members of `ChannelVersion`, and some
cleanup.
case v if v.isSet(USE_STATIC_REMOTEKEY_BIT) => localParams.localPaymentBasepoint.get
case _ => keyManager.paymentPoint(channelKeyPath).publicKey
}
val localPaymentBasepoint = localParams.staticPaymentBasepoint.getOrElse(keyManager.paymentPoint(channelKeyPath).publicKey)
Copy link
Member

Choose a reason for hiding this comment

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

it looks better, but now it does not check that localParams.staticPaymentBasepoint is defined iff channelVersion activates option_static_remote_key

Copy link
Member Author

Choose a reason for hiding this comment

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

It kind of does, here:

require(!channelVersion.isSet(USE_STATIC_REMOTEKEY_BIT) || (channelVersion.isSet(USE_STATIC_REMOTEKEY_BIT) && localParams.localPaymentBasepoint.isDefined), s"localParams.localPaymentBasepoint must be defined for commitments with version=$channelVersion")

I think that's consistent with how remote works: we just use the value they give us and assume it follows the static feature bit.

@pm47 pm47 requested a review from sstone June 19, 2020 14:34
Copy link
Member

@t-bast t-bast left a comment

Choose a reason for hiding this comment

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

LGTM

@pm47 pm47 merged commit e07a8ec into master Jun 22, 2020
@pm47 pm47 deleted the static-key-refactoring branch June 22, 2020 08:49
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.

3 participants