Skip to content

Commit a759c24

Browse files
Remove duplicate IP length constant (#2733)
1 parent adc1d4b commit a759c24

File tree

3 files changed

+2
-4
lines changed

3 files changed

+2
-4
lines changed

network/peer/ip.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func (ip *UnsignedIP) Sign(signer crypto.Signer) (*SignedIP, error) {
4444

4545
func (ip *UnsignedIP) bytes() []byte {
4646
p := wrappers.Packer{
47-
Bytes: make([]byte, wrappers.IPLen+wrappers.LongLen),
47+
Bytes: make([]byte, ips.IPPortLen+wrappers.LongLen),
4848
}
4949
ips.PackIP(&p, ip.IPPort)
5050
p.PackLong(ip.Timestamp)

utils/ips/ip_port.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
)
1414

1515
const (
16-
IPPortLen = 16 + wrappers.ShortLen
16+
IPPortLen = net.IPv6len + wrappers.ShortLen
1717
nullStr = "null"
1818
)
1919

utils/wrappers/packing.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ const (
2222
LongLen = 8
2323
// BoolLen is the number of bytes per bool
2424
BoolLen = 1
25-
// IPLen is the number of bytes per IP
26-
IPLen = 16 + ShortLen
2725
)
2826

2927
func StringLen(str string) int {

0 commit comments

Comments
 (0)