mirror of https://github.com/certusone/vouch.git
Tidy ups
This commit is contained in:
parent
68fb49a21b
commit
aed5402fbb
|
@ -278,19 +278,19 @@ func (s *Service) fetchAccountsForWallet(ctx context.Context, wallet e2wtypes.Wa
|
|||
}
|
||||
|
||||
// Ensure we can unlock the account with a known passphrase.
|
||||
if unlocker, isUnlocker := account.(e2wtypes.AccountLocker); isUnlocker {
|
||||
unlocked := false
|
||||
if unlocker, isUnlocker := account.(e2wtypes.AccountLocker); isUnlocker {
|
||||
for _, passphrase := range s.passphrases {
|
||||
if err := unlocker.Unlock(ctx, passphrase); err == nil {
|
||||
unlocked = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if !unlocked {
|
||||
log.Warn().Str("account", name).Msg("Failed to unlock account with any passphrase")
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
// Set up account as unknown to beacon chain.
|
||||
accounts[bytesutil.ToBytes48(pubKey)] = account
|
||||
|
|
|
@ -76,8 +76,12 @@ func (s *Service) Subscribe(ctx context.Context,
|
|||
epoch spec.Epoch,
|
||||
accounts map[spec.ValidatorIndex]e2wtypes.Account,
|
||||
) (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.Trace().Msg("Subscribing")
|
||||
|
||||
|
|
|
@ -30,6 +30,11 @@ func (s *Service) scheduleAttestations(ctx context.Context,
|
|||
validatorIndices []spec.ValidatorIndex,
|
||||
notCurrentSlot bool,
|
||||
) {
|
||||
if len(validatorIndices) == 0 {
|
||||
// Nothing to do.
|
||||
return
|
||||
}
|
||||
|
||||
started := time.Now()
|
||||
log.Trace().Uint64("epoch", uint64(epoch)).Msg("Scheduling attestations")
|
||||
|
||||
|
|
|
@ -28,6 +28,11 @@ func (s *Service) scheduleProposals(ctx context.Context,
|
|||
validatorIndices []spec.ValidatorIndex,
|
||||
notCurrentSlot bool,
|
||||
) {
|
||||
if len(validatorIndices) == 0 {
|
||||
// Nothing to do.
|
||||
return
|
||||
}
|
||||
|
||||
started := time.Now()
|
||||
log.Trace().Uint64("epoch", uint64(epoch)).Msg("Scheduling proposals")
|
||||
|
||||
|
|
|
@ -69,13 +69,19 @@ func (s *Service) SubmitAttestations(ctx context.Context, attestations []*spec.A
|
|||
data, err2 := json.Marshal(attestations)
|
||||
if err2 != nil {
|
||||
log.Error().Err(err).Msg("Failed to marshal JSON")
|
||||
}
|
||||
} else {
|
||||
log.Warn().Err(err).Str("data", string(data)).Msg("Invalid signature!")
|
||||
}
|
||||
default:
|
||||
log.Warn().Err(err).Msg("Failed to submit attestation")
|
||||
}
|
||||
} 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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue