2019-05-15 18:36:32 +02:00
|
|
|
from eth2spec.utils.bls import bls_sign
|
2019-11-21 23:13:45 +01:00
|
|
|
from eth2spec.utils.ssz.ssz_impl import hash_tree_root
|
2019-05-15 19:31:02 +02:00
|
|
|
|
|
|
|
|
2019-05-30 22:57:18 +02:00
|
|
|
def sign_voluntary_exit(spec, state, voluntary_exit, privkey):
|
2019-11-21 23:13:45 +01: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 18:36:32 +02:00
|
|
|
)
|
|
|
|
)
|