lnwallet: move latest SignDescriptor + serialization
This commit is contained in:
1 parent
b7e426ecdc
commit
438c6b9621
3 files changed
+72
-77
No files matched your search
@@ -224,66 +224,6 @@ type BlockChainIO interface {
|
||||
GetBlock(blockHash *chainhash.Hash) (*wire.MsgBlock, error)
|
||||
}
|
||||
|
||||
// SignDescriptor houses the necessary information required to successfully sign
|
||||
// a given output. This struct is used by the Signer interface in order to gain
|
||||
// access to critical data needed to generate a valid signature.
|
||||
type SignDescriptor struct {
|
||||
// Pubkey is the public key to which the signature should be generated
|
||||
// over. The Signer should then generate a signature with the private
|
||||
// key corresponding to this public key.
|
||||
PubKey *btcec.PublicKey
|
||||
|
||||
// SingleTweak is a scalar value that will 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 derived via the
|
||||
// following computation:
|
||||
//
|
||||
// * derivedKey = privkey + sha256(perCommitmentPoint || pubKey) mod N
|
||||
//
|
||||
// NOTE: If this value is nil, then the input can be signed using only
|
||||
// the above public key. Either a SingleTweak should be set or a
|
||||
// DoubleTweak, not both.
|
||||
SingleTweak []byte
|
||||
|
||||
// DoubleTweak is a private key that will be used in combination with
|
||||
// its corresponding private key to derive the private key that is to
|
||||
// be used to sign the target input. Within the Lightning protocol,
|
||||
// this value is typically the commitment secret from a previously
|
||||
// revoked commitment transaction. This value is in combination with
|
||||
// two hash values, and the original private key to derive the private
|
||||
// key to be used when signing.
|
||||
//
|
||||
// * k = (privKey*sha256(pubKey || tweakPub) +
|
||||
// tweakPriv*sha256(tweakPub || pubKey)) mod N
|
||||
//
|
||||
// NOTE: If this value is nil, then the input can be signed using only
|
||||
// the above public key. Either a SingleTweak should be set or a
|
||||
// DoubleTweak, not both.
|
||||
DoubleTweak *btcec.PrivateKey
|
||||
|
||||
// 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.
|
||||
WitnessScript []byte
|
||||
|
||||
// Output is the target output which should be signed. The PkScript and
|
||||
// Value fields within the output should be properly populated,
|
||||
// otherwise an invalid signature may be generated.
|
||||
Output *wire.TxOut
|
||||
|
||||
// HashType is the target sighash type that should be used when
|
||||
// generating the final sighash, and signature.
|
||||
HashType txscript.SigHashType
|
||||
|
||||
// SigHashes is the pre-computed sighash midstate to be used when
|
||||
// generating the final sighash for signing.
|
||||
SigHashes *txscript.TxSigHashes
|
||||
|
||||
// InputIndex is the target input within the transaction that should be
|
||||
// signed.
|
||||
InputIndex int
|
||||
}
|
||||
|
||||
// Signer represents an abstract object capable of generating raw signatures as
|
||||
// well as full complete input scripts given a valid SignDescriptor and
|
||||
// transaction. This interface fully abstracts away signing paving the way for
|
||||
|
||||
Reference in new issue
Block a user