Skip to content

Commit

Permalink
fix: show bacalhau id error
Browse files Browse the repository at this point in the history
  • Loading branch information
hunjixin committed Jun 26, 2024
1 parent 27b906f commit c846e45
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pkg/resourceprovider/resourceprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,20 @@ func NewResourceProvider(

func (resourceProvider *ResourceProvider) Start(ctx context.Context, cm *system.CleanupManager) chan error {
if resourceProvider.options.Pow.EnablePow {
go resourceProvider.StartMineLoop(ctx)
if errCh := resourceProvider.StartMineLoop(ctx); errCh != nil {
return errCh
}
}
return resourceProvider.controller.Start(ctx, cm)
}

func (resourceProvider *ResourceProvider) StartMineLoop(ctx context.Context) error {
func (resourceProvider *ResourceProvider) StartMineLoop(ctx context.Context) chan error {
errorChan := make(chan error, 1)
walletAddress := resourceProvider.web3SDK.GetAddress()
nodeId, err := resourceProvider.controller.executor.Id()
if err != nil {
return err
errorChan <- err
return errorChan
}
log.Info().Msgf("Wallet %s node id %s is ready for mine", walletAddress, nodeId)

Expand Down Expand Up @@ -136,7 +140,7 @@ func (resourceProvider *ResourceProvider) StartMineLoop(ctx context.Context) err
Msgf("Mine and submit successfully")
}

log.Info().Msgf("Listen to new pow round signal, %d workers read to work", resourceProvider.options.Pow.NumWorkers)
log.Info().Msgf("Listen to new pow round signal, %d workers ready to work", resourceProvider.options.Pow.NumWorkers)
miner := NewMinerController(nodeId, resourceProvider.options.Pow, taskCh, submitWork)
go miner.Start(ctx)
return nil
Expand Down

0 comments on commit c846e45

Please sign in to comment.