lnwire_test: fix BenchmarkReadMessage test

The addition of AliasScid in the tlv_stream field of the
funding_locked msg made the requirement for testdata of the
ExtraOpaqueData part for the funding_locked msg type more strict.
Now the input testdata for the funding_locked test is more specific
and includes the new added AliasScid tlv record.
This commit is contained in:
ziggie
2023-01-24 21:41:11 +01:00
parent 8df4edef1b
commit 8f4e9d68d0

View File

@@ -452,8 +452,20 @@ func newMsgChannelReady(t testing.TB, r io.Reader) *lnwire.ChannelReady {
pubKey := randPubKey(t)
msg := lnwire.NewChannelReady(lnwire.ChannelID(c), pubKey)
msg.ExtraData = createExtraData(t, r)
// When testing the ChannelReady msg type in the WriteMessage
// function we need to populate the alias here to test the encoding
// of the TLV stream.
aliasScid := lnwire.NewShortChanIDFromInt(rand.Uint64())
msg := &lnwire.ChannelReady{
ChanID: lnwire.ChannelID(c),
NextPerCommitmentPoint: pubKey,
AliasScid: &aliasScid,
ExtraData: make([]byte, 0),
}
// We do not include the TLV record (aliasScid) into the ExtraData
// because when the msg is encoded the ExtraData is overwritten
// with the current aliasScid value.
return msg
}