Closed vincenzopalazzo closed 2 weeks ago
Abstract the KeyManager into a trait
This is already true, see the SignerProvider
trait.
You are right @TheBlueMatt, we discuss it a little bit on discord https://discord.com/channels/915026692102316113/915026887066132481/1252677517240959109 for people interested to follow
I have been going back and forth with @TheBlueMatt for a couple of years now, and I am still unable to find a solution to work around the LDK KeyManager.
Context
LNprototest is injecting the channel keys inside the node to predict the signature (see the lampo runner code here).
This RFC proposes to extend the code of the KeyManager to inject the dev keys into the main
KeyManager
. However, it involves a lot of code that I would like to avoid keeping inside LDK. I am trying to use an adapted pattern to work around this by using the LDK KeyManager as an inner type and then changing only the methods that I need.My experimentation with the lampo codebase is failing because the adapter pattern works only if we have some sort of trait that defines the methods
KeyManager
is implementing.See the lampo code here: https://github.com/vincenzopalazzo/lampo.rs/pull/255.
So the solutions that I see are twofold:
DefaultKeyManager
that implements theKeyManager
trait as the current code does. In this way, I can use the adapter pattern without any problems because I can use dynamic dispatch to inject my channel keys. However, this could add a pointer indirection, but I am not sure without writing the code.Please note that this is not ready for review, but it is more of a discussion on how to move forward.