mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-29 06:42:56 +02:00
multi: use key locator for lnwallet.MessageSigner
To simplify the message signing API even further, we refactor the lnwallet.MessageSigner interface to use a key locator instead of the public key to identify which key should be signed with.
This commit is contained in:
@@ -43,6 +43,8 @@ const (
|
||||
var (
|
||||
// Just use some arbitrary bytes as delivery script.
|
||||
dummyDeliveryScript = channels.AlicesPrivKey
|
||||
|
||||
testKeyLoc = keychain.KeyLocator{Family: keychain.KeyFamilyNodeKey}
|
||||
)
|
||||
|
||||
// noUpdate is a function which can be used as a parameter in createTestPeer to
|
||||
@@ -58,10 +60,15 @@ func createTestPeer(notifier chainntnfs.ChainNotifier,
|
||||
mockSwitch *mockMessageSwitch) (
|
||||
*Brontide, *lnwallet.LightningChannel, func(), error) {
|
||||
|
||||
nodeKeyLocator := keychain.KeyLocator{
|
||||
Family: keychain.KeyFamilyNodeKey,
|
||||
}
|
||||
aliceKeyPriv, aliceKeyPub := btcec.PrivKeyFromBytes(
|
||||
btcec.S256(), channels.AlicesPrivKey,
|
||||
)
|
||||
aliceKeySigner := &keychain.PrivKeyMessageSigner{PrivKey: aliceKeyPriv}
|
||||
aliceKeySigner := keychain.NewPrivKeyMessageSigner(
|
||||
aliceKeyPriv, nodeKeyLocator,
|
||||
)
|
||||
bobKeyPriv, bobKeyPub := btcec.PrivKeyFromBytes(
|
||||
btcec.S256(), channels.BobsPrivKey,
|
||||
)
|
||||
@@ -325,6 +332,7 @@ func createTestPeer(notifier chainntnfs.ChainNotifier,
|
||||
Graph: dbAlice.ChannelGraph(),
|
||||
MessageSigner: nodeSignerAlice,
|
||||
OurPubKey: aliceKeyPub,
|
||||
OurKeyLoc: testKeyLoc,
|
||||
IsChannelActive: func(lnwire.ChannelID) bool { return true },
|
||||
ApplyChannelUpdate: func(*lnwire.ChannelUpdate) error { return nil },
|
||||
})
|
||||
|
Reference in New Issue
Block a user