aboutsummaryrefslogtreecommitdiffstats
path: root/light
diff options
context:
space:
mode:
authorFelix Lange <fjl@users.noreply.github.com>2016-12-13 03:46:15 +0800
committerGitHub <noreply@github.com>2016-12-13 03:46:15 +0800
commita98e8c0889d7c4c1bded452c577bd4b9c7fa0f6b (patch)
treefaccd87d6e1634b51f788fa170bc1f03a829ca42 /light
parentee445a2ba4013f8b32e4e5386322babf022e5b81 (diff)
parentf12f8a6c14dbaf6e6531cea1b0cf169b851e1894 (diff)
downloaddexon-a98e8c0889d7c4c1bded452c577bd4b9c7fa0f6b.tar.gz
dexon-a98e8c0889d7c4c1bded452c577bd4b9c7fa0f6b.tar.zst
dexon-a98e8c0889d7c4c1bded452c577bd4b9c7fa0f6b.zip
Merge pull request #3413 from zsfelfoldi/light-topic4
les, p2p/discv5: implement server pool, improve peer selection, light fetcher and topic searching
Diffstat (limited to 'light')
-rw-r--r--light/lightchain.go11
-rw-r--r--light/odr.go15
-rw-r--r--light/odr_util.go5
3 files changed, 23 insertions, 8 deletions
diff --git a/light/lightchain.go b/light/lightchain.go
index 1cea7a892..d397f5006 100644
--- a/light/lightchain.go
+++ b/light/lightchain.go
@@ -505,3 +505,14 @@ func (self *LightChain) SyncCht(ctx context.Context) bool {
}
return false
}
+
+// LockChain locks the chain mutex for reading so that multiple canonical hashes can be
+// retrieved while it is guaranteed that they belong to the same version of the chain
+func (self *LightChain) LockChain() {
+ self.chainmu.RLock()
+}
+
+// UnlockChain unlocks the chain mutex
+func (self *LightChain) UnlockChain() {
+ self.chainmu.RUnlock()
+}
diff --git a/light/odr.go b/light/odr.go
index 679569bf9..4f6ef6b9e 100644
--- a/light/odr.go
+++ b/light/odr.go
@@ -48,6 +48,7 @@ type OdrRequest interface {
// TrieID identifies a state or account storage trie
type TrieID struct {
BlockHash, Root common.Hash
+ BlockNumber uint64
AccKey []byte
}
@@ -55,9 +56,10 @@ type TrieID struct {
// header.
func StateTrieID(header *types.Header) *TrieID {
return &TrieID{
- BlockHash: header.Hash(),
- AccKey: nil,
- Root: header.Root,
+ BlockHash: header.Hash(),
+ BlockNumber: header.Number.Uint64(),
+ AccKey: nil,
+ Root: header.Root,
}
}
@@ -66,9 +68,10 @@ func StateTrieID(header *types.Header) *TrieID {
// checking Merkle proofs.
func StorageTrieID(state *TrieID, addr common.Address, root common.Hash) *TrieID {
return &TrieID{
- BlockHash: state.BlockHash,
- AccKey: crypto.Keccak256(addr[:]),
- Root: root,
+ BlockHash: state.BlockHash,
+ BlockNumber: state.BlockNumber,
+ AccKey: crypto.Keccak256(addr[:]),
+ Root: root,
}
}
diff --git a/light/odr_util.go b/light/odr_util.go
index 5c72f90e9..761711621 100644
--- a/light/odr_util.go
+++ b/light/odr_util.go
@@ -38,8 +38,9 @@ var (
ErrNoTrustedCht = errors.New("No trusted canonical hash trie")
ErrNoHeader = errors.New("Header not found")
- ChtFrequency = uint64(4096)
- trustedChtKey = []byte("TrustedCHT")
+ ChtFrequency = uint64(4096)
+ ChtConfirmations = uint64(2048)
+ trustedChtKey = []byte("TrustedCHT")
)
type ChtNode struct {
td>2004-03-192-0/+2 * - Add SIZE to GNOME portspav2004-03-181-0/+1 * SIZEify.trevor2004-03-183-0/+3 * Add libXft after a repo-copy from Xft and update to 2.1.5. libXft is simplymarcus2004-03-173-6/+6 * Remove Xft. This port has been renamed libXft.marcus2004-03-176-106/+0 * "Update" to 2.2.2, the latest stable release with a PORTEPOCH bump.marcus2004-03-176-678/+19 * o Bump $LIB_DEPENDS line to chase expat's shlib version.kuriyama2004-03-141-2/+2 * Whoa there, boy, that's a mighty big commit y'all have there...ade2004-03-141-1/+1 * Avoid "size unknown" error by setting DISABLE_SIZE.trevor2004-03-131-0/+1 * - Style: s/@freebsd.org/@FreeBSD.org/pav2004-03-041-1/+1 * - Fix MASTER_SITESclement2004-02-231-1/+1 * Apply studly caps to "FreeBSD".trevor2004-02-071-1/+1 * Use PLIST_FILES (bento-tested, marcus-reviewed).trevor2004-02-0614-7/+7 * Use PLIST_FILES.trevor2004-02-068-5/+5 * Bump PORTREVISION on all ports that depend on gettext to aid with upgrading.marcus2004-02-0410-6/+10 * patch fromtrevor2004-02-014-12/+4 * Make fetchable, add some mirrors from gimp-devel.olgeni2004-01-301-1/+5 * SIZEify.trevor2004-01-308-0/+9 * Add size data.trevor2004-01-281-0/+1 * Add size data.trevor2004-01-281-0/+1 * Update to 1.4.1anholt2004-01-253-16/+5 * No member of the kde@ team has touched anything related to Qt2 in ages, sowill2004-01-241-1/+1 * Use the CPIO macro defined in bsd.port.mk.trevor2004-01-221-1/+1 * New port: Prerelease version of libXfont from freedesktop.org:anholt2003-12-225-0/+60 * - Use canonical form (ports@FreeBSD.org) in MAINTAINER linesergei2003-12-211-1/+1 * s/rpm2cpio/rpm2cpio.pl/ after the recent update of archivers/rpm2cpio (thenetchild2003-12-125-10/+10 * Add Code2000, a shareware Unicode reference font. It contains over 34000 glyphs!pav2003-12-096-0/+158 * - On many systems, ttmkfdir was the only reason to install freetype1.pav2003-12-096-103/+59 * Fix packing list.trevor2003-11-213-3/+6 * Define USE_PERL5_BUILD, not erroneous USE_PERL.trevor2003-11-201-1/+1 * Define USE_PERL to make Perl available for (mostly deprecated)trevor2003-11-201-0/+1 * new port providing Truetype fonts to use with Linux programstrevor2003-11-204-0/+57 * Decrease PORTREVISION from 2 to 0. I hope no one has installedtrevor2003-11-193-0/+3 * new Linux/i386 binary port of Fontconfigtrevor2003-11-1910-0/+163 * USE_REINPLACE need be defined only when REINPLACE_CMD is used.trevor2003-11-173-3/+0 * Move these ports to the new arabic category after the repocopies. Fixwill2003-11-1620-368/+0 * Switch MAINTAINER to x11@FreeBSD.org for group maintaining of these ports.anholt2003-11-126-6/+6 * utilize SITE_PERLijliao2003-10-243-87/+86 * Make fetchable.trevor2003-10-211-1/+2 * New Port: x11-fonts/ppantsfontsedwin2003-10-037-0/+62 * New arabic port: khototedwin2003-10-035-0/+84 * New arabic port: kacst_fontsedwin2003-10-036-0/+68 * New arabic port: ae_fonts_ttfedwin2003-10-036-0/+154 * New arabic port: ae_fonts_monoedwin2003-10-036-0/+62 * Update vertion to 1.2.1taoka2003-09-303-4/+4 * Fix typo in MASTER_SITES, add MASTER_SITE_SUBDIR.olgeni2003-09-283-3/+6 * Cease FreeBSD port maintainershipsedwin2003-09-241-1/+1 * Add a new MASTER_SITE since the Fontconfig site went away.marcus2003-09-183-4/+3 * Remove fontilus. It has been rolled into gnomecontrolcenter2.marcus2003-09-186-79/+0 * Bump PORTREVISION for previous commit.kris2003-08-171-1/+1 * Switch to tcl/tk 8.4 and add tcl84 virtual categorykris2003-08-171-3/+3 * 1) Move install code to Makefile rather than in patch.olgeni2003-08-034-48/+13 * RESTRICTED implies NO_CDROM and NO_PACKAGEkris2003-07-311-2/+0 * a) Fix some additional undetected fonts,maho2003-07-282-11/+18 * Updated the foundries. Especially for print/gsfont (See also PR #54647)maho2003-07-271-0/+107 * Fix dependence on rpm2cpio.trevor2003-07-201-2/+2 * This is a first for me. Correct a typo in the patch _name_ so the patchmarcus2003-07-192-1/+1 * Revert some of the FreeType code in fontconfig to fix some font renderingmarcus2003-07-192-1/+644 * Fix a problem with certain languages not having any fonts in Mozilla andmarcus2003-07-192-0/+16 * Update to 2.2.90.marcus2003-07-183-2/+4 * Correct misplaced spacesarved2003-07-101-2/+2 * Remove WWW tag: the referenced page does not say anything about the fontsolgeni2003-07-032-4/+0 * Unbreak fetch: use MASTER_SITES_SOURCEFORGE.olgeni2003-06-301-1/+1 * Use MASTER_SITES_SOURCEFORGE.olgeni2003-06-301-1/+1 * Unbreak fetch using MASTER_SITES_SOURCEFORGE.olgeni2003-06-301-1/+1 * update maintainer's email address.leeym2003-06-241-2/+2 * Update to 2.2.1.marcus2003-06-182-2/+2 * Utilize USE_GNOME= pkgconfig.adamw2003-06-171-3/+1 * Change to my FreeBSD.org addresserwin2003-06-131-1/+1 * Fix master siteache2003-06-021-1/+1 * imaintainer-update x11-fonts/p5-Font-TTF to 0.34edwin2003-05-222-2/+2 * Update to 2.1.2. This wraps up a lot of our patches, and fixes some othermarcus2003-05-1522-992/+120 * Reset Maintainer addressarved2003-04-301-1/+1 * Always use "/etc/X11/XF86Config" as the default file for fontolgeni2003-04-276-8/+6 * Add a patch to fix PCF glyph problems.marcus2003-04-254-2/+74 * Convert to new GNOME infrastructure, and sign over to gnome@.marcus2003-04-221-5/+2 * Update to 2.2.0, the fontastic-everything-finally-works release.marcus2003-04-224-71/+2 * Remove USE_GNOMENG.marcus2003-04-212-2/+0 * Add patch to avoid dereferencing a NULL pointer in freetype2. This fixesmarcus2003-04-192-0/+47 * Add a missing '\'.marcus2003-04-181-1/+1 * At least one person had problems fetching 2.1.94. Add another dist site.marcus2003-04-181-1/+2 * Update to the release version, 1.10.marcus2003-04-176-78/+77 * Update to 2.1.94.marcus2003-04-172-2/+2 * Make the fonts.dir more detailed, i.e. qualify the font names with fulladamw2003-04-162-14/+15 * Chase home page.trevor2003-04-161-1/+1 * Update to 2.1.93.marcus2003-04-137-104/+13 * Do not install the included mozilla fonts: x11-fonts/mozilla-fontsolgeni2003-04-133-106/+13 * Fix a segfault that can occur when mixing RENDER and non-RENDER fonts.marcus2003-04-074-2/+42 * * Allow these ports to build in a read-only ${PORTSDIR} [1]marcus2003-04-051-2/+1 * fontconfig-config is no longer installed. Therefore, Xft wasn't beingmarcus2003-04-052-2/+4 * Revert previous commit since it caused an infinite recursion loopmarcus2003-04-054-40/+2 * Borrow a little from kdelibs3, and add a dependency on the scalable fonts.marcus2003-04-044-8/+42 * Update to 2.1.92. This is a hacked development version that should solvemarcus2003-04-0416-326/+420 * Add -f to fc-cache to force a font cache build. This fixes GNOMEmarcus2003-03-292-6/+2 * Make sure the include directory exists before trying to copy files intomarcus2003-03-292-0/+6 * Set proper dependency.shige2003-03-251-2/+4 * Unbreak by merging changes from ports/49029 (patch-aa).olgeni2003-03-241-279/+319 * Move cabextract dependency from BUILD_DEPENDS to EXTRACT_DEPENDS todemon2003-03-191-2/+2 * Fix a bug in fontconfig's configure script that was causing fonts.confmarcus2003-03-142-2/+13 * Update XFree86 ports, including linux_dri, to 4.3.0. Set IGNORE= in dri-develanholt2003-03-1215-50/+97 * Update portkeichii2003-03-113-66/+98 * Home page and MASTER_SITE moved.olgeni2003-03-092-2/+2 * Clear moonlight beckons.ade2003-03-0732-16/+16 * Force ldconfig to run before pkg-install to fix a problem where the usermarcus2003-03-061-0/+1 * Sync with XFree86 4.3.0 release.marcus2003-03-034-2/+554 * Sync fontconfig with the XFree86 4.3.0 release.marcus2003-03-032-1/+213 * Retire comment file.trevor2003-03-012-1/+1 * * Set LC_ALL to C in MAKE_ENV to avoid creating non-well-formed XMLmarcus2003-03-012-1/+13 * * Install fc-cache and fc-list manpages [1]marcus2003-02-283-3/+9 * De-pkg-comment.marcus2003-02-262-1/+1 * Remove duplicate patch.sobomax2003-02-251-23/+0 * Suppress command echo.olgeni2003-02-234-10/+10 * De-pkg-comment my ports + some more.olgeni2003-02-2312-6/+6 * * Install the Xft manpagemarcus2003-02-234-4/+14 * De-pkg-comment.nork2003-02-232-1/+1 * Distfile was re-rolled again (only HTML and punctuation changes to themarcus2003-02-221-1/+1 * De-pkg-comment.knu2003-02-2122-11/+11 * Add a RUN_DEPENDS on fontconfig as well.marcus2003-02-211-0/+1 * Looks like we do need fc-cache since the cache files seem to vary slightlymarcus2003-02-213-13/+7