mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 09:53:48 +00:00
Update from geth
This commit is contained in:
commit
7bc2e4eaed
7 changed files with 29 additions and 40 deletions
2
VERSION
2
VERSION
|
|
@ -1 +1 @@
|
||||||
1.8.1
|
1.8.2
|
||||||
|
|
|
||||||
|
|
@ -36,24 +36,26 @@ const (
|
||||||
maxNodeCount = 20 // maximum number of fetcherTreeNode entries remembered for each peer
|
maxNodeCount = 20 // maximum number of fetcherTreeNode entries remembered for each peer
|
||||||
)
|
)
|
||||||
|
|
||||||
// lightFetcher
|
// lightFetcher implements retrieval of newly announced headers. It also provides a peerHasBlock function for the
|
||||||
|
// ODR system to ensure that we only request data related to a certain block from peers who have already processed
|
||||||
|
// and announced that block.
|
||||||
type lightFetcher struct {
|
type lightFetcher struct {
|
||||||
pm *ProtocolManager
|
pm *ProtocolManager
|
||||||
odr *LesOdr
|
odr *LesOdr
|
||||||
chain *light.LightChain
|
chain *light.LightChain
|
||||||
|
|
||||||
|
lock sync.Mutex // lock protects access to the fetcher's internal state variables except sent requests
|
||||||
maxConfirmedTd *big.Int
|
maxConfirmedTd *big.Int
|
||||||
peers map[*peer]*fetcherPeerInfo
|
peers map[*peer]*fetcherPeerInfo
|
||||||
lastUpdateStats *updateStatsEntry
|
lastUpdateStats *updateStatsEntry
|
||||||
|
|
||||||
lock sync.Mutex // qwerqwerqwe
|
|
||||||
deliverChn chan fetchResponse
|
|
||||||
reqMu sync.RWMutex
|
|
||||||
requested map[uint64]fetchRequest
|
|
||||||
timeoutChn chan uint64
|
|
||||||
requestChn chan bool // true if initiated from outside
|
|
||||||
syncing bool
|
syncing bool
|
||||||
syncDone chan *peer
|
syncDone chan *peer
|
||||||
|
|
||||||
|
reqMu sync.RWMutex // reqMu protects access to sent header fetch requests
|
||||||
|
requested map[uint64]fetchRequest
|
||||||
|
deliverChn chan fetchResponse
|
||||||
|
timeoutChn chan uint64
|
||||||
|
requestChn chan bool // true if initiated from outside
|
||||||
}
|
}
|
||||||
|
|
||||||
// fetcherPeerInfo holds fetcher-specific information about each active peer
|
// fetcherPeerInfo holds fetcher-specific information about each active peer
|
||||||
|
|
@ -560,8 +562,13 @@ func (f *lightFetcher) checkAnnouncedHeaders(fp *fetcherPeerInfo, headers []*typ
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// we ran out of recently delivered headers but have not reached a node known by this peer yet, continue matching
|
// we ran out of recently delivered headers but have not reached a node known by this peer yet, continue matching
|
||||||
td = f.chain.GetTd(header.ParentHash, header.Number.Uint64()-1)
|
hash, number := header.ParentHash, header.Number.Uint64()-1
|
||||||
header = f.chain.GetHeader(header.ParentHash, header.Number.Uint64()-1)
|
td = f.chain.GetTd(hash, number)
|
||||||
|
header = f.chain.GetHeader(hash, number)
|
||||||
|
if header == nil || td == nil {
|
||||||
|
log.Error("Missing parent of validated header", "hash", hash, "number", number)
|
||||||
|
return false
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
header = headers[i]
|
header = headers[i]
|
||||||
td = tds[i]
|
td = tds[i]
|
||||||
|
|
@ -645,13 +652,18 @@ func (f *lightFetcher) checkKnownNode(p *peer, n *fetcherTreeNode) bool {
|
||||||
if td == nil {
|
if td == nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
header := f.chain.GetHeader(n.hash, n.number)
|
||||||
|
// check the availability of both header and td because reads are not protected by chain db mutex
|
||||||
|
// Note: returning false is always safe here
|
||||||
|
if header == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
fp := f.peers[p]
|
fp := f.peers[p]
|
||||||
if fp == nil {
|
if fp == nil {
|
||||||
p.Log().Debug("Unknown peer to check known nodes")
|
p.Log().Debug("Unknown peer to check known nodes")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
header := f.chain.GetHeader(n.hash, n.number)
|
|
||||||
if !f.checkAnnouncedHeaders(fp, []*types.Header{header}, []*big.Int{td}) {
|
if !f.checkAnnouncedHeaders(fp, []*types.Header{header}, []*big.Int{td}) {
|
||||||
p.Log().Debug("Inconsistent announcement")
|
p.Log().Debug("Inconsistent announcement")
|
||||||
go f.pm.removePeer(p.id)
|
go f.pm.removePeer(p.id)
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import (
|
||||||
const (
|
const (
|
||||||
VersionMajor = 1 // Major version component of the current release
|
VersionMajor = 1 // Major version component of the current release
|
||||||
VersionMinor = 8 // Minor version component of the current release
|
VersionMinor = 8 // Minor version component of the current release
|
||||||
VersionPatch = 1 // Patch version component of the current release
|
VersionPatch = 2 // Patch version component of the current release
|
||||||
VersionMeta = "unstable" // Version metadata to append to the version string
|
VersionMeta = "unstable" // Version metadata to append to the version string
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
6
vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go
generated
vendored
6
vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go
generated
vendored
|
|
@ -48,7 +48,7 @@ var wg sync.WaitGroup // used to wait until the runloop starts
|
||||||
// started and is ready via the wg. It also serves purpose of a dummy source,
|
// started and is ready via the wg. It also serves purpose of a dummy source,
|
||||||
// thanks to it the runloop does not return as it also has at least one source
|
// thanks to it the runloop does not return as it also has at least one source
|
||||||
// registered.
|
// registered.
|
||||||
var source = C.CFRunLoopSourceCreate(refZero, 0, &C.CFRunLoopSourceContext{
|
var source = C.CFRunLoopSourceCreate(nil, 0, &C.CFRunLoopSourceContext{
|
||||||
perform: (C.CFRunLoopPerformCallBack)(C.gosource),
|
perform: (C.CFRunLoopPerformCallBack)(C.gosource),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -162,8 +162,8 @@ func (s *stream) Start() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
p := C.CFStringCreateWithCStringNoCopy(refZero, C.CString(s.path), C.kCFStringEncodingUTF8, refZero)
|
p := C.CFStringCreateWithCStringNoCopy(nil, C.CString(s.path), C.kCFStringEncodingUTF8, nil)
|
||||||
path := C.CFArrayCreate(refZero, (*unsafe.Pointer)(unsafe.Pointer(&p)), 1, nil)
|
path := C.CFArrayCreate(nil, (*unsafe.Pointer)(unsafe.Pointer(&p)), 1, nil)
|
||||||
ctx := C.FSEventStreamContext{}
|
ctx := C.FSEventStreamContext{}
|
||||||
ref := C.EventStreamCreate(&ctx, C.uintptr_t(s.info), path, C.FSEventStreamEventId(atomic.LoadUint64(&since)), latency, flags)
|
ref := C.EventStreamCreate(&ctx, C.uintptr_t(s.info), path, C.FSEventStreamEventId(atomic.LoadUint64(&since)), latency, flags)
|
||||||
if ref == nilstream {
|
if ref == nilstream {
|
||||||
|
|
|
||||||
9
vendor/github.com/rjeczalik/notify/watcher_fsevents_go1.10.go
generated
vendored
9
vendor/github.com/rjeczalik/notify/watcher_fsevents_go1.10.go
generated
vendored
|
|
@ -1,9 +0,0 @@
|
||||||
// Copyright (c) 2017 The Notify Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by the MIT license that can be
|
|
||||||
// found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build darwin,!kqueue,go1.10
|
|
||||||
|
|
||||||
package notify
|
|
||||||
|
|
||||||
const refZero = 0
|
|
||||||
14
vendor/github.com/rjeczalik/notify/watcher_fsevents_go1.9.go
generated
vendored
14
vendor/github.com/rjeczalik/notify/watcher_fsevents_go1.9.go
generated
vendored
|
|
@ -1,14 +0,0 @@
|
||||||
// Copyright (c) 2017 The Notify Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by the MIT license that can be
|
|
||||||
// found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build darwin,!kqueue,cgo,!go1.10
|
|
||||||
|
|
||||||
package notify
|
|
||||||
|
|
||||||
/*
|
|
||||||
#include <CoreServices/CoreServices.h>
|
|
||||||
*/
|
|
||||||
import "C"
|
|
||||||
|
|
||||||
var refZero = (*C.struct___CFAllocator)(nil)
|
|
||||||
6
vendor/vendor.json
vendored
6
vendor/vendor.json
vendored
|
|
@ -322,10 +322,10 @@
|
||||||
"revisionTime": "2016-11-28T21:05:44Z"
|
"revisionTime": "2016-11-28T21:05:44Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "1ESHllhZOIBg7MnlGHUdhz047bI=",
|
"checksumSHA1": "28UVHMmHx0iqO0XiJsjx+fwILyI=",
|
||||||
"path": "github.com/rjeczalik/notify",
|
"path": "github.com/rjeczalik/notify",
|
||||||
"revision": "27b537f07230b3f917421af6dcf044038dbe57e2",
|
"revision": "c31e5f2cb22b3e4ef3f882f413847669bf2652b9",
|
||||||
"revisionTime": "2018-01-03T13:19:05Z"
|
"revisionTime": "2018-02-03T14:01:15Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "5uqO4ITTDMklKi3uNaE/D9LQ5nM=",
|
"checksumSHA1": "5uqO4ITTDMklKi3uNaE/D9LQ5nM=",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue