lnwallet: thread chanType down into genHtlcScript, gen[..]SigJobs,

create[..]Tx

NO FUNCTIONAL CHANGES
This is a commit just supplying the channel types to various methods.
This commit is contained in:
Johan T. Halseth committed 2020-03-09 12:10:58 +01:00
1 parent b228681a02
commit 6ecb379088
4 files changed
+71 -42

No files matched your search

+14 -6
View File
@@ -361,7 +361,10 @@ func (cb *CommitmentBuilder) createUnsignedCommitmentTx(ourBalance,
continue
}
err := addHTLC(commitTx, isOurs, false, htlc, keyRing)
err := addHTLC(
commitTx, isOurs, false, htlc, keyRing,
cb.chanState.ChanType,
)
if err != nil {
return nil, err
}
@@ -373,7 +376,10 @@ func (cb *CommitmentBuilder) createUnsignedCommitmentTx(ourBalance,
continue
}
err := addHTLC(commitTx, isOurs, true, htlc, keyRing)
err := addHTLC(
commitTx, isOurs, true, htlc, keyRing,
cb.chanState.ChanType,
)
if err != nil {
return nil, err
}
@@ -485,7 +491,8 @@ func CreateCommitTx(chanType channeldb.ChannelType,
// genHtlcScript generates the proper P2WSH public key scripts for the HTLC
// output modified by two-bits denoting if this is an incoming HTLC, and if the
// HTLC is being applied to their commitment transaction or ours.
func genHtlcScript(isIncoming, ourCommit bool, timeout uint32, rHash [32]byte,
func genHtlcScript(chanType channeldb.ChannelType, isIncoming, ourCommit bool,
timeout uint32, rHash [32]byte,
keyRing *CommitmentKeyRing) ([]byte, []byte, error) {
var (
@@ -549,13 +556,14 @@ func genHtlcScript(isIncoming, ourCommit bool, timeout uint32, rHash [32]byte,
// the descriptor itself.
func addHTLC(commitTx *wire.MsgTx, ourCommit bool,
isIncoming bool, paymentDesc *PaymentDescriptor,
keyRing *CommitmentKeyRing) error {
keyRing *CommitmentKeyRing, chanType channeldb.ChannelType) error {
timeout := paymentDesc.Timeout
rHash := paymentDesc.RHash
p2wsh, witnessScript, err := genHtlcScript(isIncoming, ourCommit,
timeout, rHash, keyRing)
p2wsh, witnessScript, err := genHtlcScript(
chanType, isIncoming, ourCommit, timeout, rHash, keyRing,
)
if err != nil {
return err
}