mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-14 13:51:21 +00:00
dial_persistent_peers -> dial_peers with persistent option
This commit is contained in:
@ -112,7 +112,7 @@ An HTTP Get request to the root RPC endpoint (e.g.
|
|||||||
http://localhost:46657/broadcast_tx_sync?tx=_
|
http://localhost:46657/broadcast_tx_sync?tx=_
|
||||||
http://localhost:46657/commit?height=_
|
http://localhost:46657/commit?height=_
|
||||||
http://localhost:46657/dial_seeds?seeds=_
|
http://localhost:46657/dial_seeds?seeds=_
|
||||||
http://localhost:46657/dial_persistent_peers?persistent_peers=_
|
http://localhost:46657/dial_peers?peers=_&persistent=_
|
||||||
http://localhost:46657/subscribe?event=_
|
http://localhost:46657/subscribe?event=_
|
||||||
http://localhost:46657/tx?hash=_&prove=_
|
http://localhost:46657/tx?hash=_&prove=_
|
||||||
http://localhost:46657/unsafe_start_cpu_profiler?filename=_
|
http://localhost:46657/unsafe_start_cpu_profiler?filename=_
|
||||||
|
@ -287,7 +287,7 @@ specify seeds for a running node to connect to:
|
|||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
curl --data-urlencode "seeds=[\"1.2.3.4:46656\",\"5.6.7.8:46656\"]" localhost:46657/dial_seeds
|
curl 'localhost:46657/dial_seeds?seeds=\["1.2.3.4:46656","5.6.7.8:46656"\]'
|
||||||
|
|
||||||
Note, if the peer-exchange protocol (PEX) is enabled (default), you should not
|
Note, if the peer-exchange protocol (PEX) is enabled (default), you should not
|
||||||
normally need seeds after the first start. Peers will be gossipping about known
|
normally need seeds after the first start. Peers will be gossipping about known
|
||||||
@ -296,13 +296,13 @@ peers and forming a network, storing peer addresses in the addrbook.
|
|||||||
If you want Tendermint to connect to specific set of addresses and maintain a
|
If you want Tendermint to connect to specific set of addresses and maintain a
|
||||||
persistent connection with each, you can use the ``--p2p.persistent_peers``
|
persistent connection with each, you can use the ``--p2p.persistent_peers``
|
||||||
flag or the corresponding setting in the ``config.toml`` or the
|
flag or the corresponding setting in the ``config.toml`` or the
|
||||||
``/dial_persistent_peers`` RPC endpoint to do it without stopping Tendermint
|
``/dial_peers`` RPC endpoint to do it without stopping Tendermint
|
||||||
core instance.
|
core instance.
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
tendermint node --p2p.persistent_peers "10.11.12.13:46656,10.11.12.14:46656"
|
tendermint node --p2p.persistent_peers "10.11.12.13:46656,10.11.12.14:46656"
|
||||||
curl --data-urlencode "persistent_peers=[\"10.11.12.13:46656\",\"10.11.12.14:46656\"]" localhost:46657/dial_persistent_peers
|
curl 'localhost:46657/dial_peers?persistent=true&peers=\["1.2.3.4:46656","5.6.7.8:46656"\]'
|
||||||
|
|
||||||
Adding a Non-Validator
|
Adding a Non-Validator
|
||||||
~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@ -382,7 +382,7 @@ and the new ``priv_validator.json`` to the ``~/.tendermint/config`` on a new
|
|||||||
machine.
|
machine.
|
||||||
|
|
||||||
Now run ``tendermint node`` on both machines, and use either
|
Now run ``tendermint node`` on both machines, and use either
|
||||||
``--p2p.persistent_peers`` or the ``/dial_persistent_peers`` to get them to peer up. They
|
``--p2p.persistent_peers`` or the ``/dial_peers`` to get them to peer up. They
|
||||||
should start making blocks, and will only continue to do so as long as
|
should start making blocks, and will only continue to do so as long as
|
||||||
both of them are online.
|
both of them are online.
|
||||||
|
|
||||||
|
@ -323,7 +323,7 @@ func (sw *Switch) DialPeersAsync(addrBook *AddrBook, peers []string, persistent
|
|||||||
}
|
}
|
||||||
|
|
||||||
if addrBook != nil {
|
if addrBook != nil {
|
||||||
// add persistent peers to `addrBook`
|
// add peers to `addrBook`
|
||||||
ourAddrS := sw.nodeInfo.ListenAddr
|
ourAddrS := sw.nodeInfo.ListenAddr
|
||||||
ourAddr, _ := NewNetAddressString(ourAddrS)
|
ourAddr, _ := NewNetAddressString(ourAddrS)
|
||||||
for _, netAddr := range netAddrs {
|
for _, netAddr := range netAddrs {
|
||||||
|
@ -88,8 +88,8 @@ func (Local) DialSeeds(seeds []string) (*ctypes.ResultDialSeeds, error) {
|
|||||||
return core.UnsafeDialSeeds(seeds)
|
return core.UnsafeDialSeeds(seeds)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Local) DialPersistentPeers(persistent_peers []string) (*ctypes.ResultDialPersistentPeers, error) {
|
func (Local) DialPeers(peers []string, persistent bool) (*ctypes.ResultDialPeers, error) {
|
||||||
return core.UnsafeDialPersistentPeers(persistent_peers)
|
return core.UnsafeDialPeers(peers, persistent)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Local) BlockchainInfo(minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, error) {
|
func (Local) BlockchainInfo(minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, error) {
|
||||||
|
@ -111,8 +111,8 @@ func (c Client) DialSeeds(seeds []string) (*ctypes.ResultDialSeeds, error) {
|
|||||||
return core.UnsafeDialSeeds(seeds)
|
return core.UnsafeDialSeeds(seeds)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c Client) DialPersistentPeers(persistent_peers []string) (*ctypes.ResultDialPersistentPeers, error) {
|
func (c Client) DialPeers(peers []string, persistent bool) (*ctypes.ResultDialPeers, error) {
|
||||||
return core.UnsafeDialPersistentPeers(persistent_peers)
|
return core.UnsafeDialPeers(peers, persistent)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c Client) BlockchainInfo(minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, error) {
|
func (c Client) BlockchainInfo(minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, error) {
|
||||||
|
@ -66,17 +66,17 @@ func UnsafeDialSeeds(seeds []string) (*ctypes.ResultDialSeeds, error) {
|
|||||||
return &ctypes.ResultDialSeeds{"Dialing seeds in progress. See /net_info for details"}, nil
|
return &ctypes.ResultDialSeeds{"Dialing seeds in progress. See /net_info for details"}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func UnsafeDialPersistentPeers(persistent_peers []string) (*ctypes.ResultDialPersistentPeers, error) {
|
func UnsafeDialPeers(peers []string, persistent bool) (*ctypes.ResultDialPeers, error) {
|
||||||
if len(persistent_peers) == 0 {
|
if len(peers) == 0 {
|
||||||
return &ctypes.ResultDialPersistentPeers{}, errors.New("No persistent peers provided")
|
return &ctypes.ResultDialPeers{}, errors.New("No peers provided")
|
||||||
}
|
}
|
||||||
// starts go routines to dial each peer after random delays
|
// starts go routines to dial each peer after random delays
|
||||||
logger.Info("DialPersistentPeers", "addrBook", addrBook, "persistent_peers", persistent_peers)
|
logger.Info("DialPeers", "addrBook", addrBook, "peers", peers, "persistent", persistent)
|
||||||
err := p2pSwitch.DialPeersAsync(addrBook, persistent_peers, true)
|
err := p2pSwitch.DialPeersAsync(addrBook, peers, persistent)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &ctypes.ResultDialPersistentPeers{}, err
|
return &ctypes.ResultDialPeers{}, err
|
||||||
}
|
}
|
||||||
return &ctypes.ResultDialPersistentPeers{"Dialing persistent peers in progress. See /net_info for details"}, nil
|
return &ctypes.ResultDialPeers{"Dialing peers in progress. See /net_info for details"}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get genesis file.
|
// Get genesis file.
|
||||||
|
@ -39,7 +39,7 @@ var Routes = map[string]*rpc.RPCFunc{
|
|||||||
func AddUnsafeRoutes() {
|
func AddUnsafeRoutes() {
|
||||||
// control API
|
// control API
|
||||||
Routes["dial_seeds"] = rpc.NewRPCFunc(UnsafeDialSeeds, "seeds")
|
Routes["dial_seeds"] = rpc.NewRPCFunc(UnsafeDialSeeds, "seeds")
|
||||||
Routes["dial_persistent_peers"] = rpc.NewRPCFunc(UnsafeDialPersistentPeers, "persistent_peers")
|
Routes["dial_peers"] = rpc.NewRPCFunc(UnsafeDialPeers, "peers,persistent")
|
||||||
Routes["unsafe_flush_mempool"] = rpc.NewRPCFunc(UnsafeFlushMempool, "")
|
Routes["unsafe_flush_mempool"] = rpc.NewRPCFunc(UnsafeFlushMempool, "")
|
||||||
|
|
||||||
// profiler API
|
// profiler API
|
||||||
|
@ -86,7 +86,7 @@ type ResultDialSeeds struct {
|
|||||||
Log string `json:"log"`
|
Log string `json:"log"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResultDialPersistentPeers struct {
|
type ResultDialPeers struct {
|
||||||
Log string `json:"log"`
|
Log string `json:"log"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user