mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-10 22:36:01 +00:00
fix nil access to mainchainMonitor
This commit is contained in:
parent
a83aa83644
commit
86fc9a1f9e
@ -380,23 +380,32 @@ proc proposeBlock(node: BeaconNode,
|
|||||||
doAssert false, "head slot matches proposal slot (!)"
|
doAssert false, "head slot matches proposal slot (!)"
|
||||||
# return
|
# return
|
||||||
|
|
||||||
if not node.mainchainMonitor.isNil:
|
|
||||||
let eth1Data = await node.mainchainMonitor.getBeaconBlockRef()
|
|
||||||
|
|
||||||
var (nroot, nblck) = node.blockPool.withState(
|
var (nroot, nblck) = node.blockPool.withState(
|
||||||
node.stateCache, BlockSlot(blck: head, slot: slot - 1)):
|
node.stateCache, BlockSlot(blck: head, slot: slot - 1)):
|
||||||
# To create a block, we'll first apply a partial block to the state, skipping
|
# To create a block, we'll first apply a partial block to the state, skipping
|
||||||
# some validations.
|
# some validations.
|
||||||
# TODO monitor main chain here: node.mainchainMonitor.getBeaconBlockRef()
|
# TODO monitor main chain here: node.mainchainMonitor.getBeaconBlockRef()
|
||||||
|
let (eth1data, deposits) =
|
||||||
|
if node.mainchainMonitor.isNil:
|
||||||
|
(get_eth1data_stub(
|
||||||
|
state.eth1_deposit_index, slot.compute_epoch_of_slot()),
|
||||||
|
newSeq[Deposit]()
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
let e1d = await node.mainchainMonitor.getBeaconBlockRef()
|
||||||
|
|
||||||
|
(e1d,
|
||||||
|
node.mainchainMonitor.getPendingDeposits()
|
||||||
|
)
|
||||||
|
|
||||||
let
|
let
|
||||||
blockBody = BeaconBlockBody(
|
blockBody = BeaconBlockBody(
|
||||||
randao_reveal: validator.genRandaoReveal(state, slot),
|
randao_reveal: validator.genRandaoReveal(state, slot),
|
||||||
eth1_data: get_eth1data_stub(
|
eth1_data: eth1data,
|
||||||
state.eth1_deposit_index, slot.compute_epoch_of_slot()),
|
|
||||||
attestations:
|
attestations:
|
||||||
node.attestationPool.getAttestationsForBlock(state, slot),
|
node.attestationPool.getAttestationsForBlock(state, slot),
|
||||||
deposits: node.mainchainMonitor.getPendingDeposits())
|
deposits: deposits)
|
||||||
|
|
||||||
var
|
var
|
||||||
newBlock = BeaconBlock(
|
newBlock = BeaconBlock(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user