Browse Source

trim whitespace from elements of lists (like `persistent_peers`)

Refs #1380
pull/1389/head
Anton Kaliaev 7 years ago
committed by Ethan Buchman
parent
commit
d38a6cc7ea
2 changed files with 6 additions and 14 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +5
    -14
      node/node.go

+ 1
- 0
CHANGELOG.md View File

@ -32,6 +32,7 @@ BREAKING:
IMPROVEMENTS: IMPROVEMENTS:
- [p2p] seeds respond with a bias towards good peers - [p2p] seeds respond with a bias towards good peers
- [config] trim whitespace from elements of lists (like `persistent_peers`)
- [rpc] `/tx` and `/tx_search` responses now include the transaction hash - [rpc] `/tx` and `/tx_search` responses now include the transaction hash
- [rpc] include validator power in `/status` - [rpc] include validator power in `/status`


+ 5
- 14
node/node.go View File

@ -7,7 +7,6 @@ import (
"fmt" "fmt"
"net" "net"
"net/http" "net/http"
"strings"
abci "github.com/tendermint/abci/types" abci "github.com/tendermint/abci/types"
crypto "github.com/tendermint/go-crypto" crypto "github.com/tendermint/go-crypto"
@ -277,19 +276,11 @@ func NewNode(config *cfg.Config,
trustMetricStore = trust.NewTrustMetricStore(trustHistoryDB, trust.DefaultConfig()) trustMetricStore = trust.NewTrustMetricStore(trustHistoryDB, trust.DefaultConfig())
trustMetricStore.SetLogger(p2pLogger) trustMetricStore.SetLogger(p2pLogger)
var seeds []string
if config.P2P.Seeds != "" {
seeds = strings.Split(config.P2P.Seeds, ",")
}
var privatePeerIDs []string
if config.P2P.PrivatePeerIDs != "" {
privatePeerIDs = strings.Split(config.P2P.PrivatePeerIDs, ",")
}
pexReactor := pex.NewPEXReactor(addrBook, pexReactor := pex.NewPEXReactor(addrBook,
&pex.PEXReactorConfig{ &pex.PEXReactorConfig{
Seeds: seeds,
Seeds: cmn.SplitAndTrim(config.P2P.Seeds, ",", " "),
SeedMode: config.P2P.SeedMode, SeedMode: config.P2P.SeedMode,
PrivatePeerIDs: privatePeerIDs})
PrivatePeerIDs: cmn.SplitAndTrim(config.P2P.PrivatePeerIDs, ",", " ")})
pexReactor.SetLogger(p2pLogger) pexReactor.SetLogger(p2pLogger)
sw.AddReactor("PEX", pexReactor) sw.AddReactor("PEX", pexReactor)
} }
@ -339,7 +330,7 @@ func NewNode(config *cfg.Config,
return nil, err return nil, err
} }
if config.TxIndex.IndexTags != "" { if config.TxIndex.IndexTags != "" {
txIndexer = kv.NewTxIndex(store, kv.IndexTags(strings.Split(config.TxIndex.IndexTags, ",")))
txIndexer = kv.NewTxIndex(store, kv.IndexTags(cmn.SplitAndTrim(config.TxIndex.IndexTags, ",", " ")))
} else if config.TxIndex.IndexAllTags { } else if config.TxIndex.IndexAllTags {
txIndexer = kv.NewTxIndex(store, kv.IndexAllTags()) txIndexer = kv.NewTxIndex(store, kv.IndexAllTags())
} else { } else {
@ -424,7 +415,7 @@ func (n *Node) OnStart() error {
// Always connect to persistent peers // Always connect to persistent peers
if n.config.P2P.PersistentPeers != "" { if n.config.P2P.PersistentPeers != "" {
err = n.sw.DialPeersAsync(n.addrBook, strings.Split(n.config.P2P.PersistentPeers, ","), true)
err = n.sw.DialPeersAsync(n.addrBook, cmn.SplitAndTrim(n.config.P2P.PersistentPeers, ",", " "), true)
if err != nil { if err != nil {
return err return err
} }
@ -495,7 +486,7 @@ func (n *Node) ConfigureRPC() {
func (n *Node) startRPC() ([]net.Listener, error) { func (n *Node) startRPC() ([]net.Listener, error) {
n.ConfigureRPC() n.ConfigureRPC()
listenAddrs := strings.Split(n.config.RPC.ListenAddress, ",")
listenAddrs := cmn.SplitAndTrim(n.config.RPC.ListenAddress, ",", " ")
if n.config.RPC.Unsafe { if n.config.RPC.Unsafe {
rpccore.AddUnsafeRoutes() rpccore.AddUnsafeRoutes()


Loading…
Cancel
Save