mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-21 14:10:35 +02:00
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:
@@ -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
|
||||
|
Reference in New Issue
Block a user