lnwallet: store aux sig in custom data within the HTLC

We can use this space as we'll properly encode the blinded paths data
along with our custom fields before we go to write the HTLCs to the
wire.
This commit is contained in:
Olaoluwa Osuntokun 2024-07-22 19:14:57 -07:00
parent 115bad5c5c
commit 6a8da1cd80
No known key found for this signature in database
GPG key ID: 3BBD59E99B280306
2 changed files with 12 additions and 0 deletions

View file

@ -125,6 +125,10 @@ func NewAuxVerifyJob(sig fn.Option[tlv.Blob], keyRing CommitmentKeyRing,
}
}
// htlcCustomSigType is the TLV type that is used to encode the custom HTLC
// signatures within the custom data for an existing HTLC.
var htlcCustomSigType tlv.TlvType65543
// AuxSigner is an interface that is used to sign and verify HTLCs for custom
// channels. It is similar to the existing SigPool, but uses opaque blobs to
// shuffle around signature information and other metadata.

View file

@ -5496,6 +5496,14 @@ func genHtlcSigValidationJobs(chanState *channeldb.OpenChannel,
localCommitmentView.customBlob, auxLeaf,
)
// As this HTLC has a custom sign associated with it,
// store in the custom records map so we can write to
// disk later.
sigType := htlcCustomSigType.TypeVal()
htlc.CustomRecords[uint64(sigType)] = auxSig.UnwrapOr(
nil,
)
auxVerifyJobs = append(auxVerifyJobs, auxVerifyJob)
}