light client bitfield is vector now, small size anyway, better separation of committee complexity from data init
This commit is contained in:
parent
0cf866e799
commit
6b872da3ec
|
@ -219,7 +219,7 @@ class BeaconBlockBody(Container):
|
||||||
# Shards
|
# Shards
|
||||||
shard_transitions: Vector[ShardTransition, MAX_SHARDS]
|
shard_transitions: Vector[ShardTransition, MAX_SHARDS]
|
||||||
# Light clients
|
# Light clients
|
||||||
light_client_signature_bitfield: Bitlist[LIGHT_CLIENT_COMMITTEE_SIZE]
|
light_client_signature_bitfield: Bitvector[LIGHT_CLIENT_COMMITTEE_SIZE]
|
||||||
light_client_signature: BLSSignature
|
light_client_signature: BLSSignature
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -862,11 +862,11 @@ def process_light_client_signatures(state: BeaconState, block_body: BeaconBlockB
|
||||||
assert len(block_body.light_client_signature_bitfield) == len(committee)
|
assert len(block_body.light_client_signature_bitfield) == len(committee)
|
||||||
total_reward = Gwei(0)
|
total_reward = Gwei(0)
|
||||||
signer_keys = []
|
signer_keys = []
|
||||||
for i, participant_bit in enumerate(block_body.light_client_signature_bitfield):
|
for bit_index, participant_index in enumerate(committee):
|
||||||
if participant_bit:
|
if block_body.light_client_signature_bitfield[bit_index]:
|
||||||
signer_keys.append(state.validators[committee[i]].pubkey)
|
signer_keys.append(state.validators[participant_index].pubkey)
|
||||||
increase_balance(state, committee[i], get_base_reward(state, committee[i]))
|
increase_balance(state, participant_index, get_base_reward(state, participant_index))
|
||||||
total_reward += get_base_reward(state, committee[i])
|
total_reward += get_base_reward(state, participant_index)
|
||||||
|
|
||||||
increase_balance(state, get_beacon_proposer_index(state), Gwei(total_reward // PROPOSER_REWARD_QUOTIENT))
|
increase_balance(state, get_beacon_proposer_index(state), Gwei(total_reward // PROPOSER_REWARD_QUOTIENT))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue