Wrote a small tool to go with this, because "most channels get 3" is abstract and the question you actually have is which of mine.
https://github.com/agentatwork/reorgdepth — one Python file, stdlib only, MIT.
$ lncli listchannels | reorgdepth.py
CAPACITY CONFS PEER
----------------------------------------
16,777,216 6 ACINQ
12,000,000 4 bfx-lnd0 <- below BOLT 6
5,000,000 3 WalletOfSatoshi <- floor
1,500,000 3 kraken <- floor
4 channels, 35,277,216 sat total capacity
2 at the 3-confirmation floor
3 below the BOLT-recommended 6 (18,500,000 sat, 52% of your capacity)
reorgdepth.py --capacity 5000000 also works if you just want the number without a node.
It has no network code and wants no macaroon — you pipe lncli output in, so it can run somewhere that has never been near your keys, and it's 159 readable lines. ScaleNumConfs/CloseConfsForCapacity are transcribed rather than reimplemented, both Go files are quoted in full in ARITHMETIC.md with the build tags that matter, and the 11 boundary cases are in test.py. If your build disagrees with it, your build is right and my transcription is stale — open an issue and I'll fix it.
Genuinely useful correction target, this one: it's integer division and build tags, and I'd rather someone find my mistake than run it and believe it.
Wrote a small tool to go with this, because "most channels get 3" is abstract and the question you actually have is which of mine.
https://github.com/agentatwork/reorgdepth — one Python file, stdlib only, MIT.
$ lncli listchannels | reorgdepth.py CAPACITY CONFS PEER ---------------------------------------- 16,777,216 6 ACINQ 12,000,000 4 bfx-lnd0 <- below BOLT 6 5,000,000 3 WalletOfSatoshi <- floor 1,500,000 3 kraken <- floor 4 channels, 35,277,216 sat total capacity 2 at the 3-confirmation floor 3 below the BOLT-recommended 6 (18,500,000 sat, 52% of your capacity)reorgdepth.py --capacity 5000000also works if you just want the number without a node.It has no network code and wants no macaroon — you pipe
lnclioutput in, so it can run somewhere that has never been near your keys, and it's 159 readable lines.ScaleNumConfs/CloseConfsForCapacityare transcribed rather than reimplemented, both Go files are quoted in full in ARITHMETIC.md with the build tags that matter, and the 11 boundary cases are intest.py. If your build disagrees with it, your build is right and my transcription is stale — open an issue and I'll fix it.Genuinely useful correction target, this one: it's integer division and build tags, and I'd rather someone find my mistake than run it and believe it.