mirror of
https://source.quilibrium.com/quilibrium/ceremonyclient.git
synced 2024-11-10 18:25:17 +00:00
add new bootstrap peers, adjust some of the peering params, also peer selection for version (#45)
This commit is contained in:
parent
515c4748f7
commit
ac5c393745
@ -73,6 +73,9 @@ func LoadConfig(configPath string, proverKey string) (*Config, error) {
|
||||
|
||||
bootstrapPeers := []string{
|
||||
"/dns/bootstrap.quilibrium.com/udp/8336/quic/p2p/QmUhm9iZVruSxyavjoPLCfuoRG94SGQEkfxEEoukEZmD5B",
|
||||
"/dns/quaalude.quilibrium.com/udp/8336/quic/p2p/QmcKQjpQmLpbDsiif2MuakhHFyxWvqYauPsJDaXnLav7PJ",
|
||||
"/dns/quecifer.quilibrium.com/udp/8336/quic/p2p/QmQkyqziNCycUDdeBypkikMZWH2bBmmxfK7cbJFJmyyQdQ",
|
||||
"/dns/quantum.quilibrium.com/udp/8336/quic/p2p/QmXaSyf9Gaq5ddcHysefDpuE7SJqzdg1surQ5wac55ysJV",
|
||||
"/ip4/204.186.74.47/udp/8317/quic/p2p/Qmd233pLUDvcDW3ama27usfbG1HxKNh1V9dmWVW1SXp1pd",
|
||||
"/ip4/204.186.74.46/udp/8316/quic/p2p/QmeqBjm3iX7sdTieyto1gys5ruQrQNPKfaTGcVQQWJPYDV",
|
||||
"/ip4/186.233.184.181/udp/8336/quic/p2p/QmW6QDvKuYqJYYMP5tMZSp12X3nexywK28tZNgqtqNpEDL",
|
||||
@ -198,7 +201,11 @@ func LoadConfig(configPath string, proverKey string) (*Config, error) {
|
||||
config.Engine.GenesisSeed = genesisSeed
|
||||
}
|
||||
|
||||
if len(config.P2P.BootstrapPeers) == 0 {
|
||||
// Slight trick here to get people on the latest bootstrap list –
|
||||
// if it's empty, always use latest, if it has the Q bootstrap node, always
|
||||
// use latest.
|
||||
if len(config.P2P.BootstrapPeers) == 0 ||
|
||||
config.P2P.BootstrapPeers[0] == bootstrapPeers[0] {
|
||||
config.P2P.BootstrapPeers = bootstrapPeers
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package ceremony
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"io"
|
||||
"time"
|
||||
@ -155,7 +156,8 @@ func (e *CeremonyDataClockConsensusEngine) GetMostAheadPeer() (
|
||||
for _, v := range e.peerMap {
|
||||
_, ok := e.uncooperativePeersMap[string(v.peerId)]
|
||||
if v.maxFrame > max &&
|
||||
v.timestamp > consensus.GetMinimumVersionCutoff().UnixMilli() && !ok {
|
||||
v.timestamp > consensus.GetMinimumVersionCutoff().UnixMilli() &&
|
||||
bytes.Compare(v.version, consensus.GetMinimumVersion()) >= 0 && !ok {
|
||||
peer = v.peerId
|
||||
max = v.maxFrame
|
||||
}
|
||||
@ -330,14 +332,8 @@ func (e *CeremonyDataClockConsensusEngine) collect(
|
||||
e.syncingStatus = SyncStatusNotSyncing
|
||||
}
|
||||
|
||||
// With large networks and slow syncing machines, this can lead to an
|
||||
// infinite loop if the list is refreshing fast enough, so make the size
|
||||
// of the map the maximum loop case:
|
||||
e.peerMapMx.Lock()
|
||||
size := len(e.peerMap)
|
||||
e.peerMapMx.Unlock()
|
||||
|
||||
for i := 0; i < size; i++ {
|
||||
// With the increase of network size, constrain down to top thirty
|
||||
for i := 0; i < 30; i++ {
|
||||
peerId, maxFrame, err := e.GetMostAheadPeer()
|
||||
if err != nil {
|
||||
e.logger.Warn("no peers available, skipping sync")
|
||||
|
@ -344,7 +344,9 @@ func initDHT(
|
||||
go func() {
|
||||
for {
|
||||
time.Sleep(30 * time.Second)
|
||||
if len(h.Network().Peers()) == 0 {
|
||||
// try to assert some stability, never go below min peers for data
|
||||
// consensus:
|
||||
if len(h.Network().Peers()) < 3 {
|
||||
logger.Info("reconnecting to peers")
|
||||
reconnect()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user