skip validators from which validator credentials do not match supplied withdrawal credentials

This commit is contained in:
Joao Rodrigues
2023-01-25 20:57:44 +00:00
parent 7c88b7c082
commit 1ca1e1f2d6

View File

@@ -325,6 +325,18 @@ func (c *command) generateOperationsFromChainInfoAndPrivateKey(ctx context.Conte
return err
}
// skip validators which withdrawal key don't match with supplied withdrawal account public key
pubkey, err := util.BestPublicKey(withdrawalAccount)
if err != nil {
return err
}
withdrawalCredentials := ethutil.SHA256(pubkey.Marshal())
withdrawalCredentials[0] = byte(0) // BLS_WITHDRAWAL_PREFIX
if !bytes.Equal(withdrawalCredentials, validatorInfo.WithdrawalCredentials) {
fmt.Printf("Skipping validator due to withdrawal credentials mismatch index=%v pubkey=%v\n", validatorInfo.Index, validatorInfo.Pubkey.String())
continue
}
if err := c.generateOperationFromAccount(ctx, validatorInfo, withdrawalAccount); err != nil {
return err
}