Skip to content

Commit

Permalink
use singleton DynamicFeeRecipientsStore
Browse files Browse the repository at this point in the history
  • Loading branch information
tersec committed Aug 22, 2022
1 parent f8b4984 commit bea11e8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions beacon_chain/consensus_object_pools/consensus_manager.nim
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type

# Allow determination of preferred fee recipient during proposals
# ----------------------------------------------------------------
dynamicFeeRecipientsStore: DynamicFeeRecipientsStore
dynamicFeeRecipientsStore: ref DynamicFeeRecipientsStore
keymanagerHost: ref KeymanagerHost

# Tracking last proposal forkchoiceUpdated payload information
Expand All @@ -64,7 +64,7 @@ func new*(T: type ConsensusManager,
attestationPool: ref AttestationPool,
quarantine: ref Quarantine,
eth1Monitor: Eth1Monitor,
dynamicFeeRecipientsStore: DynamicFeeRecipientsStore,
dynamicFeeRecipientsStore: ref DynamicFeeRecipientsStore,
keymanagerHost: ref KeymanagerHost
): ref ConsensusManager =
(ref ConsensusManager)(
Expand Down Expand Up @@ -219,7 +219,7 @@ proc checkNextProposer(dag: ChainDAGRef, slot: Slot):
proc getFeeRecipient*(
self: ref ConsensusManager, pubkey: ValidatorPubKey, validatorIdx: ValidatorIndex,
epoch: Epoch): Eth1Address =
self.dynamicFeeRecipientsStore.getDynamicFeeRecipient(validatorIdx, epoch).valueOr:
self.dynamicFeeRecipientsStore[].getDynamicFeeRecipient(validatorIdx, epoch).valueOr:
if self.keymanagerHost != nil:
self.keymanagerHost[].getSuggestedFeeRecipient(pubkey).valueOr:
self.keymanagerHost[].defaultFeeRecipient
Expand Down
2 changes: 1 addition & 1 deletion beacon_chain/nimbus_beacon_node.nim
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ proc initFullNode(
ExitPool.init(dag, attestationPool, onVoluntaryExitAdded))
consensusManager = ConsensusManager.new(
dag, attestationPool, quarantine, node.eth1Monitor,
node.dynamicFeeRecipientsStore, node.keymanagerHost)
newClone(node.dynamicFeeRecipientsStore), node.keymanagerHost)
blockProcessor = BlockProcessor.new(
config.dumpEnabled, config.dumpDirInvalid, config.dumpDirIncoming,
rng, taskpool, consensusManager, node.validatorMonitor, getBeaconTime,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_block_processor.nim
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ suite "Block processor" & preset():
keymanagerHost: ref KeymanagerHost
consensusManager = ConsensusManager.new(
dag, attestationPool, quarantine, eth1Monitor,
dynamicFeeRecipientsStore, keymanagerHost)
newClone(dynamicFeeRecipientsStore), keymanagerHost)
state = newClone(dag.headState)
cache = StateCache()
b1 = addTestBlock(state[], cache).phase0Data
Expand Down

0 comments on commit bea11e8

Please sign in to comment.