2019-05-15 16:36:32 +00:00
|
|
|
from eth2spec.utils.bls import bls_sign
|
2019-11-21 22:13:45 +00:00
|
|
|
from eth2spec.utils.ssz.ssz_impl import hash_tree_root
|
2019-05-15 17:31:02 +00:00
|
|
|
|
|
|
|
|
2019-05-30 20:57:18 +00:00
|
|
|
def sign_voluntary_exit(spec, state, voluntary_exit, privkey):
|
2019-11-21 22:13:45 +00:00
|
|
|
return spec.SignedVoluntaryExit(
|
|
|
|
message=voluntary_exit,
|
|
|
|
signature=bls_sign(
|
|
|
|
message_hash=hash_tree_root(voluntary_exit),
|
|
|
|
privkey=privkey,
|
|
|
|
domain=spec.get_domain(
|
|
|
|
state=state,
|
|
|
|
domain_type=spec.DOMAIN_VOLUNTARY_EXIT,
|
|
|
|
message_epoch=voluntary_exit.epoch,
|
|
|
|
)
|
2019-05-15 16:36:32 +00:00
|
|
|
)
|
|
|
|
)
|