mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-02 16:21:42 +00:00
Cache validator registration only after successful publish (#7034)
This commit is contained in:
@@ -428,7 +428,7 @@ impl<T: SlotClock + 'static, E: EthSpec> PreparationService<T, E> {
|
||||
pubkey,
|
||||
} = key.clone();
|
||||
|
||||
let signed_data = match self
|
||||
match self
|
||||
.validator_store
|
||||
.sign_validator_registration_data(ValidatorRegistrationData {
|
||||
fee_recipient,
|
||||
@@ -458,13 +458,7 @@ impl<T: SlotClock + 'static, E: EthSpec> PreparationService<T, E> {
|
||||
);
|
||||
continue;
|
||||
}
|
||||
};
|
||||
|
||||
self.validator_registration_cache
|
||||
.write()
|
||||
.insert(key, signed_data.clone());
|
||||
|
||||
signed_data
|
||||
}
|
||||
};
|
||||
signed.push(signed_data);
|
||||
}
|
||||
@@ -478,11 +472,20 @@ impl<T: SlotClock + 'static, E: EthSpec> PreparationService<T, E> {
|
||||
})
|
||||
.await
|
||||
{
|
||||
Ok(()) => info!(
|
||||
log,
|
||||
"Published validator registrations to the builder network";
|
||||
"count" => batch.len(),
|
||||
),
|
||||
Ok(()) => {
|
||||
info!(
|
||||
log,
|
||||
"Published validator registrations to the builder network";
|
||||
"count" => batch.len(),
|
||||
);
|
||||
let mut guard = self.validator_registration_cache.write();
|
||||
for signed_data in batch {
|
||||
guard.insert(
|
||||
ValidatorRegistrationKey::from(signed_data.message.clone()),
|
||||
signed_data.clone(),
|
||||
);
|
||||
}
|
||||
}
|
||||
Err(e) => warn!(
|
||||
log,
|
||||
"Unable to publish validator registrations to the builder network";
|
||||
|
||||
Reference in New Issue
Block a user