remove expensive logging from function called in prepareBeaconProposer inner loop (#5776)
This commit is contained in:
parent
0775a48420
commit
36545e1d84
|
@ -1071,11 +1071,21 @@ proc installValidatorApiHandlers*(router: var RestRouter, node: BeaconNode) =
|
||||||
dres.get()
|
dres.get()
|
||||||
currentEpoch = node.beaconClock.now.slotOrZero.epoch
|
currentEpoch = node.beaconClock.now.slotOrZero.epoch
|
||||||
|
|
||||||
|
var
|
||||||
|
numUpdated = 0
|
||||||
|
numRefreshed = 0
|
||||||
for proposerData in body:
|
for proposerData in body:
|
||||||
node.dynamicFeeRecipientsStore[].addMapping(
|
if node.dynamicFeeRecipientsStore[].addMapping(
|
||||||
proposerData.validator_index,
|
proposerData.validator_index,
|
||||||
proposerData.fee_recipient,
|
proposerData.fee_recipient,
|
||||||
currentEpoch)
|
currentEpoch):
|
||||||
|
inc numUpdated
|
||||||
|
else:
|
||||||
|
inc numRefreshed
|
||||||
|
|
||||||
|
info "Prepared beacon proposers",
|
||||||
|
numUpdatedFeeRecipients = numUpdated,
|
||||||
|
numRefreshedFeeRecipients = numRefreshed
|
||||||
|
|
||||||
return RestApiResponse.response("", Http200, "text/plain")
|
return RestApiResponse.response("", Http200, "text/plain")
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import
|
import
|
||||||
std/tables,
|
std/tables,
|
||||||
stew/results,
|
results,
|
||||||
chronicles,
|
chronicles,
|
||||||
../datatypes/base
|
../datatypes/base
|
||||||
|
|
||||||
|
@ -24,24 +24,20 @@ type
|
||||||
func init*(T: type DynamicFeeRecipientsStore): T =
|
func init*(T: type DynamicFeeRecipientsStore): T =
|
||||||
T(mappings: initTable[ValidatorIndex, Entry]())
|
T(mappings: initTable[ValidatorIndex, Entry]())
|
||||||
|
|
||||||
proc addMapping*(store: var DynamicFeeRecipientsStore,
|
func addMapping*(store: var DynamicFeeRecipientsStore,
|
||||||
validator: ValidatorIndex,
|
validator: ValidatorIndex,
|
||||||
feeRecipient: Eth1Address,
|
feeRecipient: Eth1Address,
|
||||||
currentEpoch: Epoch) =
|
currentEpoch: Epoch): bool =
|
||||||
var updated = false
|
var updated = false
|
||||||
store.mappings.withValue(validator, entry) do:
|
store.mappings.withValue(validator, entry) do:
|
||||||
updated = not (entry[].recipient == feeRecipient)
|
updated = entry[].recipient != feeRecipient
|
||||||
entry[] = Entry(recipient: feeRecipient, addedAt: currentEpoch)
|
entry[] = Entry(recipient: feeRecipient, addedAt: currentEpoch)
|
||||||
do:
|
do:
|
||||||
updated = true
|
updated = true
|
||||||
store.mappings[validator] = Entry(recipient: feeRecipient,
|
store.mappings[validator] = Entry(recipient: feeRecipient,
|
||||||
addedAt: currentEpoch)
|
addedAt: currentEpoch)
|
||||||
if updated:
|
|
||||||
info "Updating fee recipient",
|
updated
|
||||||
validator, feeRecipient = feeRecipient.toHex(), currentEpoch
|
|
||||||
else:
|
|
||||||
debug "Refreshing fee recipient",
|
|
||||||
validator, feeRecipient = feeRecipient.toHex(), currentEpoch
|
|
||||||
|
|
||||||
func getDynamicFeeRecipient*(store: var DynamicFeeRecipientsStore,
|
func getDynamicFeeRecipient*(store: var DynamicFeeRecipientsStore,
|
||||||
validator: ValidatorIndex,
|
validator: ValidatorIndex,
|
||||||
|
|
Loading…
Reference in New Issue