lnwire: add new TestMessage interface for property tests
In this commit, we add a new `TestMessage` interface for use in property tests. With this, we'll be able to generate a random instance of a given message, using the rapid byte stream. This can also eventually be useful for fuzzing.
This commit is contained in:
25 files changed
+2090
-32
No files matched your search
@@ -27,6 +27,10 @@ type KickoffSig struct {
|
||||
// interface.
|
||||
var _ Message = (*KickoffSig)(nil)
|
||||
|
||||
// A compile time check to ensure KickoffSig implements the
|
||||
// lnwire.SizeableMessage interface.
|
||||
var _ SizeableMessage = (*KickoffSig)(nil)
|
||||
|
||||
// Encode serializes the target KickoffSig into the passed bytes.Buffer
|
||||
// observing the specified protocol version.
|
||||
//
|
||||
@@ -54,3 +58,10 @@ func (ks *KickoffSig) Decode(r io.Reader, _ uint32) error {
|
||||
//
|
||||
// This is part of the lnwire.Message interface.
|
||||
func (ks *KickoffSig) MsgType() MessageType { return MsgKickoffSig }
|
||||
|
||||
// SerializedSize returns the serialized size of the message in bytes.
|
||||
//
|
||||
// This is part of the lnwire.SizeableMessage interface.
|
||||
func (ks *KickoffSig) SerializedSize() (uint32, error) {
|
||||
return MessageSerializedSize(ks)
|
||||
}
|
||||
Reference in new issue
Block a user