19 lines
497 B
Python
19 lines
497 B
Python
|
# Access constants from spec pkg reference.
|
||
|
import eth2spec.phase0.spec as spec
|
||
|
|
||
|
from eth2spec.phase0.spec import get_domain
|
||
|
from eth2spec.utils.bls import bls_sign
|
||
|
from eth2spec.utils.minimal_ssz import signing_root
|
||
|
|
||
|
|
||
|
def sign_block_header(state, header, privkey):
|
||
|
domain = get_domain(
|
||
|
state=state,
|
||
|
domain_type=spec.DOMAIN_BEACON_PROPOSER,
|
||
|
)
|
||
|
header.signature = bls_sign(
|
||
|
message_hash=signing_root(header),
|
||
|
privkey=privkey,
|
||
|
domain=domain,
|
||
|
)
|