Skip to content

[bug]: maximum max_events documentation for ForwardingHistory not actually implemented #10496

@ZZiigguurraatt

Description

@ZZiigguurraatt

Pre-Submission Checklist

  • I have searched the existing issues and believe this is a new bug.
  • I am not asking a question about how to use lnd, but reporting a bug (otherwise open a discussion).

LND Version

lncli version 0.20.0-beta commit=lightning-terminal-v0.16.0-alpha

LND Configuration

            - --disableui
            - --macaroonpath=/home/litd/.lit/regtest/lit.macaroon
            - --lnd.bitcoind.zmqpubrawtx=tcp://bitcoind:28335
            - --lnd.bitcoind.zmqpubrawblock=tcp://bitcoind:28334
            - --lnd.bitcoin.regtest
            - --lnd-mode=integrated
            - --lnd.allow-circular-route
            - --pool-mode=disable
            - --loop-mode=disable
            - --autopilot.disable
            - --lnd.debuglevel=debug
            - --lnd.trickledelay=50
            - --lnd.gossip.sub-batch-delay=5ms
            - --lnd.caches.rpc-graph-cache-duration=100ms
            - --lnd.default-remote-max-htlcs=483
            - --lnd.dust-threshold=5000000
            - --lnd.protocol.option-scid-alias
            - --lnd.protocol.zero-conf
            - --lnd.protocol.simple-taproot-chans
            - --lnd.protocol.simple-taproot-overlay-chans
            - --lnd.protocol.wumbo-channels
            - --lnd.accept-keysend
            - --lnd.protocol.custom-message=17
            - --lnd.wallet-unlock-password-file=/tmp/wallet-password
            - --lnd.wallet-unlock-allow-create
            - --taproot-assets.allow-public-uni-proof-courier
            - --taproot-assets.universe.public-access=rw
            - --taproot-assets.universe.sync-all-assets
            - --taproot-assets.allow-public-stats
            - --taproot-assets.universerpccourier.skipinitdelay
            - --taproot-assets.universerpccourier.backoffresetwait=1s
            - --taproot-assets.universerpccourier.numtries=5
            - --taproot-assets.universerpccourier.initialbackoff=300ms
            - --taproot-assets.universerpccourier.maxbackoff=600ms
            - --taproot-assets.experimental.rfq.acceptpricedeviationppm=100000
            - --taproot-assets.experimental.rfq.priceoracleaddress=use_mock_price_oracle_service_promise_to_not_use_on_mainnet
            - --taproot-assets.experimental.rfq.mockoracleassetsperbtc=10000000000

Backend Version

bitcoind 29.1

Backend Configuration

            - -server=1
            - -regtest=1
            - -zmqpubrawblock=tcp://0.0.0.0:28334
            - -zmqpubrawtx=tcp://0.0.0.0:28335
            - -zmqpubhashblock=tcp://0.0.0.0:28336
            - -zmqpubhashblockhwm=100000
            - -zmqpubhashtxhwm=100000
            - -zmqpubrawblockhwm=100000
            - -zmqpubrawtxhwm=100000
            - -txindex=1
            - -dnsseed=0
            - -upnp=0
            - -rpcbind=0.0.0.0
            - -rpcallowip=0.0.0.0/0
            - -rpcthreads=40
            - -rest
            - -listen=1
            - -listenonion=0
            - -fallbackfee=0.0002
            - -blockfilterindex=1
            - -peerblockfilters=1

OS/Distribution

Ubuntu 22.04.5 LTS

Bug Details & Steps to Reproduce

At

  • lnd/rpcserver.go

    Lines 8193 to 8198 in 7bbf26c

    // A list of forwarding events are returned. The size of each forwarding event
    // is 40 bytes, and the max message size able to be returned in gRPC is 4 MiB.
    // In order to safely stay under this max limit, we'll return 50k events per
    // response. Each response has the index offset of the last entry. The index
    // offset can be provided to the request to allow the caller to skip a series
    // of records.
  • lnd/lnrpc/lightning.proto

    Lines 471 to 478 in 7bbf26c

    A list of forwarding events are returned. The size of each forwarding event
    is 40 bytes, and the max message size able to be returned in gRPC is 4 MiB.
    As a result each message can only contain 50k entries. Each response has
    the index offset of the last entry. The index offset can be provided to the
    request to allow the caller to skip a series of records.
    */
    rpc ForwardingHistory (ForwardingHistoryRequest)
    returns (ForwardingHistoryResponse);
  • The max number of events returned is 50k. The default number is 100,
    callers can use the --max_events param to modify this value.

it says the maximum number of records returned is 50,000.

I can't find anywhere in the code that this is actually enforced and when testing, it doesn't seem to be because I get

litd@james-886dd699c-4vb2q:/$ lncli fwdinghistory --max_events 999999999 --start_time -999d|tail -2
    "last_offset_index": 277736
}
litd@james-886dd699c-4vb2q:/$ 

Expected Behavior

max_events should be limited as the documentation says. If the user sets too large of a value, this is going to cause problems like is mentioned because the max size of a gRPC message, in which case we will get problems like #9709 (comment).

Debug Information

No response

Environment

litd in kubernetes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions