mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 03:21:08 +03:00
parent
b291467b96
commit
7aa27652b7
8 changed files with 15 additions and 16 deletions
|
@ -1680,7 +1680,7 @@ mod test {
|
||||||
|
|
||||||
let input = Input {
|
let input = Input {
|
||||||
features: OutputFeatures::Plain,
|
features: OutputFeatures::Plain,
|
||||||
commit: commit,
|
commit,
|
||||||
};
|
};
|
||||||
|
|
||||||
let block_hash =
|
let block_hash =
|
||||||
|
@ -1696,7 +1696,7 @@ mod test {
|
||||||
// different) and check it generates a different short_id
|
// different) and check it generates a different short_id
|
||||||
let input = Input {
|
let input = Input {
|
||||||
features: OutputFeatures::Coinbase,
|
features: OutputFeatures::Coinbase,
|
||||||
commit: commit,
|
commit,
|
||||||
};
|
};
|
||||||
|
|
||||||
let short_id = input.short_id(&block_hash, nonce);
|
let short_id = input.short_id(&block_hash, nonce);
|
||||||
|
|
|
@ -127,7 +127,7 @@ where
|
||||||
(
|
(
|
||||||
tx.with_output(Output {
|
tx.with_output(Output {
|
||||||
features: OutputFeatures::Plain,
|
features: OutputFeatures::Plain,
|
||||||
commit: commit,
|
commit,
|
||||||
proof: rproof,
|
proof: rproof,
|
||||||
}),
|
}),
|
||||||
kern,
|
kern,
|
||||||
|
|
|
@ -79,7 +79,7 @@ impl From<ErrorKind> for Error {
|
||||||
|
|
||||||
impl From<Context<ErrorKind>> for Error {
|
impl From<Context<ErrorKind>> for Error {
|
||||||
fn from(inner: Context<ErrorKind>) -> Error {
|
fn from(inner: Context<ErrorKind>) -> Error {
|
||||||
Error { inner: inner }
|
Error { inner }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ where
|
||||||
|
|
||||||
let output = Output {
|
let output = Output {
|
||||||
features: OutputFeatures::Coinbase,
|
features: OutputFeatures::Coinbase,
|
||||||
commit: commit,
|
commit,
|
||||||
proof: rproof,
|
proof: rproof,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ where
|
||||||
|
|
||||||
let proof = TxKernel {
|
let proof = TxKernel {
|
||||||
features: KernelFeatures::Coinbase,
|
features: KernelFeatures::Coinbase,
|
||||||
excess: excess,
|
excess,
|
||||||
excess_sig: sig,
|
excess_sig: sig,
|
||||||
};
|
};
|
||||||
Ok((output, proof))
|
Ok((output, proof))
|
||||||
|
|
|
@ -61,10 +61,10 @@ fn copy_to(src: &Path, src_type: &fs::FileType, dst: &Path) -> io::Result<u64> {
|
||||||
} else if src_type.is_dir() {
|
} else if src_type.is_dir() {
|
||||||
copy_dir_to(src, dst)
|
copy_dir_to(src, dst)
|
||||||
} else {
|
} else {
|
||||||
return Err(io::Error::new(
|
Err(io::Error::new(
|
||||||
io::ErrorKind::Other,
|
io::ErrorKind::Other,
|
||||||
format!("Could not copy: {}", src.display()),
|
format!("Could not copy: {}", src.display()),
|
||||||
));
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ pub fn from_hex(hex_str: String) -> Result<Vec<u8>, num::ParseIntError> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn split_n(s: &str, n: usize) -> Vec<&str> {
|
fn split_n(s: &str, n: usize) -> Vec<&str> {
|
||||||
(0..(s.len() - n + 1) / 2 + 1)
|
(0..=(s.len() - n + 1) / 2)
|
||||||
.map(|i| &s[2 * i..2 * i + n])
|
.map(|i| &s[2 * i..2 * i + n])
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,14 +88,13 @@ pub fn init_logger(config: Option<LoggingConfig>) {
|
||||||
|
|
||||||
let level_stdout = convert_log_level(&c.stdout_log_level);
|
let level_stdout = convert_log_level(&c.stdout_log_level);
|
||||||
let level_file = convert_log_level(&c.file_log_level);
|
let level_file = convert_log_level(&c.file_log_level);
|
||||||
let level_minimum;
|
|
||||||
|
|
||||||
// Determine minimum logging level for Root logger
|
// Determine minimum logging level for Root logger
|
||||||
if level_stdout > level_file {
|
let level_minimum = if level_stdout > level_file {
|
||||||
level_minimum = level_stdout;
|
level_stdout
|
||||||
} else {
|
} else {
|
||||||
level_minimum = level_file;
|
level_file
|
||||||
}
|
};
|
||||||
|
|
||||||
// Start logger
|
// Start logger
|
||||||
let stdout = ConsoleAppender::builder()
|
let stdout = ConsoleAppender::builder()
|
||||||
|
|
|
@ -77,7 +77,7 @@ impl RateCounter {
|
||||||
|
|
||||||
fn truncate(&mut self) {
|
fn truncate(&mut self) {
|
||||||
let now_millis = millis_since_epoch();
|
let now_millis = millis_since_epoch();
|
||||||
while self.last_min_entries.len() > 0
|
while !self.last_min_entries.is_empty()
|
||||||
&& self.last_min_entries[0].timestamp + 60000 < now_millis
|
&& self.last_min_entries[0].timestamp + 60000 < now_millis
|
||||||
{
|
{
|
||||||
self.last_min_entries.remove(0);
|
self.last_min_entries.remove(0);
|
||||||
|
@ -106,5 +106,5 @@ fn millis_since_epoch() -> u64 {
|
||||||
let since_epoch = SystemTime::now()
|
let since_epoch = SystemTime::now()
|
||||||
.duration_since(SystemTime::UNIX_EPOCH)
|
.duration_since(SystemTime::UNIX_EPOCH)
|
||||||
.unwrap_or(Duration::new(0, 0));
|
.unwrap_or(Duration::new(0, 0));
|
||||||
since_epoch.as_secs() * 1000 + since_epoch.subsec_millis() as u64
|
since_epoch.as_secs() * 1000 + u64::from(since_epoch.subsec_millis())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue