mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 03:21:08 +03:00
Missing consensus file.
This commit is contained in:
parent
d2110f5b46
commit
d710301833
1 changed files with 48 additions and 0 deletions
48
core/src/consensus.rs
Normal file
48
core/src/consensus.rs
Normal file
|
@ -0,0 +1,48 @@
|
|||
// Copyright 2016 The Grin Developers
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! All the rules required for a cryptocurrency to have reach consensus across
|
||||
//! the whole network are complex and hard to completely isolate. Some can be
|
||||
//! simple parameters (like block reward), others complex algorithms (like
|
||||
//! Merkle sum trees or reorg rules). However, as long as they're simple
|
||||
//! emough, consensus-relevant constants and short functions should be kept
|
||||
//! here.
|
||||
|
||||
/// The block subsidy amount
|
||||
pub const REWARD: u64 = 1_000_000_000;
|
||||
|
||||
/// Block interval, in seconds
|
||||
pub const BLOCK_TIME_SEC: u8 = 15;
|
||||
|
||||
/// Cuckoo-cycle proof size (cycle length)
|
||||
pub const PROOFSIZE: usize = 42;
|
||||
|
||||
/// Default Cuckoo Cycle size shift used is 28. We may decide to increase it.
|
||||
/// when difficuty increases.
|
||||
pub const SIZESHIFT: u32 = 28;
|
||||
|
||||
/// Default Cuckoo Cycle easiness, high enough to have good likeliness to find
|
||||
/// a solution.
|
||||
pub const EASINESS: u32 = 50;
|
||||
|
||||
/// Max target hash, lowest difficulty
|
||||
pub const MAX_TARGET: [u32; PROOFSIZE] =
|
||||
[0xfff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
|
||||
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
|
||||
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
|
||||
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff];
|
||||
|
||||
/// The maximum number of inputs or outputs a transaction may have
|
||||
/// and be deserializable. Only for DoS protection.
|
||||
pub const MAX_IN_OUT_LEN: u64 = 50000;
|
Loading…
Reference in a new issue