mirror of
https://github.com/aljazceru/breez-lnd.git
synced 2025-12-17 22:24:21 +01: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:
@@ -6,7 +6,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
@@ -18,8 +17,8 @@ type mockSigner struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func (m *mockSigner) SignMessage(pk *btcec.PublicKey,
|
||||
msg []byte) (input.Signature, error) {
|
||||
func (m *mockSigner) SignMessage(_ keychain.KeyLocator,
|
||||
_ []byte) (*btcec.Signature, error) {
|
||||
|
||||
if m.err != nil {
|
||||
return nil, m.err
|
||||
@@ -32,7 +31,7 @@ var _ lnwallet.MessageSigner = (*mockSigner)(nil)
|
||||
|
||||
var (
|
||||
privKey, _ = btcec.NewPrivateKey(btcec.S256())
|
||||
privKeySigner = &keychain.PrivKeyMessageSigner{PrivKey: privKey}
|
||||
privKeySigner = keychain.NewPrivKeyMessageSigner(privKey, testKeyLoc)
|
||||
|
||||
pubKey = privKey.PubKey()
|
||||
|
||||
@@ -130,7 +129,7 @@ func TestUpdateDisableFlag(t *testing.T) {
|
||||
// Attempt to update and sign the new update, specifying
|
||||
// disabled or enabled as prescribed in the test case.
|
||||
err := netann.SignChannelUpdate(
|
||||
tc.signer, pubKey, newUpdate,
|
||||
tc.signer, testKeyLoc, newUpdate,
|
||||
netann.ChanUpdSetDisable(tc.disable),
|
||||
netann.ChanUpdSetTimestamp,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user