lnwallet: extend the SignDescriptor to include a PrivateTweak
This commit extends the SignDescriptor with a single attribute, the ‘PrivateTweak’. The duties of the Signer interface have also been augmented to properly derive a private key using the specified tweak, iff it’s non-nil. As currently defined in order to generate the proper private key based off of a PrivateTweak, the signer is to add the tweak value to the private key for the specified public key. This generated value is to be used for signing within the specified context. This change paves the way for automatic revoked output sweeping with signatures generated directly by the Signer interface, maintaining the structure of the abstraction. A test has been added at the interface level in order to excerise each WalletController’s implementation of the key derivation as currently defined.
This commit is contained in:
4 files changed
+136
-12
No files matched your search
+6
-6
@@ -271,9 +271,9 @@ type LightningWallet struct {
|
||||
// update the commitment state.
|
||||
Signer Signer
|
||||
|
||||
// chainIO is an instance of the BlockChainIO interface. chainIO is
|
||||
// ChainIO is an instance of the BlockChainIO interface. ChainIO is
|
||||
// used to lookup the existence of outputs within the UTXO set.
|
||||
chainIO BlockChainIO
|
||||
ChainIO BlockChainIO
|
||||
|
||||
// rootKey is the root HD key derived from a WalletController private
|
||||
// key. This rootKey is used to derive all LN specific secrets.
|
||||
@@ -341,7 +341,7 @@ func NewLightningWallet(cdb *channeldb.DB, notifier chainntnfs.ChainNotifier,
|
||||
chainNotifier: notifier,
|
||||
Signer: signer,
|
||||
WalletController: wallet,
|
||||
chainIO: bio,
|
||||
ChainIO: bio,
|
||||
ChannelDB: cdb,
|
||||
msgChan: make(chan interface{}, msgBufferSize),
|
||||
nextFundingID: 0,
|
||||
@@ -961,7 +961,7 @@ func (l *LightningWallet) handleFundingCounterPartySigs(msg *addCounterPartySigs
|
||||
// Fetch the alleged previous output along with the
|
||||
// pkscript referenced by this input.
|
||||
prevOut := txin.PreviousOutPoint
|
||||
output, err := l.chainIO.GetUtxo(&prevOut.Hash, prevOut.Index)
|
||||
output, err := l.ChainIO.GetUtxo(&prevOut.Hash, prevOut.Index)
|
||||
if output == nil {
|
||||
msg.err <- fmt.Errorf("input to funding tx does not exist: %v", err)
|
||||
return
|
||||
@@ -1200,7 +1200,7 @@ func (l *LightningWallet) handleChannelOpen(req *channelOpenMsg) {
|
||||
|
||||
// Finally, create and officially open the payment channel!
|
||||
// TODO(roasbeef): CreationTime once tx is 'open'
|
||||
channel, _ := NewLightningChannel(l.Signer, l.chainIO, l.chainNotifier,
|
||||
channel, _ := NewLightningChannel(l.Signer, l.ChainIO, l.chainNotifier,
|
||||
res.partialState)
|
||||
|
||||
res.chanOpen <- channel
|
||||
@@ -1242,7 +1242,7 @@ out:
|
||||
|
||||
// Finally, create and officially open the payment channel!
|
||||
// TODO(roasbeef): CreationTime once tx is 'open'
|
||||
channel, _ := NewLightningChannel(l.Signer, l.chainIO, l.chainNotifier,
|
||||
channel, _ := NewLightningChannel(l.Signer, l.ChainIO, l.chainNotifier,
|
||||
res.partialState)
|
||||
res.chanOpen <- channel
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user