lnwire: prep wire messages for TLV extensions
Messages: - UpdateFulfillHTLC - UpdateFee - UpdateFailMalformedHTLC - UpdateFailHTLC - UpdateAddHTLC - Shutdown - RevokeAndAck - ReplyShortChanIDsEnd - ReplyChannelRange - QueryShortChanIDs - QueryChannelRange - NodeAnnouncement - Init - GossipTimestampRange - FundingSigned - FundingLocked - FundingCreated - CommitSig - ClosingSigned - ChannelUpdate - ChannelReestablish - ChannelAnnouncement - AnnounceSignatures lnwire: update quickcheck tests, use constant for Error multi: update unit tests to pass deep equal assertions with messages In this commit, we update a series of unit tests in the code base to now pass due to the new wire message encode/decode logic. In many instances, we'll now manually set the extra bytes to an empty byte slice to avoid comparisons that fail due to one message having an empty byte slice and the other having a nil pointer.
This commit is contained in:
1 parent
a603ac4938
commit
9a6bb19770
32 files changed
+278
-231
No files matched your search
@@ -607,7 +607,8 @@ func TestChannelStateTransition(t *testing.T) {
|
||||
{
|
||||
LogIndex: 2,
|
||||
UpdateMsg: &lnwire.UpdateAddHTLC{
|
||||
ChanID: lnwire.ChannelID{1, 2, 3},
|
||||
ChanID: lnwire.ChannelID{1, 2, 3},
|
||||
ExtraData: make([]byte, 0),
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -628,7 +629,9 @@ func TestChannelStateTransition(t *testing.T) {
|
||||
if !reflect.DeepEqual(
|
||||
dbUnsignedAckedUpdates[0], unsignedAckedUpdates[0],
|
||||
) {
|
||||
t.Fatalf("unexpected update")
|
||||
t.Fatalf("unexpected update: expected %v, got %v",
|
||||
spew.Sdump(unsignedAckedUpdates[0]),
|
||||
spew.Sdump(dbUnsignedAckedUpdates))
|
||||
}
|
||||
|
||||
// The balances, new update, the HTLCs and the changes to the fake
|
||||
@@ -670,22 +673,25 @@ func TestChannelStateTransition(t *testing.T) {
|
||||
wireSig,
|
||||
wireSig,
|
||||
},
|
||||
ExtraData: make([]byte, 0),
|
||||
},
|
||||
LogUpdates: []LogUpdate{
|
||||
{
|
||||
LogIndex: 1,
|
||||
UpdateMsg: &lnwire.UpdateAddHTLC{
|
||||
ID: 1,
|
||||
Amount: lnwire.NewMSatFromSatoshis(100),
|
||||
Expiry: 25,
|
||||
ID: 1,
|
||||
Amount: lnwire.NewMSatFromSatoshis(100),
|
||||
Expiry: 25,
|
||||
ExtraData: make([]byte, 0),
|
||||
},
|
||||
},
|
||||
{
|
||||
LogIndex: 2,
|
||||
UpdateMsg: &lnwire.UpdateAddHTLC{
|
||||
ID: 2,
|
||||
Amount: lnwire.NewMSatFromSatoshis(200),
|
||||
Expiry: 50,
|
||||
ID: 2,
|
||||
Amount: lnwire.NewMSatFromSatoshis(200),
|
||||
Expiry: 50,
|
||||
ExtraData: make([]byte, 0),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"reflect"
|
||||
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/go-errors/errors"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
)
|
||||
@@ -23,6 +24,7 @@ func TestWaitingProofStore(t *testing.T) {
|
||||
proof1 := NewWaitingProof(true, &lnwire.AnnounceSignatures{
|
||||
NodeSignature: wireSig,
|
||||
BitcoinSignature: wireSig,
|
||||
ExtraOpaqueData: make([]byte, 0),
|
||||
})
|
||||
|
||||
store, err := NewWaitingProofStore(db)
|
||||
@@ -40,7 +42,8 @@ func TestWaitingProofStore(t *testing.T) {
|
||||
t.Fatalf("unable retrieve proof from storage: %v", err)
|
||||
}
|
||||
if !reflect.DeepEqual(proof1, proof2) {
|
||||
t.Fatal("wrong proof retrieved")
|
||||
t.Fatalf("wrong proof retrieved: expected %v, got %v",
|
||||
spew.Sdump(proof1), spew.Sdump(proof2))
|
||||
}
|
||||
|
||||
if _, err := store.Get(proof1.OppositeKey()); err != ErrWaitingProofNotFound {
|
||||
|
||||
Reference in new issue
Block a user