mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-25 15:20:24 +01:00
Currently all channel keys and their basepoints exist uniformly as `PublicKey` type, which not only makes in harder for a developer to distinguish those entities, but also does not engage the language type system to check if the correct key is being used in any particular function. Having struct wrappers around keys also enables more nuanced semantics allowing to express Lightning Protocol rules in language. For example, the code allows to derive `HtlcKey` from `HtlcBasepoint` and not from `PaymentBasepoint`. This change is transparent for channel monitors that will use the internal public key of a wrapper. Payment, DelayedPayment, HTLC and Revocation basepoints and their derived keys are now wrapped into a specific struct that make it distinguishable for the Rust type system. Functions that require a specific key or basepoint should not use generic Public Key, but require a specific key wrapper struct to engage Rust type verification system and make it more clear for developers which key is used. |
||
---|---|---|
.. | ||
src | ||
Cargo.toml |