refactor: improve broadcast error logging

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
This commit is contained in:
Julian Strobl 2024-01-05 10:59:57 +01:00
parent 35c30e4edb
commit 140d77b234
No known key found for this signature in database
GPG Key ID: E0A8F9AD733499A7

View File

@ -33,12 +33,16 @@ func buildSignBroadcastTx(goCtx context.Context, loggingContext string, sendingV
GetAppLogger().Error(ctx, loggingContext+" getting tx response from out failed: "+err.Error()) GetAppLogger().Error(ctx, loggingContext+" getting tx response from out failed: "+err.Error())
return return
} }
if txResponse.Code == 0 {
GetAppLogger().Info(ctx, loggingContext+" broadcast tx succeeded")
return
}
txResponseJSON, err := yaml.YAMLToJSON([]byte(txResponse.String())) txResponseJSON, err := yaml.YAMLToJSON([]byte(txResponse.String()))
if err != nil { if err != nil {
GetAppLogger().Error(ctx, loggingContext+" converting tx response from yaml to json failed: "+err.Error()) GetAppLogger().Error(ctx, loggingContext+" converting tx response from yaml to json failed: "+err.Error())
return return
} }
GetAppLogger().Info(ctx, loggingContext+" broadcast tx succeeded: "+string(txResponseJSON)) GetAppLogger().Error(ctx, loggingContext+" broadcast tx failed: "+string(txResponseJSON))
}() }()
} }