Skip to content

Commit

Permalink
Remove duplicate IP length constant (#2733)
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenButtolph committed Feb 13, 2024
1 parent adc1d4b commit a759c24
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion network/peer/ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (ip *UnsignedIP) Sign(signer crypto.Signer) (*SignedIP, error) {

func (ip *UnsignedIP) bytes() []byte {
p := wrappers.Packer{
Bytes: make([]byte, wrappers.IPLen+wrappers.LongLen),
Bytes: make([]byte, ips.IPPortLen+wrappers.LongLen),
}
ips.PackIP(&p, ip.IPPort)
p.PackLong(ip.Timestamp)
Expand Down
2 changes: 1 addition & 1 deletion utils/ips/ip_port.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

const (
IPPortLen = 16 + wrappers.ShortLen
IPPortLen = net.IPv6len + wrappers.ShortLen
nullStr = "null"
)

Expand Down
2 changes: 0 additions & 2 deletions utils/wrappers/packing.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ const (
LongLen = 8
// BoolLen is the number of bytes per bool
BoolLen = 1
// IPLen is the number of bytes per IP
IPLen = 16 + ShortLen
)

func StringLen(str string) int {
Expand Down

0 comments on commit a759c24

Please sign in to comment.