Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CreateNewBlock: TestBlockValidity failed: time-too-far-ahead-of-mtp #6976

Open
Kidyeah408 opened this issue Nov 3, 2024 · 1 comment
Open

Comments

@Kidyeah408
Copy link

Describe the issue

When running Zcash in regtest mode, I encounter the error "CreateNewBlock: TestBlockValidity failed: time-too-far-ahead-of-mtp (code 16)" when generating a new block. How can I resolve this?

Can you reliably reproduce the issue?

If so, please list the steps to reproduce below:

  1. linc@DESKTOP-8UIJ4HT:~/zcash$ src/zcash-cli -datadir=/tmp/regtest-datadir generate 1
    error code: -1
    error message:
    CreateNewBlock: TestBlockValidity failed: time-too-far-ahead-of-mtp (code 16)

Expected behaviour

Actual behaviour + errors

CreateNewBlock: TestBlockValidity failed: time-too-far-ahead-of-mtp (code 16)

The version of Zcash you were using:

v5.10.0

Machine specs:

  • OS name + version:Ubuntu 22.04.5 LTS(WSL)
  • CPU:AMD Ryzen 7 5700G with Radeon Graphics 3.80 GHz
  • RAM:8GB
  • Disk size:
  • Disk Type (HD/SDD):
  • Linux kernel version (uname -a):
  • Compiler version (gcc --version):
  • Linker version (ld -v):
  • Assembler version (as --version):

Any extra information that might be useful in the debugging process.

2024-11-03T13:51:37.376839Z INFO main: CreateNewBlock: total size 1000 (excluding coinbase) txs: 0 fees: 0 sigops 100
2024-11-03T13:51:37.377203Z INFO main: SetChainPoolValues: Lockbox value is 0 at height 7
2024-11-03T13:51:37.377222Z ERROR main: ContextualCheckBlockHeader: block at height 7, timestamp 1730641897 is too far ahead of median-time-past, limit is 1730631435
2024-11-03T13:51:37.377250Z INFO main: keypool return 3

Do you have a backup of ~/.zcash directory and/or take a VM snapshot?

image

@daira
Copy link
Contributor

daira commented Nov 19, 2024

This is due to a violation of the following block consensus rule:

For each block at block height 2 or greater on Mainnet, or block height 653606 or greater on Testnet, nTime
MUST be less than or equal to the median-time-past of that block plus 90 · 60 seconds.

Regtest mode is designed to be run from the RPC tests, which ensure they have a sufficiently up-to-date block chain by recreating one starting from a new genesis block if needed (and depending on the configured cache behaviour): https://github.com/zcash/zcash/blob/master/qa/rpc-tests/test_framework/util.py#L228

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants