fixed median_timestamp function
This commit is contained in:
parent
0f7348e139
commit
c5bb32f931
|
@ -6,7 +6,7 @@ use network::Magic;
|
||||||
pub fn median_timestamp(header: &BlockHeader, store: &BlockHeaderProvider, network: Magic) -> u32 {
|
pub fn median_timestamp(header: &BlockHeader, store: &BlockHeaderProvider, network: Magic) -> u32 {
|
||||||
// TODO: timestamp validation on testnet is broken
|
// TODO: timestamp validation on testnet is broken
|
||||||
if network == Magic::Testnet {
|
if network == Magic::Testnet {
|
||||||
return header.time;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
let ancestors = 11;
|
let ancestors = 11;
|
||||||
|
@ -23,7 +23,7 @@ pub fn median_timestamp(header: &BlockHeader, store: &BlockHeaderProvider, netwo
|
||||||
}
|
}
|
||||||
|
|
||||||
if timestamps.is_empty() {
|
if timestamps.is_empty() {
|
||||||
return header.time;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
let timestamps = timestamps.into_iter().collect::<Vec<_>>();
|
let timestamps = timestamps.into_iter().collect::<Vec<_>>();
|
||||||
|
|
Loading…
Reference in New Issue