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

Wait for bitcoind if it's gone backwards, don't abort. #7342

Merged

Commits on Jun 22, 2024

  1. lightningd: pass height back from getrawblockbyheight.

    Several callers stash this, but we have it, so make it explicit:
    here's the block you asked for.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Jun 22, 2024
    Configuration menu
    Copy the full SHA
    d6bc623 View commit details
    Browse the repository at this point in the history
  2. lightningd: add arg to bitcoind_estimate_fees callback.

    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Jun 22, 2024
    Configuration menu
    Copy the full SHA
    295f06a View commit details
    Browse the repository at this point in the history
  3. lightningd: split chaintopology init from normal loops.

    The current code is confusing: there are polling loops, but we wait for
    them to run once. 
    
    Be explicit: make the calls once, then start the loops in begin_topology.
    
    This removes various chain_topology struct members which only exist for
    startup.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Jun 22, 2024
    Configuration menu
    Copy the full SHA
    6d1cdd0 View commit details
    Browse the repository at this point in the history
  4. lightningd: remove first_call param for getchaininfo.

    It was a weird arbitrary bool passed through from the caller, which we no longer need.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Jun 22, 2024
    Configuration menu
    Copy the full SHA
    06ad987 View commit details
    Browse the repository at this point in the history
  5. lightningd: wait for bitcoind at startup if it's fallen behind.

    Fixes: ElementsProject#6924
    Changelog-Changed: lightningd: we wait for bitcoind if it has somehow gone backwards (as long as header height is still ok).
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Jun 22, 2024
    Configuration menu
    Copy the full SHA
    56a87ce View commit details
    Browse the repository at this point in the history
  6. lightningd: remove unused "min_blockheight" from chain_topology struct.

    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Jun 22, 2024
    Configuration menu
    Copy the full SHA
    7a199a6 View commit details
    Browse the repository at this point in the history
  7. lightningd: move all chainheight logic into setup_topology.

    Handling half in main() and half here was a mess.  And the name
    "max_blockheight" was poor: it was the max in the db, or UINT32_MAX,
    but then we changed it depending on what height we wanted to start at.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Jun 22, 2024
    Configuration menu
    Copy the full SHA
    cb2c7e9 View commit details
    Browse the repository at this point in the history
  8. lightningd: move checkchain_timer out of bitcoind, remove stopped flag.

    checkchain_timer is run by chaintopology, so why have the pointer in
    bitcoind?
    
    And since we free the timers, we don't need them to self-disable by
    checking the stopped flag.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Jun 22, 2024
    Configuration menu
    Copy the full SHA
    c628e75 View commit details
    Browse the repository at this point in the history
  9. lightningd: pass explicit context for bitcoind request functions.

    That way if you free the context, you free the call (i.e. the callback
    will not be called).
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Jun 22, 2024
    Configuration menu
    Copy the full SHA
    b622846 View commit details
    Browse the repository at this point in the history
  10. chaintopology: free outstanding requests so we don't get responses wh…

    …ile shutting down.
    
    I've never seen this, but the race looks possible so we should close it.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Jun 22, 2024
    Configuration menu
    Copy the full SHA
    31637d8 View commit details
    Browse the repository at this point in the history
  11. lightningd: fix race in initialization.

    Found by very slow CI: the two io_breaks() can combine into one, so we
    block waiting for the second initialization which never happens.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Jun 22, 2024
    Configuration menu
    Copy the full SHA
    2e7f8e2 View commit details
    Browse the repository at this point in the history