node uptime wrong #34326

issue embetrix opened this issue on January 17, 2026
  1. embetrix commented at 3:56 PM on January 17, 2026: none

    Is there an existing issue for this?

    • I have searched the existing issues

    Current behaviour

    System is freshly booted but bitcoind show wrong uptime:

    root@raspberrypi5-c8-bf-64:~# bitcoin-cli -conf=/etc/bitcoin/bitcoin.conf uptime
    20120688
    
    

    My real uptime:

    root@raspberrypi5-c8-bf-64:~# uptime 
     15:53:22 up 10 min,  0 user,  load average: 0.61, 0.56, 0.31
    

    version:

    root@raspberrypi5-c8-bf-64:~# bitcoind --version
    Bitcoin Core daemon version v30.2.0 bitcoind
    Copyright (C) 2009-2026 The Bitcoin Core developers
    
    Please contribute if you find Bitcoin Core useful. Visit
    <https://bitcoincore.org/> for further information about the software.
    The source code is available from <https://github.com/bitcoin/bitcoin>.
    
    This is experimental software.
    Distributed under the MIT software license, see the accompanying file COPYING
    or <https://opensource.org/license/MIT>
    
    

    bitcoin conf file:

    root@raspberrypi5-c8-bf-64:~# cat /etc/bitcoin/bitcoin.conf 
    #############################################################
    # Bitcoin configuration file
    #############################################################
    pid=/run/bitcoin/bitcoind.pid
    nodebuglogfile=1
    datadir=/var/bitcoin
    loglevel=info
    proxy=127.0.0.1:9050
    signer=/usr/bin/hwi
    
    # Settings for signet Network
    signet=1
    
    [signet]
    walletdir=/var/wallets
    listen=1
    bind=127.0.0.1
    port=38333
    
    # RPC Settings
    rpcuser=satobox
    rpcport=38332
    rpcbind=127.0.0.1
    rpcallowip=127.0.0.1
    rpcauth=satobox:3381456077fa06cabce053c62a368693$263f4f1cbdc1b4b25233385b931807508f5d8bd59d2c46dc418e4ea2b23dfd09
    rpccookiefile=/run/bitcoin/cookie
    rpccookieperms=group
    server=1
    deprecatedrpc=warnings
    

    Expected behaviour

    should show correct uptime

    Steps to reproduce

    just build new bitcoin core and test with commands above

    Relevant log output

    No response

    How did you obtain Bitcoin Core

    Compiled from source

    What version of Bitcoin Core are you using?

    v30.2

    Operating system and version

    linux

    Machine specifications

    raspberrypi5

  2. pinheadmz commented at 4:10 PM on January 17, 2026: member

    Just to be sure... is the clock on your system correct?

  3. embetrix commented at 4:15 PM on January 17, 2026: none

    @pinheadmz correct the rpi5 does not have an RTC backed up with a battery so if bitcoind start before the NTP is synchronized the bitcoin-cli uptime shows incorrect uptime

  4. pinheadmz commented at 5:02 PM on January 17, 2026: member

    What happens if the clock is correct when you start Bitcoin and still correct when you make the RPC?

  5. l0rinc commented at 5:07 PM on January 17, 2026: contributor

    I was able to reproduce the reported behavior on an RPi5 by simulating a large clock correction using regtest setmocktime (and also via explicit timedatectl set-ntp false)

    $ cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release && ninja -C build bitcoind bitcoin-cli -j$(nproc)
    # ...
    $ DATA_DIR=$(mktemp -d)
    $ ./build/bin/bitcoind -regtest -datadir="$DATA_DIR" -connect=0 -daemon
    Bitcoin Core starting
    $ ./build/bin/bitcoin-cli -regtest -datadir="$DATA_DIR" -rpcwait uptime
    1
    $ ./build/bin/bitcoin-cli -regtest -datadir="$DATA_DIR" setmocktime $(( $(date +%s) + 20000000 ))
    $ ./build/bin/bitcoin-cli -regtest -datadir="$DATA_DIR" uptime
    20000001
    $ ./build/bin/bitcoin-cli -regtest -datadir="$DATA_DIR" stop
    Bitcoin Core stopping
    

    I will push a fix for this to use a std::chrono::steady_clock instead.

  6. l0rinc commented at 8:02 PM on January 17, 2026: contributor

    Thanks for the report, fixed it in #34328 - if you can, please try it out locally to confirm

  7. willcl-ark added the label Bug on Jan 20, 2026
  8. sedited referenced this in commit 27aeeff630 on Jan 27, 2026
  9. pinheadmz commented at 4:18 PM on January 27, 2026: member

    Was this closed by #34328 ?

  10. l0rinc commented at 4:29 PM on January 27, 2026: contributor

    yes, please close the issue.

  11. fanquake closed this on Jan 27, 2026

  12. dergoegge commented at 10:34 AM on January 29, 2026: member

    @embetrix out of curiosity what is your usecase for the uptime RPC? Any reason you prefer it over querying your OS for the uptime of the bitcoind process?

  13. embetrix commented at 10:49 AM on January 29, 2026: none

    @dergoegge : I started a project recently : https://github.com/embetrix/satobox it implement a full node built completely from sources (including OS and all packages). It runs actually on RPI5 but not exclusivly. I have hw wallet management system using Specter-Desktop and it showed previously wrong uptime when bitcoin was started before NTP sync. I mitigated that by adding systemd requirement on NTP : https://github.com/embetrix/satobox/blob/scarthgap/meta-satobox/recipes-bitcoin/bitcoin/bitcoin/bitcoind.service.in#L3 but the fix proposed by @l0rinc is cleaner and I can remove this dependency with future bitcoin core releases to have a quicker start of the node.


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-03 15:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me