lnwallet: add TLV blob to PaymentDescriptor + htlc add
In this commit, we add a TLV blob to the PaymentDescriptor struct. We also now thread through this value from the UpdateAddHTLC message to the PaymentDescriptor mapping, and the other way around.
This commit is contained in:
1 parent
d95c1f93f3
commit
c1e641e9d9
5 files changed
+78
-7
No files matched your search
@@ -2,6 +2,7 @@ package lnwallet
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
crand "crypto/rand"
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
@@ -10431,19 +10432,26 @@ func assertPayDescMatchHTLC(t *testing.T, pd PaymentDescriptor,
|
||||
// the `Incoming`.
|
||||
func createRandomHTLC(t *testing.T, incoming bool) channeldb.HTLC {
|
||||
var onionBlob [lnwire.OnionPacketSize]byte
|
||||
_, err := rand.Read(onionBlob[:])
|
||||
_, err := crand.Read(onionBlob[:])
|
||||
require.NoError(t, err)
|
||||
|
||||
var rHash [lntypes.HashSize]byte
|
||||
_, err = rand.Read(rHash[:])
|
||||
_, err = crand.Read(rHash[:])
|
||||
require.NoError(t, err)
|
||||
|
||||
sig := make([]byte, 64)
|
||||
_, err = rand.Read(sig)
|
||||
_, err = crand.Read(sig)
|
||||
require.NoError(t, err)
|
||||
|
||||
randCustomData := make([]byte, 32)
|
||||
_, err = crand.Read(randCustomData)
|
||||
require.NoError(t, err)
|
||||
|
||||
randCustomType := rand.Intn(255) + lnwire.MinCustomRecordsTlvType
|
||||
|
||||
blinding, err := pubkeyFromHex(
|
||||
"0228f2af0abe322403480fb3ee172f7f1601e67d1da6cad40b54c4468d48236c39", //nolint:lll
|
||||
"0228f2af0abe322403480fb3ee172f7f1601e67d1da6cad40b54c4468d48" +
|
||||
"236c39",
|
||||
)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -10458,9 +10466,13 @@ func createRandomHTLC(t *testing.T, incoming bool) channeldb.HTLC {
|
||||
HtlcIndex: rand.Uint64(),
|
||||
LogIndex: rand.Uint64(),
|
||||
BlindingPoint: tlv.SomeRecordT(
|
||||
//nolint:lll
|
||||
tlv.NewPrimitiveRecord[lnwire.BlindingPointTlvType](blinding),
|
||||
tlv.NewPrimitiveRecord[lnwire.BlindingPointTlvType](
|
||||
blinding,
|
||||
),
|
||||
),
|
||||
CustomRecords: map[uint64][]byte{
|
||||
uint64(randCustomType): randCustomData,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user