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:
19 files changed
+184
-102
No files matched your search
@@ -15,6 +15,7 @@ import (
|
||||
"github.com/lightningnetwork/lnd/batch"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/kvdb"
|
||||
"github.com/lightningnetwork/lnd/lnpeer"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
@@ -316,6 +317,10 @@ type AuthenticatedGossiper struct {
|
||||
// selfKey is the identity public key of the backing Lightning node.
|
||||
selfKey *btcec.PublicKey
|
||||
|
||||
// selfKeyLoc is the locator for the identity public key of the backing
|
||||
// Lightning node.
|
||||
selfKeyLoc keychain.KeyLocator
|
||||
|
||||
// channelMtx is used to restrict the database access to one
|
||||
// goroutine per channel ID. This is done to ensure that when
|
||||
// the gossiper is handling an announcement, the db state stays
|
||||
@@ -355,9 +360,10 @@ type AuthenticatedGossiper struct {
|
||||
|
||||
// New creates a new AuthenticatedGossiper instance, initialized with the
|
||||
// passed configuration parameters.
|
||||
func New(cfg Config, selfKey *btcec.PublicKey) *AuthenticatedGossiper {
|
||||
func New(cfg Config, selfKeyDesc *keychain.KeyDescriptor) *AuthenticatedGossiper {
|
||||
gossiper := &AuthenticatedGossiper{
|
||||
selfKey: selfKey,
|
||||
selfKey: selfKeyDesc.PubKey,
|
||||
selfKeyLoc: selfKeyDesc.KeyLocator,
|
||||
cfg: &cfg,
|
||||
networkMsgs: make(chan *networkMsg),
|
||||
quit: make(chan struct{}),
|
||||
@@ -2567,7 +2573,7 @@ func (d *AuthenticatedGossiper) updateChannel(info *channeldb.ChannelEdgeInfo,
|
||||
// We'll generate a new signature over a digest of the channel
|
||||
// announcement itself and update the timestamp to ensure it propagate.
|
||||
err := netann.SignChannelUpdate(
|
||||
d.cfg.AnnSigner, d.selfKey, chanUpdate,
|
||||
d.cfg.AnnSigner, d.selfKeyLoc, chanUpdate,
|
||||
netann.ChanUpdSetTimestamp,
|
||||
)
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user