paymentsdb: add helper method to set session key

This is only used for testing because we have now a unique
contraint on the session key and need to swap it in tests for
the sql backend.
pick f17baec94 paymentsdb: fix linter
This commit is contained in:
ziggie
2025-08-26 12:24:28 +02:00
parent 335a9b3f40
commit f540e9c8ec

View File

@@ -175,6 +175,20 @@ func (h *HTLCAttemptInfo) SessionKey() *btcec.PrivateKey {
return h.cachedSessionKey
}
// setSessionKey sets the session key for the htlc attempt.
//
// NOTE: Only used for testing.
//
//nolint:unused
func (h *HTLCAttemptInfo) setSessionKey(sessionKey *btcec.PrivateKey) {
h.cachedSessionKey = sessionKey
// Also set the session key as a raw bytes.
var scratch [btcec.PrivKeyBytesLen]byte
copy(scratch[:], sessionKey.Serialize())
h.sessionKey = scratch
}
// OnionBlob returns the onion blob created from the sphinx construction.
func (h *HTLCAttemptInfo) OnionBlob() ([lnwire.OnionPacketSize]byte, error) {
var zeroBytes [lnwire.OnionPacketSize]byte