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()
|
||||
currentEpoch = node.beaconClock.now.slotOrZero.epoch
|
||||
|
||||
var
|
||||
numUpdated = 0
|
||||
numRefreshed = 0
|
||||
for proposerData in body:
|
||||
node.dynamicFeeRecipientsStore[].addMapping(
|
||||
proposerData.validator_index,
|
||||
proposerData.fee_recipient,
|
||||
currentEpoch)
|
||||
if node.dynamicFeeRecipientsStore[].addMapping(
|
||||
proposerData.validator_index,
|
||||
proposerData.fee_recipient,
|
||||
currentEpoch):
|
||||
inc numUpdated
|
||||
else:
|
||||
inc numRefreshed
|
||||
|
||||
info "Prepared beacon proposers",
|
||||
numUpdatedFeeRecipients = numUpdated,
|
||||
numRefreshedFeeRecipients = numRefreshed
|
||||
|
||||
return RestApiResponse.response("", Http200, "text/plain")
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import
|
||||
std/tables,
|
||||
stew/results,
|
||||
results,
|
||||
chronicles,
|
||||
../datatypes/base
|
||||
|
||||
|
@ -24,24 +24,20 @@ type
|
|||
func init*(T: type DynamicFeeRecipientsStore): T =
|
||||
T(mappings: initTable[ValidatorIndex, Entry]())
|
||||
|
||||
proc addMapping*(store: var DynamicFeeRecipientsStore,
|
||||
func addMapping*(store: var DynamicFeeRecipientsStore,
|
||||
validator: ValidatorIndex,
|
||||
feeRecipient: Eth1Address,
|
||||
currentEpoch: Epoch) =
|
||||
currentEpoch: Epoch): bool =
|
||||
var updated = false
|
||||
store.mappings.withValue(validator, entry) do:
|
||||
updated = not (entry[].recipient == feeRecipient)
|
||||
updated = entry[].recipient != feeRecipient
|
||||
entry[] = Entry(recipient: feeRecipient, addedAt: currentEpoch)
|
||||
do:
|
||||
updated = true
|
||||
store.mappings[validator] = Entry(recipient: feeRecipient,
|
||||
addedAt: currentEpoch)
|
||||
if updated:
|
||||
info "Updating fee recipient",
|
||||
validator, feeRecipient = feeRecipient.toHex(), currentEpoch
|
||||
else:
|
||||
debug "Refreshing fee recipient",
|
||||
validator, feeRecipient = feeRecipient.toHex(), currentEpoch
|
||||
|
||||
updated
|
||||
|
||||
func getDynamicFeeRecipient*(store: var DynamicFeeRecipientsStore,
|
||||
validator: ValidatorIndex,
|
||||
|
|
Loading…
Reference in New Issue