mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 19:00:46 +00:00
eth/protocols/snap: address review feedback on softlimit and not advertising snap2 yet
This commit is contained in:
parent
15144e391e
commit
704a86774b
3 changed files with 2 additions and 10 deletions
|
|
@ -672,9 +672,6 @@ func ServiceGetTrieNodesQuery(chain *core.BlockChain, req *GetTrieNodesPacket, s
|
||||||
// ServiceGetAccessListsQuery assembles the response to an access list query.
|
// ServiceGetAccessListsQuery assembles the response to an access list query.
|
||||||
// It is exposed to allow external packages to test protocol behavior.
|
// It is exposed to allow external packages to test protocol behavior.
|
||||||
func ServiceGetAccessListsQuery(chain *core.BlockChain, req *GetAccessListsPacket) []rlp.RawValue {
|
func ServiceGetAccessListsQuery(chain *core.BlockChain, req *GetAccessListsPacket) []rlp.RawValue {
|
||||||
if req.Bytes > softResponseLimit {
|
|
||||||
req.Bytes = softResponseLimit
|
|
||||||
}
|
|
||||||
// Cap the number of lookups
|
// Cap the number of lookups
|
||||||
if len(req.Hashes) > maxAccessListLookups {
|
if len(req.Hashes) > maxAccessListLookups {
|
||||||
req.Hashes = req.Hashes[:maxAccessListLookups]
|
req.Hashes = req.Hashes[:maxAccessListLookups]
|
||||||
|
|
@ -691,7 +688,7 @@ func ServiceGetAccessListsQuery(chain *core.BlockChain, req *GetAccessListsPacke
|
||||||
// Either the block is unknown or the BAL doesn't exist
|
// Either the block is unknown or the BAL doesn't exist
|
||||||
bals = append(bals, nil)
|
bals = append(bals, nil)
|
||||||
}
|
}
|
||||||
if bytes > req.Bytes {
|
if bytes > softResponseLimit {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,6 @@ func TestServiceGetAccessListsQuery(t *testing.T) {
|
||||||
req := &GetAccessListsPacket{
|
req := &GetAccessListsPacket{
|
||||||
ID: 1,
|
ID: 1,
|
||||||
Hashes: hashes,
|
Hashes: hashes,
|
||||||
Bytes: softResponseLimit,
|
|
||||||
}
|
}
|
||||||
result := ServiceGetAccessListsQuery(bc, req)
|
result := ServiceGetAccessListsQuery(bc, req)
|
||||||
|
|
||||||
|
|
@ -106,7 +105,6 @@ func TestServiceGetAccessListsQueryEmpty(t *testing.T) {
|
||||||
req := &GetAccessListsPacket{
|
req := &GetAccessListsPacket{
|
||||||
ID: 2,
|
ID: 2,
|
||||||
Hashes: mixed,
|
Hashes: mixed,
|
||||||
Bytes: softResponseLimit,
|
|
||||||
}
|
}
|
||||||
result := ServiceGetAccessListsQuery(bc, req)
|
result := ServiceGetAccessListsQuery(bc, req)
|
||||||
|
|
||||||
|
|
@ -149,7 +147,6 @@ func TestServiceGetAccessListsQueryCap(t *testing.T) {
|
||||||
req := &GetAccessListsPacket{
|
req := &GetAccessListsPacket{
|
||||||
ID: 3,
|
ID: 3,
|
||||||
Hashes: hashes,
|
Hashes: hashes,
|
||||||
Bytes: softResponseLimit,
|
|
||||||
}
|
}
|
||||||
result := ServiceGetAccessListsQuery(bc, req)
|
result := ServiceGetAccessListsQuery(bc, req)
|
||||||
|
|
||||||
|
|
@ -174,7 +171,6 @@ func TestServiceGetAccessListsQueryByteLimit(t *testing.T) {
|
||||||
req := &GetAccessListsPacket{
|
req := &GetAccessListsPacket{
|
||||||
ID: 0,
|
ID: 0,
|
||||||
Hashes: hashes,
|
Hashes: hashes,
|
||||||
Bytes: softResponseLimit,
|
|
||||||
}
|
}
|
||||||
result := ServiceGetAccessListsQuery(bc, req)
|
result := ServiceGetAccessListsQuery(bc, req)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ const ProtocolName = "snap"
|
||||||
|
|
||||||
// ProtocolVersions are the supported versions of the `snap` protocol (first
|
// ProtocolVersions are the supported versions of the `snap` protocol (first
|
||||||
// is primary).
|
// is primary).
|
||||||
var ProtocolVersions = []uint{SNAP2, SNAP1}
|
var ProtocolVersions = []uint{SNAP1}
|
||||||
|
|
||||||
// protocolLengths are the number of implemented message corresponding to
|
// protocolLengths are the number of implemented message corresponding to
|
||||||
// different protocol versions.
|
// different protocol versions.
|
||||||
|
|
@ -222,7 +222,6 @@ type TrieNodesPacket struct {
|
||||||
type GetAccessListsPacket struct {
|
type GetAccessListsPacket struct {
|
||||||
ID uint64 // Request ID to match up responses with
|
ID uint64 // Request ID to match up responses with
|
||||||
Hashes []common.Hash // Block hashes to retrieve BALs for
|
Hashes []common.Hash // Block hashes to retrieve BALs for
|
||||||
Bytes uint64 // Soft limit at which to stop returning data
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// AccessListsPacket is the response to GetAccessListsPacket.
|
// AccessListsPacket is the response to GetAccessListsPacket.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue