mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-14 16:03:45 +00:00
Merge branch 'ethereum:master' into portal
This commit is contained in:
commit
79c769e635
4 changed files with 14 additions and 5 deletions
|
|
@ -316,8 +316,8 @@ func ReadHeaderRange(db ethdb.Reader, number uint64, count uint64) []rlp.RawValu
|
||||||
if count == 0 {
|
if count == 0 {
|
||||||
return rlpHeaders
|
return rlpHeaders
|
||||||
}
|
}
|
||||||
// read remaining from ancients
|
// read remaining from ancients, cap at 2M
|
||||||
data, err := db.AncientRange(ChainFreezerHeaderTable, i+1-count, count, 0)
|
data, err := db.AncientRange(ChainFreezerHeaderTable, i+1-count, count, 2*1024*1024)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Failed to read headers from freezer", "err", err)
|
log.Error("Failed to read headers from freezer", "err", err)
|
||||||
return rlpHeaders
|
return rlpHeaders
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,9 @@ var (
|
||||||
// The maximum number of topic criteria allowed, vm.LOG4 - vm.LOG0
|
// The maximum number of topic criteria allowed, vm.LOG4 - vm.LOG0
|
||||||
const maxTopics = 4
|
const maxTopics = 4
|
||||||
|
|
||||||
|
// The maximum number of allowed topics within a topic criteria
|
||||||
|
const maxSubTopics = 1000
|
||||||
|
|
||||||
// filter is a helper struct that holds meta information over the filter type
|
// filter is a helper struct that holds meta information over the filter type
|
||||||
// and associated subscription in the event system.
|
// and associated subscription in the event system.
|
||||||
type filter struct {
|
type filter struct {
|
||||||
|
|
@ -539,6 +542,9 @@ func (args *FilterCriteria) UnmarshalJSON(data []byte) error {
|
||||||
return errors.New("invalid addresses in query")
|
return errors.New("invalid addresses in query")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if len(raw.Topics) > maxTopics {
|
||||||
|
return errExceedMaxTopics
|
||||||
|
}
|
||||||
|
|
||||||
// topics is an array consisting of strings and/or arrays of strings.
|
// topics is an array consisting of strings and/or arrays of strings.
|
||||||
// JSON null values are converted to common.Hash{} and ignored by the filter manager.
|
// JSON null values are converted to common.Hash{} and ignored by the filter manager.
|
||||||
|
|
@ -559,6 +565,9 @@ func (args *FilterCriteria) UnmarshalJSON(data []byte) error {
|
||||||
|
|
||||||
case []interface{}:
|
case []interface{}:
|
||||||
// or case e.g. [null, "topic0", "topic1"]
|
// or case e.g. [null, "topic0", "topic1"]
|
||||||
|
if len(topic) > maxSubTopics {
|
||||||
|
return errExceedMaxTopics
|
||||||
|
}
|
||||||
for _, rawTopic := range topic {
|
for _, rawTopic := range topic {
|
||||||
if rawTopic == nil {
|
if rawTopic == nil {
|
||||||
// null component, match all
|
// null component, match all
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ import (
|
||||||
natpmp "github.com/jackpal/go-nat-pmp"
|
natpmp "github.com/jackpal/go-nat-pmp"
|
||||||
)
|
)
|
||||||
|
|
||||||
// natPMPClient adapts the NAT-PMP protocol implementation so it conforms to
|
// pmp adapts the NAT-PMP protocol implementation so it conforms to
|
||||||
// the common interface.
|
// the common interface.
|
||||||
type pmp struct {
|
type pmp struct {
|
||||||
gw net.IP
|
gw net.IP
|
||||||
|
|
|
||||||
|
|
@ -205,8 +205,8 @@ func discoverUPnP() Interface {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// finds devices matching the given target and calls matcher for all
|
// discover finds devices matching the given target and calls matcher for
|
||||||
// advertised services of each device. The first non-nil service found
|
// all advertised services of each device. The first non-nil service found
|
||||||
// is sent into out. If no service matched, nil is sent.
|
// is sent into out. If no service matched, nil is sent.
|
||||||
func discover(out chan<- *upnp, target string, matcher func(goupnp.ServiceClient) *upnp) {
|
func discover(out chan<- *upnp, target string, matcher func(goupnp.ServiceClient) *upnp) {
|
||||||
devs, err := goupnp.DiscoverDevices(target)
|
devs, err := goupnp.DiscoverDevices(target)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue