mirror of
https://github.com/aljazceru/breez-lnd.git
synced 2025-12-21 16:14:24 +01:00
lnwire: morph CommitSignature into CommitSig
This commit renames and modifies the CommitSignature message to more closely match the CommitSig message defined within the current set of draft specifications. The major change within the new message is that we now longer explicitly specify the update log index of the remote node that this signature covers. This is due to the fact the revocation message now also double as acknowledgements of the remote parties recevied commitment update messages.
This commit is contained in:
32
lnwire/commit_sig_test.go
Normal file
32
lnwire/commit_sig_test.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package lnwire
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCommitSigEncodeDecode(t *testing.T) {
|
||||
commitSignature := &CommitSig{
|
||||
ChannelPoint: *outpoint1,
|
||||
CommitSig: commitSig,
|
||||
}
|
||||
|
||||
// Next encode the CS message into an empty bytes buffer.
|
||||
var b bytes.Buffer
|
||||
if err := commitSignature.Encode(&b, 0); err != nil {
|
||||
t.Fatalf("unable to encode CommitSig: %v", err)
|
||||
}
|
||||
|
||||
// Deserialize the encoded EG message into a new empty struct.
|
||||
commitSignature2 := &CommitSig{}
|
||||
if err := commitSignature2.Decode(&b, 0); err != nil {
|
||||
t.Fatalf("unable to decode CommitSig: %v", err)
|
||||
}
|
||||
|
||||
// Assert equality of the two instances.
|
||||
if !reflect.DeepEqual(commitSignature, commitSignature2) {
|
||||
t.Fatalf("encode/decode error messages don't match %#v vs %#v",
|
||||
commitSignature, commitSignature2)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user