mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 10:11:44 +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,
|
pubkey,
|
||||||
} = key.clone();
|
} = key.clone();
|
||||||
|
|
||||||
let signed_data = match self
|
match self
|
||||||
.validator_store
|
.validator_store
|
||||||
.sign_validator_registration_data(ValidatorRegistrationData {
|
.sign_validator_registration_data(ValidatorRegistrationData {
|
||||||
fee_recipient,
|
fee_recipient,
|
||||||
@@ -458,13 +458,7 @@ impl<T: SlotClock + 'static, E: EthSpec> PreparationService<T, E> {
|
|||||||
);
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
self.validator_registration_cache
|
|
||||||
.write()
|
|
||||||
.insert(key, signed_data.clone());
|
|
||||||
|
|
||||||
signed_data
|
|
||||||
};
|
};
|
||||||
signed.push(signed_data);
|
signed.push(signed_data);
|
||||||
}
|
}
|
||||||
@@ -478,11 +472,20 @@ impl<T: SlotClock + 'static, E: EthSpec> PreparationService<T, E> {
|
|||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
Ok(()) => info!(
|
Ok(()) => {
|
||||||
log,
|
info!(
|
||||||
"Published validator registrations to the builder network";
|
log,
|
||||||
"count" => batch.len(),
|
"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!(
|
Err(e) => warn!(
|
||||||
log,
|
log,
|
||||||
"Unable to publish validator registrations to the builder network";
|
"Unable to publish validator registrations to the builder network";
|
||||||
|
|||||||
Reference in New Issue
Block a user