p2p/enode: remove key storage

This commit is contained in:
Felix Lange 2020-03-13 14:37:58 +01:00
parent 264ea81fff
commit e33008c1c1
2 changed files with 1 additions and 19 deletions

View file

@ -49,7 +49,6 @@ const (
dbNodePing = "lastping" dbNodePing = "lastping"
dbNodePong = "lastpong" dbNodePong = "lastpong"
dbNodeSeq = "seq" dbNodeSeq = "seq"
dbNodeKeys = "keys"
// Local information is keyed by ID only, the full key is "local:<ID>:seq". // Local information is keyed by ID only, the full key is "local:<ID>:seq".
// Use localItemKey to create those keys. // Use localItemKey to create those keys.
@ -400,23 +399,6 @@ func (db *DB) UpdateFindFailsV5(id ID, ip net.IP, fails int) error {
return db.storeInt64(v5Key(id, ip, dbNodeFindFails), int64(fails)) return db.storeInt64(v5Key(id, ip, dbNodeFindFails), int64(fails))
} }
// KeysV5 retrieves discv5 AES keys.
func (db *DB) KeysV5(id ID, ip net.IP) ([]byte, []byte) {
k, _ := db.lvl.Get(v5Key(id, ip, dbNodeKeys), nil)
if len(k) == 0 {
return nil, nil
}
return k[:16], k[16:32]
}
// StoreKeysV5 stores discv5 AES keys.
func (db *DB) StoreKeysV5(id ID, ip net.IP, w, r []byte) error {
k := make([]byte, len(w)+len(r))
copy(k, w)
copy(k[len(w):], r)
return db.lvl.Put(v5Key(id, ip, dbNodeKeys), k, nil)
}
// LocalSeq retrieves the local record sequence counter. // LocalSeq retrieves the local record sequence counter.
func (db *DB) localSeq(id ID) uint64 { func (db *DB) localSeq(id ID) uint64 {
return db.fetchUint64(localItemKey(id, dbLocalSeq)) return db.fetchUint64(localItemKey(id, dbLocalSeq))

View file

@ -471,7 +471,7 @@ func TestDBExpireV5(t *testing.T) {
ip := net.IP{127, 0, 0, 1} ip := net.IP{127, 0, 0, 1}
key := make([]byte, 16) key := make([]byte, 16)
db.StoreKeysV5(ID{}, ip, key, key) db.StoreFindFailsV5(ID{}, ip, key, key)
db.expireNodes() db.expireNodes()
} }