mirror of
https://github.com/mimblewimble/grin.git
synced 2025-02-01 08:51:08 +03:00
Testnet2 test fixes (#870)
* use dev genesis for automated tests * never test block time on automated tests * automated genesis block creation
This commit is contained in:
parent
327293d28e
commit
6f264b2f7e
4 changed files with 12 additions and 4 deletions
|
@ -237,8 +237,10 @@ fn validate_header(header: &BlockHeader, ctx: &mut BlockContext) -> Result<(), E
|
|||
return Err(Error::InvalidBlockVersion(header.version));
|
||||
}
|
||||
|
||||
// TODO: remove CI check from here somehow
|
||||
if header.timestamp
|
||||
> time::now_utc() + time::Duration::seconds(12 * (consensus::BLOCK_TIME_SEC as i64))
|
||||
&& !global::is_automated_testing_mode()
|
||||
{
|
||||
// refuse blocks more than 12 blocks intervals in future (as in bitcoin)
|
||||
// TODO add warning in p2p code if local time is too different from peers
|
||||
|
|
11
doc/build.md
11
doc/build.md
|
@ -84,9 +84,10 @@ listener automatically on start.
|
|||
|
||||
# Configuration
|
||||
|
||||
Grin has a good defaults, a configuration file `grin.toml` that's documented
|
||||
inline that can override the defaults, and command line switches that has top
|
||||
priority and overrides all others.
|
||||
Grin attempts to run with sensible defaults, and can be further configured via
|
||||
the `grin.toml` file. You should always ensure that this file is available to grin.
|
||||
The supplied `grin.toml` contains inline documentation on all configuration
|
||||
options, and should be the first point of reference for all options.
|
||||
|
||||
The `grin.toml` file can placed in one of several locations, using the first one it finds:
|
||||
|
||||
|
@ -94,6 +95,10 @@ The `grin.toml` file can placed in one of several locations, using the first one
|
|||
2. In the directory that holds the grin executable
|
||||
3. {USER_HOME}/.grin
|
||||
|
||||
While it's recommended that you perform all grin server configuration via
|
||||
`grin.toml`, it's also possible to supply command line switches to grin that
|
||||
override any settings in the `grin.toml` file.
|
||||
|
||||
For help on grin commands and their switches, try:
|
||||
|
||||
```
|
||||
|
|
|
@ -100,6 +100,7 @@ impl Server {
|
|||
let genesis = match config.chain_type {
|
||||
global::ChainTypes::Testnet1 => genesis::genesis_testnet1(),
|
||||
global::ChainTypes::Testnet2 => genesis::genesis_testnet2(),
|
||||
global::ChainTypes::AutomatedTesting => genesis::genesis_dev(),
|
||||
_ => pow::mine_genesis_block(config.mining_config.clone())?,
|
||||
};
|
||||
info!(LOGGER, "Starting server, genesis block: {}", genesis.hash(),);
|
||||
|
|
|
@ -86,7 +86,7 @@ pub fn mine_genesis_block(
|
|||
miner_config: Option<types::MinerConfig>,
|
||||
) -> Result<core::core::Block, Error> {
|
||||
let mut gen = genesis::genesis_testnet2();
|
||||
if global::is_user_testing_mode() {
|
||||
if global::is_user_testing_mode() || global::is_automated_testing_mode() {
|
||||
gen = genesis::genesis_dev();
|
||||
gen.header.timestamp = time::now();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue