aptos/watcher: Update comments and errors

This commit is contained in:
Josh Siegel 2022-10-14 15:34:24 +00:00 committed by Csongor Kiss
parent 1a7098553c
commit 2a31454d29
2 changed files with 14 additions and 15 deletions

View File

@ -434,6 +434,7 @@ func runNode(cmd *cobra.Command, args []string) {
readiness.RegisterComponent(common.ReadinessKlaytnSyncing)
readiness.RegisterComponent(common.ReadinessCeloSyncing)
readiness.RegisterComponent(common.ReadinessMoonbeamSyncing)
readiness.RegisterComponent(common.ReadinessAptosSyncing)
if *testnetMode {
readiness.RegisterComponent(common.ReadinessEthRopstenSyncing)
@ -592,14 +593,12 @@ func runNode(cmd *cobra.Command, args []string) {
logger.Fatal("If --xplaWS is not specified, then --xplaLCD and --xplaContract must not be specified")
}
if *unsafeDevMode {
if *aptosRPC != "" {
if *aptosAccount == "" {
logger.Fatal("If --aptosRPC is specified, then --aptosAccount must be specified")
}
if *aptosHandle == "" {
logger.Fatal("If --aptosRPC is specified, then --aptosHandle must be specified")
}
if *aptosRPC != "" {
if *aptosAccount == "" {
logger.Fatal("If --aptosRPC is specified, then --aptosAccount must be specified")
}
if *aptosHandle == "" {
logger.Fatal("If --aptosRPC is specified, then --aptosHandle must be specified")
}
}

View File

@ -79,7 +79,7 @@ func (e *Watcher) retrievePayload(s string) ([]byte, error) {
func (e *Watcher) observeData(logger *zap.Logger, data gjson.Result, native_seq uint64) {
em := data.Get("sender")
if !em.Exists() {
logger.Info("sender")
logger.Error("sender field missing")
return
}
@ -96,37 +96,37 @@ func (e *Watcher) observeData(logger *zap.Logger, data gjson.Result, native_seq
v := data.Get("payload")
if !v.Exists() {
logger.Info("payload")
logger.Error("payload field missing")
return
}
pl, err := hex.DecodeString(v.String()[2:])
if err != nil {
logger.Info("payload decode")
logger.Error("payload decode")
return
}
ts := data.Get("timestamp")
if !ts.Exists() {
logger.Info("timestamp")
logger.Error("timestamp field missing")
return
}
nonce := data.Get("nonce")
if !nonce.Exists() {
logger.Info("nonce")
logger.Error("nonce field missing")
return
}
sequence := data.Get("sequence")
if !sequence.Exists() {
logger.Info("sequence")
logger.Error("sequence field missing")
return
}
consistency_level := data.Get("consistency_level")
if !consistency_level.Exists() {
logger.Info("consistency_level")
logger.Error("consistency_level field missing")
return
}