mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-09 19:51:47 +00:00
Integrate Witti testnet (#1193)
* Update for latest master * Shift delay inside loop * Clean up genesis service * Tidy * Tidy logs * Address Michael's comments * Add pre-genesis logging * Remove est time till genesis * Fix time formatting * Tidy * Update docs for Witti * Update JS for Witti * Ensure deposit data is 0x-prefixed hex * Hard code witti testnet dir * Add --auto-register warning * Integrate local sigp testnet source * Reword warning
This commit is contained in:
@@ -175,13 +175,14 @@ impl<'a> Builder<'a> {
|
||||
if path.exists() {
|
||||
return Err(Error::DepositDataAlreadyExists(path));
|
||||
} else {
|
||||
let hex = format!("0x{}", hex::encode(&deposit_data));
|
||||
OpenOptions::new()
|
||||
.write(true)
|
||||
.read(true)
|
||||
.create(true)
|
||||
.open(path.clone())
|
||||
.map_err(Error::UnableToSaveDepositData)?
|
||||
.write_all(&deposit_data)
|
||||
.write_all(hex.as_bytes())
|
||||
.map_err(Error::UnableToSaveDepositData)?
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,9 @@ pub enum Error {
|
||||
UnableToReadPassword(PathBuf),
|
||||
UnableToDecryptKeypair(KeystoreError),
|
||||
UnableToReadDepositData(io::Error),
|
||||
DepositDataMissing0xPrefix,
|
||||
DepositDataNotUtf8,
|
||||
DepositDataInvalidHex(hex::FromHexError),
|
||||
DepositAmountDoesNotExist(PathBuf),
|
||||
UnableToReadDepositAmount(io::Error),
|
||||
UnableToParseDepositAmount(std::num::ParseIntError),
|
||||
@@ -160,7 +163,16 @@ impl ValidatorDir {
|
||||
if !path.exists() {
|
||||
return Ok(None);
|
||||
}
|
||||
let deposit_data_rlp = read(path).map_err(Error::UnableToReadDepositData)?;
|
||||
let deposit_data_rlp = read(path)
|
||||
.map_err(Error::UnableToReadDepositData)
|
||||
.and_then(|hex_bytes| {
|
||||
let hex = std::str::from_utf8(&hex_bytes).map_err(|_| Error::DepositDataNotUtf8)?;
|
||||
if hex.starts_with("0x") {
|
||||
hex::decode(&hex[2..]).map_err(Error::DepositDataInvalidHex)
|
||||
} else {
|
||||
Err(Error::DepositDataMissing0xPrefix)
|
||||
}
|
||||
})?;
|
||||
|
||||
// Read and parse `ETH1_DEPOSIT_AMOUNT_FILE`.
|
||||
let path = self.dir.join(ETH1_DEPOSIT_AMOUNT_FILE);
|
||||
|
||||
Reference in New Issue
Block a user