This PR makes use of go 1.13 error handling, wrapping errors and using
errors.Is to check a wrapped root-cause. It also removes the travis
builders for go 1.11 and go 1.12.
This adds a new API method on core.BlockChain to allow interrupting
running data inserts, and calls the method before shutting down the
downloader.
The BlockChain interrupt checks are now done through a method instead
of inlining the atomic load everywhere. There is no loss of efficiency from
this and it makes the interrupt protocol a lot clearer because the check is
defined next to the method that sets the flag.
This PR reimplements the light client server pool. It is also a first step
to move certain logic into a new lespay package. This package will contain
the implementation of the lespay token sale functions, the token buying and
selling logic and other components related to peer selection/prioritization
and service quality evaluation. Over the long term this package will be
reusable for incentivizing future protocols.
Since the LES peer logic is now based on enode.Iterator, it can now use
DNS-based fallback discovery to find servers.
This document describes the function of the new components:
https://gist.github.com/zsfelfoldi/3c7ace895234b7b345ab4f71dab102d4
* abi/bind/backends: testcase for double-lock
* accounts: add blockByNumberNoLock to avoid double-lock
* backend/simulated: use stateroot, not blockhash for retrieveing state
Co-authored-by: Martin Holst Swende <martin@swende.se>
* cmd/clef, signer/core: use better terminal input for passwords, make it possible to avoid boot-up warning
* all: move commonly used prompter to isolated (small) package
* cmd/clef: Add new --acceptWarn to clef README
* cmd/clef: rename flag 'acceptWarn' to 'suppress-bootwarn'
Co-authored-by: ligi <ligi@ligi.de>
* accounts/abi: simplified reflection logic
* accounts/abi: simplified reflection logic
* accounts/abi: removed unpack
* accounts/abi: removed comments
* accounts/abi: removed uneccessary complications
* accounts/abi: minor changes in error messages
* accounts/abi: removed unnused code
* accounts/abi: fixed indexed argument unpacking
* accounts/abi: removed superfluous test cases
This commit removes two test cases. The first one is trivially invalid as we have the same
test cases as passing in packing_test.go L375. The second one passes now,
because we don't need the mapArgNamesToStructFields in unpack_atomic anymore.
Checking for purely underscored arg names generally should not be something we do
as the abi/contract is generally out of the control of the user.
* accounts/abi: removed comments, debug println
* accounts/abi: added commented out code
* accounts/abi: addressed comments
* accounts/abi: remove unnecessary dst.CanSet check
* accounts/abi: added dst.CanSet checks
* accounts/abi: allow overloaded argument names
In solidity it is possible to create the following contract:
```
contract Overloader {
struct F { uint _f; uint __f; uint f; }
function f(F memory f) public {}
}
```
This however resulted in a panic in the abi package.
* accounts/abi fixed error handling
* accounts/abi/bind: added test cases for waitDeployed
* accounts/abi/bind: added test case for boundContract
* accounts/abi/bind: removed unnecessary resolve methods
* accounts/abi: moved topics from /bind to /abi
* accounts/abi/bind: cleaned up format... functions
* accounts/abi: improved log message
* accounts/abi: added type tests
* accounts/abi/bind: remove superfluous template methods
* cmd, miner: add noempty-precommit flag
* cmd, miner: get rid of external flag
* miner: change bool to atomic int
* miner: fix tiny typo
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
* cmd, core, eth: init tx lookup in background
* core/rawdb: tiny log fixes to make it clearer what's happening
* core, eth: fix rebase errors
* core/rawdb: make reindexing less generic, but more optimal
* rlp: implement rlp list iterator
* core/rawdb: new implementation of tx indexing/unindex using generic tx iterator and hashing rlp-data
* core/rawdb, cmd/utils: fix review concerns
* cmd/utils: fix merge issue
* core/rawdb: add some log formatting polishes
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
* p2p: add low port check in dialer
We already have a check like this for UDP ports, add a similar one in
the dialer. This prevents dials to port zero and it's also an extra
layer of protection against spamming HTTP servers.
* p2p/discover: use errLowPort in v4 code
* p2p: change port check
* p2p: add comment
* p2p/simulations/adapters: ensure assigned port is in all node records
* core/rawdb: Stop freezer process as part of freezer.Close()
When you call db.Close(), it was closing the leveldb database first,
then closing the freezer, but never stopping the freezer process.
This could cause the freezer to attempt to write to leveldb after
leveldb had been closed, leading to a crash with a non-zero exit code.
This change adds a quit channel to the freezer, and freezer.Close()
will not return until the freezer process has stopped.
Additionally, when you call freezerdb.Close(), it will close the
AncientStore before closing leveldb, to ensure that the freezer goroutine
will be stopped before leveldb is closed.
* core/rawdb: Fix formatting for golint
* core/rawdb: Use backoff flag to avoid repeating select
* core/rawdb: Include accidentally omitted backoff
* accounts/abi/bind/backend, internal/ethapi: recap gas limit with balance
* accounts, internal: address comment and fix lint
* accounts, internal: extend log message
* tiny nits to format hexutil.Big and nil properly
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
* core/state: more verbose stateb errors
* core/state: fix flaw
* core/state: fixed lint
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
This finally adds the error check that the documentation of StateDB.dbErr
promises to do. dbErr was added in 9e5f03b6c (June 2017), and the check was
already missing in that commit. We somehow survived without it for three years.
* accounts/abi/bind: add void if no return args specified
Currently the java generator generates invalid input on pure/view functions
that have no return type. e.g. `function f(uint u) view public {}`
This is not a problem in practice as people rarely ever write functions like this.
* accounts/abi/bind: use elseif instead of nested if