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
+10
-1
@@ -140,7 +140,7 @@ type WalletController interface {
|
||||
|
||||
// SendOutputs funds, signs, and broadcasts a Bitcoin transaction
|
||||
// paying out to the specified outputs. In the case the wallet has
|
||||
// insufficient funds, or the outputs are non-standard, and error
|
||||
// insufficient funds, or the outputs are non-standard, an error
|
||||
// should be returned.
|
||||
SendOutputs(outputs []*wire.TxOut) (*wire.ShaHash, error)
|
||||
|
||||
@@ -219,6 +219,15 @@ type SignDescriptor struct {
|
||||
// key corresponding to this public key.
|
||||
PubKey *btcec.PublicKey
|
||||
|
||||
// PrivateTweak is a scalar value that should be added to the private
|
||||
// key corresponding to the above public key to obtain the private key
|
||||
// to be used to sign this input. This value is typically a leaf node
|
||||
// from the revocation tree.
|
||||
//
|
||||
// NOTE: If this value is nil, then the input can be signed using only
|
||||
// the above public key.
|
||||
PrivateTweak []byte
|
||||
|
||||
// WitnessScript is the full script required to properly redeem the
|
||||
// output. This field will only be populated if a p2wsh or a p2sh
|
||||
// output is being signed.
|
||||
|
||||
Reference in new issue
Block a user