I only run the calc once, when the FC is mined. Sometimes it’ll include a htlc sweep if it makes it to my mempool before I calculate the fees for the FC (pretty rare). But the bot already posts A LOT and there’s still over 1k FCs in the mempool.
The main problem is the expiry/delay isn’t known from the raw FC tx and not everyone runs a node that will stage 1 sweep immediately. And I believe most implementations won’t stage 2 sweep at a loss. So the backlog of unfinished FCs that needs to be tracked will grow.
Maybe if the mempool ever clears up, I can do some sort of post mortem analysis since I do keep a record of all the FC txids.
Is the code for the bot open-source by any chance?
No. Mostly embarrassed by my lack of coding skills