Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Commit

Permalink
Fixed registration issue (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
guilherme-brandao authored Feb 2, 2024
1 parent 8874c1b commit c183f55
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/node/appchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func NewAppChain(config AppChainConfig, log zerolog.Logger) (*AppChain, error) {
if err != nil {
config.SubmitTx = false
log.Warn().Err(err).Msg("could not retrieve account from keyring")
}
}
} else if config.AddressRestoreMnemonic != "" && config.AddressKeyName != "" {
// restore from mneumonic
account, err = client.AccountRegistry.Import(config.AddressKeyName, config.AddressRestoreMnemonic, config.AddressAccountPassphrase)
Expand Down Expand Up @@ -104,7 +104,7 @@ func registerWithBlockchain(appchain *AppChain) {
ctx := context.Background()

var msg sdktypes.Msg
if(appchain.Config.NodeRole == blockless.HeadNode) {
if appchain.Config.NodeRole == blockless.HeadNode {
msg = &types.MsgRegisterReputer{
Creator: appchain.ReputerAddress,
LibP2PKey: appchain.Config.LibP2PKey,
Expand All @@ -125,7 +125,7 @@ func registerWithBlockchain(appchain *AppChain) {

txResp, err := appchain.Client.BroadcastTx(ctx, appchain.ReputerAccount, msg)
if err != nil {
if strings.Contains(fmt.Sprint(err), types.Err_ErrWorkerAlreadyRegistered.String()) {
if strings.Contains(fmt.Sprint(err), types.Err_ErrWorkerAlreadyRegistered.String()) || strings.Contains(fmt.Sprint(err), types.Err_ErrReputerAlreadyRegistered.String()) {
appchain.Logger.Info().Err(err).Msg("node is already registered")
} else {
appchain.Logger.Fatal().Err(err).Msg("could not register the node with the allora blockchain")
Expand Down

0 comments on commit c183f55

Please sign in to comment.