aboutsummaryrefslogtreecommitdiffstats
path: root/eth/backend.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-02-07 07:38:36 +0800
committerFelix Lange <fjl@twurst.com>2015-02-07 07:52:49 +0800
commit028775a0863946c1e9ad51fe7b22faa5c59b2605 (patch)
treebc3962f1ad12e421cd8f67291af7a571d364b1c4 /eth/backend.go
parent2cf4fed11b01bb99e08b838f7df2b9396f42f758 (diff)
downloadgo-tangerine-028775a0863946c1e9ad51fe7b22faa5c59b2605.tar.gz
go-tangerine-028775a0863946c1e9ad51fe7b22faa5c59b2605.tar.zst
go-tangerine-028775a0863946c1e9ad51fe7b22faa5c59b2605.zip
cmd/ethereum, cmd/mist: add flag for discovery bootstrap nodes
Diffstat (limited to 'eth/backend.go')
-rw-r--r--eth/backend.go37
1 files changed, 28 insertions, 9 deletions
diff --git a/eth/backend.go b/eth/backend.go
index 6cf2069d7..5ad0f83f4 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -2,6 +2,7 @@ package eth
import (
"fmt"
+ "strings"
"sync"
"github.com/ethereum/go-ethereum/core"
@@ -17,6 +18,8 @@ import (
"github.com/ethereum/go-ethereum/whisper"
)
+var logger = ethlogger.NewLogger("SERV")
+
type Config struct {
Name string
KeyStore string
@@ -30,13 +33,28 @@ type Config struct {
NATType string
PMPGateway string
+ // This should be a space-separated list of
+ // discovery node URLs.
+ BootNodes string
+
Shh bool
Dial bool
KeyManager *crypto.KeyManager
}
-var logger = ethlogger.NewLogger("SERV")
+func (cfg *Config) parseBootNodes() []*discover.Node {
+ var ns []*discover.Node
+ for _, url := range strings.Split(cfg.BootNodes, " ") {
+ n, err := discover.ParseNode(url)
+ if err != nil {
+ logger.Errorf("Bootstrap URL %s: %v\n", url, err)
+ continue
+ }
+ ns = append(ns, n)
+ }
+ return ns
+}
type Ethereum struct {
// Channel for shutting down the ethereum
@@ -134,13 +152,14 @@ func New(config *Config) (*Ethereum, error) {
return nil, fmt.Errorf("could not generate server key: %v", err)
}
eth.net = &p2p.Server{
- PrivateKey: netprv,
- Name: config.Name,
- MaxPeers: config.MaxPeers,
- Protocols: protocols,
- Blacklist: eth.blacklist,
- NAT: nat,
- NoDial: !config.Dial,
+ PrivateKey: netprv,
+ Name: config.Name,
+ MaxPeers: config.MaxPeers,
+ Protocols: protocols,
+ Blacklist: eth.blacklist,
+ NAT: nat,
+ NoDial: !config.Dial,
+ BootstrapNodes: config.parseBootNodes(),
}
if len(config.Port) > 0 {
eth.net.ListenAddr = ":" + config.Port
@@ -214,7 +233,7 @@ func (s *Ethereum) Coinbase() []byte {
}
// Start the ethereum
-func (s *Ethereum) Start(seedNode string) error {
+func (s *Ethereum) Start() error {
err := s.net.Start()
if err != nil {
return err
'>2018-12-1412-61/+40 * | Merge pull request #1410 from 0xProject/fix/instant/zero-quoteSteve Klebanoff2018-12-131-0/+1 |\ \ | * | fix(instant): Don't update heartbeat if amount is 0Steve Klebanoff2018-12-111-0/+1 * | | Fix bug that occurs when token metadata decimals is undefined. (#1426)Alex Browne2018-12-132-4/+18 * | | Merge pull request #1425 from 0xProject/feature/async-suffixLeonid Logvinov2018-12-1312-46/+64 |\ \ \ | * | | Fix linter errorsLeonid Logvinov2018-12-138-22/+22 | * | | Add PR numberLeonid Logvinov2018-12-131-1/+2 | * | | Fix linter errorsLeonid Logvinov2018-12-132-9/+9 | * | | Check functions Async suffixLeonid Logvinov2018-12-132-15/+32 |/ / / * | | Merge pull request #1422 from 0xProject/fix/ci/lernaIssueFabio B2018-12-122-18/+17 |\ \ \ | * | | Update the a newer version of our Lerna fork with CI fixxFabio Berger2018-12-122-18/+17 |/ / / * | | Make pull_missing_blocks script consider all events with block numbers (#1420)Alex Browne2018-12-121-1/+14 * | | Fix project references for contracts packages (#1419)Alex Browne2018-12-122-2/+11 * | | feat(sra_client.py)F. Eugene Aumson2018-12-1251-3/+6866 * | | Remove accidentally commited filesLeonid Logvinov2018-12-1236-27884/+0 * | | track idex orderbook snapshots (#1397)zkao2018-12-1214-34/+690 * | | Publishethereum-types@1.1.3@0x/website@0.0.62@0x/web3-wrapper@3.2.0@0x/utils@2.0.7@0x/typescript-typings@3.0.5@0x/types@1.4.0@0x/testnet-faucets@1.0.59@0x/subproviders@2.1.7@0x/sra-spec@1.0.12@0x/sol-resolver@1.1.0@0x/sol-doc@1.0.10@0x/sol-cov@2.1.15@0x/sol-compiler@1.1.15@0x/react-shared@1.0.24@0x/react-docs@1.0.21@0x/pipeline@1.0.1@0x/order-watcher@2.2.7@0x/order-utils@3.0.6@0x/monorepo-scripts@1.0.15@0x/migrations@2.2.1@0x/metacoin@0.0.31@0x/json-schemas@2.1.3@0x/instant@1.0.3@0x/fill-scenarios@1.0.15@0x/dev-utils@1.0.20@0x/dev-tools-pages@0.0.9@0x/contracts-test-utils@1.0.1@0x/contracts-protocol@2.1.57@0x/contract-wrappers@4.1.2@0x/connect@3.0.9@0x/base-contract@3.0.9@0x/asset-buyer@3.0.3@0x/assert@1.0.19@0x/abi-gen@1.0.18@0x/abi-gen-wrappers@2.0.10x.js@2.0.7Fabio Berger2018-12-1243-404/+402 * | | Updated CHANGELOGSFabio Berger2018-12-1292-77/+27966 * | | Refactor event scraping and add support for scraping ERC20 approval events (#...Alex Browne2018-12-1219-196/+641 * | | fix(order_utils.py): Remove stale commentF. Eugene Aumson2018-12-121-2/+0 * | | Merge pull request #1413 from 0xProject/feature/contracts-monorepo-7Leonid Logvinov2018-12-12112-451/+519 |\ \ \ | * | | Move OrderValidator to the protocol packageLeonid Logvinov2018-12-1212-23/+20 | * | | Revert accidental changeLeonid Logvinov2018-12-121-1/+1 | * | | Update contracts/examples/README.mdFabio B2018-12-121-1/+1 | * | | Merge branch 'development' into feature/contracts-monorepo-7Leonid Logvinov2018-12-11207-311/+6663 | |\ \ \ | * | | | Revert access changesLeonid Logvinov2018-12-1110-10/+10 | * | | | Upgrade solhint versionLeonid Logvinov2018-12-111-3/+3 | * | | | Re-use solhint configurationLeonid Logvinov2018-12-1116-156/+16 | * | | | Change contracts publish configLeonid Logvinov2018-12-119-9/+9 | * | | | Rename core package to protocolLeonid Logvinov2018-12-1167-26/+32 | * | | | Add coreArtifacts to forwarder wrapperLeonid Logvinov2018-12-111-1/+2 | * | | | Combine duplicate importsLeonid Logvinov2018-12-111-2/+1 | * | | | Refactor our extensions packageLeonid Logvinov2018-12-1142-304/+304 | * | | | Refactor out examplesLeonid Logvinov2018-12-1121-25/+230 * | | | | Merge pull request #1414 from 0xProject/fix/signature-utils/walletSignatureFabio B2018-12-112-1/+10 |\ \ \ \ \ | |_|_|_|/ |/| | | | | * | | | Add CHANGELOG entryFabio Berger2018-12-111-0/+9 | * | | | Actually pass the signature, not the signature index to a wallet contract's `...Fabio Berger2018-12-111-1/+1 * | | | | Add link to rexrelay integration example in instant READMEBrandon Millman2018-12-111-0/+2 | |_|/ / |/| | | * | | | chore: fix typo in instant READMEBrandon Millman2018-12-111-1/+1 * | | | chore: remove extra newlineBrandon Millman2018-12-111-1/+0 * | | | Update instant README with more integration linksBrandon Millman2018-12-111-1/+1 * | | | Fix typo in top level READMEBrandon Millman2018-12-111-7/+6 * | | | Update top level README packages list with instantBrandon Millman2018-12-111-0/+2 * | | | Update instant READMEBrandon Millman2018-12-111-0/+5 |/ / / * | | perform null check on token metadata (#1412)Xianny2018-12-111-1/+1 * | | Updated CHANGELOGSLeonid Logvinov2018-12-1155-5/+329 * | | Merge pull request #1404 from 0xProject/feature/instant/better-provider-fallbackFrancesco Agosti2018-12-116-6/+40 |\ \ \ | * | | feat: only use display name from provider in uifragosti2018-12-081-1/+1 | * | | feat: refactor provider name and displayName logicfragosti2018-12-085-9/+39 | * | | feat: log walletDisplayName to Heapfragosti2018-12-082-0/+4 * | | | Fix/pipeline/ohlcv ratelimit (#1403)Xianny2018-12-115-23/+26 |\ \ \ \ | * | | | change to camelCasexianny2018-12-112-3/+3 | * | | | lint: remove unused variablexianny2018-12-081-1/+0 | * | | | refresh rate limit every second instead of every minutexianny2018-12-081-3/+3 | * | | | cleanup: stray import, rename variablexianny2018-12-082-5/+3 | * | | | Merge branch 'fix/pipeline/ohlcv-ratelimit' of github.com:0xProject/0x-monore...xianny2018-12-080-0/+0 | |\ \ \ \ | | * | | | rename variable and define default in only 1 locationxianny2018-12-073-5/+11 | | * | | | upgrade throttling codexianny2018-12-072-14/+12 | * | | | | query CC with larger batch sizexianny2018-12-083-5/+7 | * | | | | rename variable and define default in only 1 locationxianny2018-12-083-5/+11 | * | | | | upgrade throttling codexianny2018-12-082-14/+12 | | |/ / / | |/| | | * | | | | Merge pull request #1411 from 0xProject/fix/instant/hide-loadersBrandon Millman2018-12-112-44/+14 |\ \ \ \ \ | * | | | | fix(instant): hide loaders when no token or buy amount is chosenBrandon Millman2018-12-112-44/+14 * | | | | | Merge pull request #1405 from 0xProject/tslint-changesFabio B2018-12-1112-17/+18 |\ \ \ \ \ \ | |/ / / / / |/| | | | | | * | | | | Implement prefer-template tslint rulekao2018-12-0812-17/+18 | |/ / / / * | | | | Merge pull request #1409 from 0xProject/fix/instant/custom-erc20Steve Klebanoff2018-12-111-2/+11 |\ \ \ \ \ | |_|_|_|/ |/| | | | | * | | | Don't throw error if can't find icon for tokenSteve Klebanoff2018-12-111-2/+11 * | | | | Merge pull request #1388 from 0xProject/feature/contracts-monorepo-6Leonid Logvinov2018-12-1169-147/+473 |\ \ \ \ \ | | |_|_|/ | |/| | | | * | | | Refactor out tokens from core contracts packageLeonid Logvinov2018-12-0569-147/+473 * | | | | Merge pull request #1385 from 0xProject/feature/contracts-monorepo-5Leonid Logvinov2018-12-1147-44/+287 |\ \ \ \ \ | |_|/ / / |/| | | | | * | | | Update contracts/interfaces/README.mdFabio B2018-12-071-1/+1 | |/ / / | * | | Refactor our protocol interfaces into @0x/contracts-interfacesLeonid Logvinov2018-12-0547-44/+287 * | | | Merge pull request #1402 from 0xProject/web3-wrapper/numberBigNumberMixupFabio B2018-12-093-4/+52 |\ \ \ \ | |_|/ / |/| | | | * | | Fix linterFabio Berger2018-12-081-2/+4 | * | | Add PR numberFabio Berger2018-12-071-1/+2 | * | | Remove excess commasFabio Berger2018-12-071-1/+1 | * | | fix: txData returned so that `value` and `gasPrice` are BigNumbers to avoid p...Fabio Berger2018-12-072-4/+12 | * | | Update yarn.lockFabio Berger2018-12-071-2/+39 | | |/ | |/| * | | Merge pull request #1399 from 0xProject/feature/website/disable-slider-if-no-...Francesco Agosti2018-12-073-1/+11 |\ \ \ | |/ / |/| | | * | feat: change color of doctype tag in configuratorfragosti2018-12-071-1/+1 | * | feat: disable slider when no affiliate infofragosti2018-12-062-0/+10 * | | Switch out whitepaper with 0x protocol specificationFabio Berger2018-12-069-3/+10 * | | Switch out RocketChat icon with Discord iconFabio Berger2018-12-063-1/+1 |/ / * | fix: add comma to affiliateInfo config in configuratorfragosti2018-12-061-1/+1 * | Merge pull request #1398 from 0xProject/feature/instant/more-error-reportingSteve Klebanoff2018-12-061-5/+2 |\ \ | * | feat(instant): More aggressive error reportingSteve Klebanoff2018-12-061-5/+2 |/ / * | Merge branch 'development' of https://github.com/0xProject/0x-monorepo into d...fragosti2018-12-062-31/+43 |\ \ | * | Fix/pipeline/ohlcv (#1393)Xianny2018-12-062-31/+43 * | | fix: remove target=_blank from instant linkfragosti2018-12-062-1/+1 |/ / * | Merge pull request #1369 from 0xProject/feature/website/instant-configuratorFrancesco Agosti2018-12-0621-176/+1449 |\ \ | * | feat: change New notification to point to instantfragosti2018-12-061-2/+2 | * | chore: run prettierfragosti2018-12-061-6/+1 | * | fix: ensure copy button is above codefragosti2018-12-061-1/+2 | * | feat: notify user they've copied to clipboard on copyfragosti2018-12-061-14/+29 | * | chore: make default fee percentage in configurator 0fragosti2018-12-061-1/+1 | * | Merge branch 'development' of https://github.com/0xProject/0x-monorepo into f...fragosti2018-12-06