Skip to content

Commit

Permalink
peerInfo: Use U32 instead of BlockNumber (#288)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdamian authored Aug 16, 2022
1 parent 77783c7 commit dee2d63
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion types/peer_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ type PeerInfo struct {
Roles Text
ProtocolVersion U32
BestHash Hash
BestNumber BlockNumber
BestNumber U32
}
12 changes: 9 additions & 3 deletions types/peer_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,23 @@ func TestPeerInfo_EncodeDecode(t *testing.T) {
assertRoundtrip(t, testPeerInfo)
assertRoundTripFuzz[PeerInfo](t, 100)
assertDecodeNilData[PeerInfo](t)
assertEncodeEmptyObj[PeerInfo](t, 39)
assertEncodeEmptyObj[PeerInfo](t, 42)
}

func TestPeerInfo_Encode(t *testing.T) {
assertEncode(t, []encodingAssert{
{testPeerInfo, MustHexDecodeString("0x20616263313233343528736f6d6520726f6c65737b000000abcd000000000000000000000000000000000000000000000000000000000000e514")}, //nolint:lll
{
testPeerInfo,
MustHexDecodeString("0x20616263313233343528736f6d6520726f6c65737b000000abcd00000000000000000000000000000000000000000000000000000000000039050000"),
},
})
}

func TestPeerInfo_Decode(t *testing.T) {
assertDecode(t, []decodingAssert{
{MustHexDecodeString("0x20616263313233343528736f6d6520726f6c65737b000000abcd000000000000000000000000000000000000000000000000000000000000e514"), testPeerInfo}, //nolint:lll
{
MustHexDecodeString("0x20616263313233343528736f6d6520726f6c65737b000000abcd00000000000000000000000000000000000000000000000000000000000039050000"),
testPeerInfo,
},
})
}

0 comments on commit dee2d63

Please sign in to comment.