mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 09:23:48 +00:00
p2p/enr: change record.Seq type from uint32 to uint64 as per EIP
This commit is contained in:
parent
f9de82bdb0
commit
73923634b7
2 changed files with 6 additions and 6 deletions
|
|
@ -20,7 +20,7 @@
|
||||||
// Records contain named keys. To store and retrieve keys in a record, use the Key
|
// Records contain named keys. To store and retrieve keys in a record, use the Key
|
||||||
// interface.
|
// interface.
|
||||||
//
|
//
|
||||||
// Records must signed before transmitting them to another node. Decoding a record verifies
|
// Records must be signed before transmitting them to another node. Decoding a record verifies
|
||||||
// its signature. When creating a record, set the keys you want, then call Sign to add the
|
// its signature. When creating a record, set the keys you want, then call Sign to add the
|
||||||
// signature. Modifying a record invalidates the signature.
|
// signature. Modifying a record invalidates the signature.
|
||||||
//
|
//
|
||||||
|
|
@ -61,7 +61,7 @@ var (
|
||||||
|
|
||||||
// Record represents a node record. The zero value is an empty record.
|
// Record represents a node record. The zero value is an empty record.
|
||||||
type Record struct {
|
type Record struct {
|
||||||
seq uint32 // sequence number
|
seq uint64 // sequence number
|
||||||
signature []byte // the signature
|
signature []byte // the signature
|
||||||
raw []byte // RLP encoded record
|
raw []byte // RLP encoded record
|
||||||
pairs []pair // sorted list of all key/value pairs
|
pairs []pair // sorted list of all key/value pairs
|
||||||
|
|
@ -79,19 +79,19 @@ func (r *Record) Signed() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Seq returns the sequence number.
|
// Seq returns the sequence number.
|
||||||
func (r *Record) Seq() uint32 {
|
func (r *Record) Seq() uint64 {
|
||||||
return r.seq
|
return r.seq
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetSeq updates the record sequence number. This invalidates any signature on the record.
|
// SetSeq updates the record sequence number. This invalidates any signature on the record.
|
||||||
// Calling SetSeq is usually not required because signing the redord increments the
|
// Calling SetSeq is usually not required because signing the redord increments the
|
||||||
// sequence number.
|
// sequence number.
|
||||||
func (r *Record) SetSeq(s uint32) {
|
func (r *Record) SetSeq(s uint64) {
|
||||||
r.signature = nil
|
r.signature = nil
|
||||||
r.seq = s
|
r.seq = s
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load retrieves the valud of a key/value pair. The given Key must be a pointer and will
|
// Load retrieves the value of a key/value pair. The given Key must be a pointer and will
|
||||||
// be set to the value of the key in the record.
|
// be set to the value of the key in the record.
|
||||||
//
|
//
|
||||||
// Errors returned by Load are wrapped in KeyError. You can distinguish decoding errors
|
// Errors returned by Load are wrapped in KeyError. You can distinguish decoding errors
|
||||||
|
|
|
||||||
|
|
@ -247,7 +247,7 @@ func TestPythonInterop(t *testing.T) {
|
||||||
|
|
||||||
var (
|
var (
|
||||||
wantAddr, _ = hex.DecodeString("caaa1485d83b18b32ed9ad666026151bf0cae8a0a88c857ae2d4c5be2daa6726")
|
wantAddr, _ = hex.DecodeString("caaa1485d83b18b32ed9ad666026151bf0cae8a0a88c857ae2d4c5be2daa6726")
|
||||||
wantSeq = uint32(1)
|
wantSeq = uint64(1)
|
||||||
wantIP = IP4(net.ParseIP("127.0.0.1").To4())
|
wantIP = IP4(net.ParseIP("127.0.0.1").To4())
|
||||||
wantDiscport = DiscPort(30303)
|
wantDiscport = DiscPort(30303)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue