lnwire: add tests to check payload estimates for channel announcements
This commit is contained in:
parent
3dc8cd5659
commit
1b0a0b6538
@ -28,6 +28,13 @@ func TestChannelAnnoucementEncodeDecode(t *testing.T) {
|
||||
t.Fatalf("unable to encode ChannelAnnouncement: %v", err)
|
||||
}
|
||||
|
||||
// Ensure the max payload estimate is correct.
|
||||
serializedLength := uint32(b.Len())
|
||||
if serializedLength != ca.MaxPayloadLength(0) {
|
||||
t.Fatalf("payload length estimate is incorrect: expected %v "+
|
||||
"got %v", serializedLength, ca.MaxPayloadLength(0))
|
||||
}
|
||||
|
||||
// Deserialize the encoded CA message into a new empty struct.
|
||||
ca2 := &ChannelAnnouncement{}
|
||||
if err := ca2.Decode(&b, 0); err != nil {
|
||||
|
@ -24,6 +24,13 @@ func TestChannelUpdateAnnouncementEncodeDecode(t *testing.T) {
|
||||
t.Fatalf("unable to encode ChannelUpdateAnnouncement: %v", err)
|
||||
}
|
||||
|
||||
// Ensure the max payload estimate is correct.
|
||||
serializedLength := uint32(b.Len())
|
||||
if serializedLength != cua.MaxPayloadLength(0) {
|
||||
t.Fatalf("payload length estimate is incorrect: expected %v "+
|
||||
"got %v", serializedLength, cua.MaxPayloadLength(0))
|
||||
}
|
||||
|
||||
// Deserialize the encoded CUA message into a new empty struct.
|
||||
cua2 := &ChannelUpdateAnnouncement{}
|
||||
if err := cua2.Decode(&b, 0); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user