Formatting.
This commit is contained in:
+8
-10
@@ -59,7 +59,8 @@ pub fn next_target(ts: i64, prev_ts: i64, prev_target: Target, prev_cuckoo_sz: u
|
||||
// increase the cuckoo size when the target gets lower than the soft min as
|
||||
// long as we're not at the max size already; target gets 2x to compensate for
|
||||
// increased next_target
|
||||
let soft_min = SOFT_MIN_TARGET >> (((prev_cuckoo_sz - cmp::min(DEFAULT_SIZESHIFT, prev_cuckoo_sz)) * 8) as usize);
|
||||
let soft_min = SOFT_MIN_TARGET >>
|
||||
(((prev_cuckoo_sz - cmp::min(DEFAULT_SIZESHIFT, prev_cuckoo_sz)) * 8) as usize);
|
||||
let (ptarget, clen) = if prev_target < soft_min && prev_cuckoo_sz < MAX_SIZESHIFT {
|
||||
(prev_target << 1, prev_cuckoo_sz + 1)
|
||||
} else {
|
||||
@@ -88,16 +89,12 @@ pub fn next_target(ts: i64, prev_ts: i64, prev_target: Target, prev_cuckoo_sz: u
|
||||
}
|
||||
|
||||
/// Max target hash, lowest next_target
|
||||
pub const MAX_TARGET: Target = Target([0xf, 0xff, 0xff, 0xff, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0]);
|
||||
pub const MAX_TARGET: Target = Target([0xf, 0xff, 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
/// Target limit under which we start increasing the size shift on Cuckoo cycle.
|
||||
pub const SOFT_MIN_TARGET: Target = Target([0, 0, 0xf, 0xff, 0xff, 0xff, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0]);
|
||||
pub const SOFT_MIN_TARGET: Target = Target([0, 0, 0xf, 0xff, 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
/// Default number of blocks in the past when cross-block cut-through will start
|
||||
/// happening. Needs to be long enough to not overlap with a long reorg.
|
||||
@@ -107,7 +104,8 @@ pub const SOFT_MIN_TARGET: Target = Target([0, 0, 0xf, 0xff, 0xff, 0xff, 0, 0, 0
|
||||
/// easier to reason about.
|
||||
pub const CUT_THROUGH_HORIZON: u32 = 48 * 3600 / (BLOCK_TIME_SEC as u32);
|
||||
|
||||
/// The maximum size we're willing to accept for any message. Enforced by the peer-to-peer networking layer only for DoS protection.
|
||||
/// The maximum size we're willing to accept for any message. Enforced by the
|
||||
/// peer-to-peer networking layer only for DoS protection.
|
||||
pub const MAX_MSG_LEN: u64 = 20_000_000;
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -85,11 +85,11 @@ impl Target {
|
||||
(exp, res)
|
||||
}
|
||||
|
||||
/// Truncates the target to its maximum precision.
|
||||
pub fn truncate(&self) -> Target {
|
||||
let (e, m) = self.split();
|
||||
Target::join(e, m).unwrap()
|
||||
}
|
||||
/// Truncates the target to its maximum precision.
|
||||
pub fn truncate(&self) -> Target {
|
||||
let (e, m) = self.split();
|
||||
Target::join(e, m).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
impl Index<usize> for Target {
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ pub fn genesis() -> core::Block {
|
||||
height: 0,
|
||||
previous: core::hash::Hash([0xff; 32]),
|
||||
timestamp: time::Tm {
|
||||
tm_year: 1997-1900,
|
||||
tm_year: 1997 - 1900,
|
||||
tm_mon: 7,
|
||||
tm_mday: 4,
|
||||
..time::empty_tm()
|
||||
|
||||
Reference in New Issue
Block a user