Reduce fee recipient log spam (#4255)

Once is enough
This commit is contained in:
Jacek Sieka 2022-10-25 14:47:43 +02:00 committed by GitHub
parent 5e3e4b1706
commit af52edaef7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 5 deletions

View File

@ -19,10 +19,21 @@ proc addMapping*(store: var DynamicFeeRecipientsStore,
validator: ValidatorIndex,
feeRecipient: Eth1Address,
currentEpoch: Epoch) =
info "Updating fee recipient",
validator, feeRecipient = feeRecipient.toHex(), currentEpoch
var
found, updated = false
store.mappings.withValue(validator, entry) do:
updated = not (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
func getDynamicFeeRecipient*(store: var DynamicFeeRecipientsStore,
validator: ValidatorIndex,

View File

@ -17,7 +17,7 @@ import
export constants
export stint, ethtypes.toHex
export stint, ethtypes.toHex, ethtypes.`==`
const
# https://github.com/ethereum/consensus-specs/blob/v1.2.0/specs/phase0/beacon-chain.md#withdrawal-prefixes