mirror of
https://source.quilibrium.com/quilibrium/ceremonyclient.git
synced 2024-12-26 00: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{
|
bootstrapPeers := []string{
|
||||||
"/dns/bootstrap.quilibrium.com/udp/8336/quic/p2p/QmUhm9iZVruSxyavjoPLCfuoRG94SGQEkfxEEoukEZmD5B",
|
"/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.47/udp/8317/quic/p2p/Qmd233pLUDvcDW3ama27usfbG1HxKNh1V9dmWVW1SXp1pd",
|
||||||
"/ip4/204.186.74.46/udp/8316/quic/p2p/QmeqBjm3iX7sdTieyto1gys5ruQrQNPKfaTGcVQQWJPYDV",
|
"/ip4/204.186.74.46/udp/8316/quic/p2p/QmeqBjm3iX7sdTieyto1gys5ruQrQNPKfaTGcVQQWJPYDV",
|
||||||
"/ip4/186.233.184.181/udp/8336/quic/p2p/QmW6QDvKuYqJYYMP5tMZSp12X3nexywK28tZNgqtqNpEDL",
|
"/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
|
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
|
config.P2P.BootstrapPeers = bootstrapPeers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ceremony
|
package ceremony
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"io"
|
"io"
|
||||||
"time"
|
"time"
|
||||||
@ -155,7 +156,8 @@ func (e *CeremonyDataClockConsensusEngine) GetMostAheadPeer() (
|
|||||||
for _, v := range e.peerMap {
|
for _, v := range e.peerMap {
|
||||||
_, ok := e.uncooperativePeersMap[string(v.peerId)]
|
_, ok := e.uncooperativePeersMap[string(v.peerId)]
|
||||||
if v.maxFrame > max &&
|
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
|
peer = v.peerId
|
||||||
max = v.maxFrame
|
max = v.maxFrame
|
||||||
}
|
}
|
||||||
@ -330,14 +332,8 @@ func (e *CeremonyDataClockConsensusEngine) collect(
|
|||||||
e.syncingStatus = SyncStatusNotSyncing
|
e.syncingStatus = SyncStatusNotSyncing
|
||||||
}
|
}
|
||||||
|
|
||||||
// With large networks and slow syncing machines, this can lead to an
|
// With the increase of network size, constrain down to top thirty
|
||||||
// infinite loop if the list is refreshing fast enough, so make the size
|
for i := 0; i < 30; i++ {
|
||||||
// of the map the maximum loop case:
|
|
||||||
e.peerMapMx.Lock()
|
|
||||||
size := len(e.peerMap)
|
|
||||||
e.peerMapMx.Unlock()
|
|
||||||
|
|
||||||
for i := 0; i < size; i++ {
|
|
||||||
peerId, maxFrame, err := e.GetMostAheadPeer()
|
peerId, maxFrame, err := e.GetMostAheadPeer()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
e.logger.Warn("no peers available, skipping sync")
|
e.logger.Warn("no peers available, skipping sync")
|
||||||
|
@ -344,7 +344,9 @@ func initDHT(
|
|||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
time.Sleep(30 * time.Second)
|
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")
|
logger.Info("reconnecting to peers")
|
||||||
reconnect()
|
reconnect()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user