This commit is contained in:
Jim McDonald 2020-11-27 15:26:22 +00:00
parent 68fb49a21b
commit aed5402fbb
No known key found for this signature in database
GPG Key ID: 89CEB61B2AD2A5E7
5 changed files with 28 additions and 8 deletions

View File

@ -278,18 +278,18 @@ func (s *Service) fetchAccountsForWallet(ctx context.Context, wallet e2wtypes.Wa
} }
// Ensure we can unlock the account with a known passphrase. // Ensure we can unlock the account with a known passphrase.
unlocked := false
if unlocker, isUnlocker := account.(e2wtypes.AccountLocker); isUnlocker { if unlocker, isUnlocker := account.(e2wtypes.AccountLocker); isUnlocker {
unlocked := false
for _, passphrase := range s.passphrases { for _, passphrase := range s.passphrases {
if err := unlocker.Unlock(ctx, passphrase); err == nil { if err := unlocker.Unlock(ctx, passphrase); err == nil {
unlocked = true unlocked = true
break break
} }
} }
if !unlocked { }
log.Warn().Str("account", name).Msg("Failed to unlock account with any passphrase") if !unlocked {
continue log.Warn().Str("account", name).Msg("Failed to unlock account with any passphrase")
} continue
} }
// Set up account as unknown to beacon chain. // Set up account as unknown to beacon chain.

View File

@ -76,8 +76,12 @@ func (s *Service) Subscribe(ctx context.Context,
epoch spec.Epoch, epoch spec.Epoch,
accounts map[spec.ValidatorIndex]e2wtypes.Account, accounts map[spec.ValidatorIndex]e2wtypes.Account,
) (map[spec.Slot]map[spec.CommitteeIndex]*beaconcommitteesubscriber.Subscription, error) { ) (map[spec.Slot]map[spec.CommitteeIndex]*beaconcommitteesubscriber.Subscription, error) {
started := time.Now() if len(accounts) == 0 {
// Nothing to do.
return map[spec.Slot]map[spec.CommitteeIndex]*beaconcommitteesubscriber.Subscription{}, nil
}
started := time.Now()
log := log.With().Uint64("epoch", uint64(epoch)).Logger() log := log.With().Uint64("epoch", uint64(epoch)).Logger()
log.Trace().Msg("Subscribing") log.Trace().Msg("Subscribing")

View File

@ -30,6 +30,11 @@ func (s *Service) scheduleAttestations(ctx context.Context,
validatorIndices []spec.ValidatorIndex, validatorIndices []spec.ValidatorIndex,
notCurrentSlot bool, notCurrentSlot bool,
) { ) {
if len(validatorIndices) == 0 {
// Nothing to do.
return
}
started := time.Now() started := time.Now()
log.Trace().Uint64("epoch", uint64(epoch)).Msg("Scheduling attestations") log.Trace().Uint64("epoch", uint64(epoch)).Msg("Scheduling attestations")

View File

@ -28,6 +28,11 @@ func (s *Service) scheduleProposals(ctx context.Context,
validatorIndices []spec.ValidatorIndex, validatorIndices []spec.ValidatorIndex,
notCurrentSlot bool, notCurrentSlot bool,
) { ) {
if len(validatorIndices) == 0 {
// Nothing to do.
return
}
started := time.Now() started := time.Now()
log.Trace().Uint64("epoch", uint64(epoch)).Msg("Scheduling proposals") log.Trace().Uint64("epoch", uint64(epoch)).Msg("Scheduling proposals")

View File

@ -69,13 +69,19 @@ func (s *Service) SubmitAttestations(ctx context.Context, attestations []*spec.A
data, err2 := json.Marshal(attestations) data, err2 := json.Marshal(attestations)
if err2 != nil { if err2 != nil {
log.Error().Err(err).Msg("Failed to marshal JSON") log.Error().Err(err).Msg("Failed to marshal JSON")
} else {
log.Warn().Err(err).Str("data", string(data)).Msg("Invalid signature!")
} }
log.Warn().Err(err).Str("data", string(data)).Msg("Invalid signature!")
default: default:
log.Warn().Err(err).Msg("Failed to submit attestation") log.Warn().Err(err).Msg("Failed to submit attestation")
} }
} else { } else {
log.Trace().Msg("Submitted attestations") data, err := json.Marshal(attestations)
if err != nil {
log.Error().Err(err).Msg("Failed to marshal JSON")
} else {
log.Trace().Str("data", string(data)).Msg("Submitted attestations")
}
} }
}(ctx, sem, &wg, name, submitter) }(ctx, sem, &wg, name, submitter)
} }