one day coinbase maturity (#1457)

* one day coinbase maturity

* make one day maturity a soft fork
This commit is contained in:
John Tromp
2018-09-04 11:59:55 +02:00
committed by Antioch Peverell
parent 63880f71c7
commit c359c8aaf2
7 changed files with 22 additions and 14 deletions
+3 -3
View File
@@ -565,15 +565,15 @@ impl<'a> Extension<'a> {
.unwrap_or(0);
if pos > 0 {
// If we have not yet reached 1,000 blocks then
// If we have not yet reached 1,000 / 1,440 blocks then
// we can fail immediately as coinbase cannot be mature.
if height < global::coinbase_maturity() {
if height < global::coinbase_maturity(height) {
return Err(ErrorKind::ImmatureCoinbase.into());
}
// Find the "cutoff" pos in the output MMR based on the
// header from 1,000 blocks ago.
let cutoff_height = height.checked_sub(global::coinbase_maturity()).unwrap_or(0);
let cutoff_height = height.checked_sub(global::coinbase_maturity(height)).unwrap_or(0);
let cutoff_header = self.commit_index.get_header_by_height(cutoff_height)?;
let cutoff_pos = cutoff_header.output_mmr_size;