lightning-waitblockheight

lightning-waitblockheight -- Command for waiting for blocks on the blockchain

SYNOPSIS

waitblockheight blockheight [timeout]

DESCRIPTION

The waitblockheight RPC command waits until the blockchain has reached the specified blockheight.

  • blockheight (u32): Current blockheight of the blockchain if the value is greater than this number. If it is a present or past block height, then the command returns immediately.
  • timeout (u32, optional): Only wait up to specified seconds. The default is 60 seconds.

RETURN VALUE

On success, an object is returned, containing:

  • blockheight (u32): The current block height (>= blockheight parameter).

If timeout seconds is reached without the specified blockheight being reached, this command will fail with a code of 2000.

ERRORS

The following error codes may occur:

  • 2000: Timed out.

AUTHOR

ZmnSCPxj <[email protected]> is mainly responsible.

RESOURCES

Main web site: https://github.com/ElementsProject/lightning

EXAMPLES

Example 1: This will return immediately since the current blockheight exceeds the requested waitblockheight.

Request:

lightning-cli waitblockheight -k "blockheight"=126
{
  "id": "example:waitblockheight#1",
  "method": "waitblockheight",
  "params": {
    "blockheight": 126
  }
}

Response:

{
  "blockheight": 130
}

Example 2: This will return after the next block is mined because requested waitblockheight is one block higher than the current blockheight.

Request:

lightning-cli waitblockheight -k "blockheight"=131 "timeout"=600
{
  "id": "example:waitblockheight#2",
  "method": "waitblockheight",
  "params": {
    "blockheight": 131,
    "timeout": 600
  }
}

Response:

{
  "blockheight": 131
}

Core Lightning (previously c-lightning) is a lightweight, highly customizable and standard compliant implementation of the Lightning Network protocol.

© 2023 Core Lightning
All rights reserved.

Discussion Forum

The official Core Lightning forum is hosted at discuss.corelightning.org

BuildonL2 Community

The official BuildOnL2 community lives at community.corelightning.org. Join us and build the future of bitcoin on lightning.

Mailing List

For general discussions about CLN implementation, use [email protected]. For the Lightning Network, use [email protected]

Telegram

Community-driven telegram group where most of the node operators hang out. Go to https://t.me/lightningd to join.

Discord

Community-driven discord server where the devs flock together. Go to https://discord.gg/w27fMFESMN to join.

Internet Relay Chat

Don't hesitate to reach out to us on IRC at #lightning-dev @ libera.chat, #c-lightning @ libera.chat.