node: Wait for bootstrap guardian in devnet
This commit is contained in:
parent
5300efacc3
commit
26d849b58a
|
@ -5,6 +5,7 @@ import (
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
_ "net/http/pprof" // #nosec G108 we are using a custom router (`router := mux.NewRouter()`) and thus not automatically expose pprof.
|
_ "net/http/pprof" // #nosec G108 we are using a custom router (`router := mux.NewRouter()`) and thus not automatically expose pprof.
|
||||||
"os"
|
"os"
|
||||||
|
@ -13,6 +14,7 @@ import (
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/certusone/wormhole/node/pkg/watchers/cosmwasm"
|
"github.com/certusone/wormhole/node/pkg/watchers/cosmwasm"
|
||||||
|
|
||||||
|
@ -969,6 +971,21 @@ func runNode(cmd *cobra.Command, args []string) {
|
||||||
logger.Fatal("Failed to parse hostname - are we running in devnet?")
|
logger.Fatal("Failed to parse hostname - are we running in devnet?")
|
||||||
}
|
}
|
||||||
priv = devnet.DeterministicP2PPrivKeyByIndex(int64(idx))
|
priv = devnet.DeterministicP2PPrivKeyByIndex(int64(idx))
|
||||||
|
|
||||||
|
if idx != 0 {
|
||||||
|
// try to connect to guardian-0
|
||||||
|
for {
|
||||||
|
_, err := net.LookupIP("guardian-0.guardian")
|
||||||
|
if err == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
logger.Info("Error resolving guardian-0.guardian. Trying again...")
|
||||||
|
time.Sleep(time.Second)
|
||||||
|
}
|
||||||
|
// TODO this is a hack. If this is not the bootstrap Guardian, we wait 5s such that the bootstrap Guardian has enough time to start.
|
||||||
|
logger.Info("This is not a bootstrap Guardian. Waiting another 10 seconds so the bootstrap guardian to come online.")
|
||||||
|
time.Sleep(time.Second * 10)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
priv, err = common.GetOrCreateNodeKey(logger, *nodeKeyPath)
|
priv, err = common.GetOrCreateNodeKey(logger, *nodeKeyPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue