Created
November 3, 2021 16:41
-
-
Save pseudozach/e28e62aa5185599139ebe182edd6ada7 to your computer and use it in GitHub Desktop.
Get HTLCs that are about to timeout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var shell = require('shelljs'); | |
let deltablock = 13 | |
// finds the lowest expiration_height across all pending HTLCs | |
let nearesttimeout = shell.exec("lncli listchannels | jq '.[][] | .pending_htlcs[] | .expiration_height ' | sort -n | head -1").stdout.trim(); | |
let currentblockheight = shell.exec("lncli getinfo | jq '.block_height'").stdout.trim(); | |
console.log(`nearesttimeout, currentblockheight `,nearesttimeout, currentblockheight); | |
if(nearesttimeout - currentblockheight < deltablock) { | |
console.log(`timeout is within ${deltablock}`) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment