mirror of
https://github.com/aljazceru/plugins.git
synced 2025-12-24 00:24:19 +01:00
autopilot: Improve calculation of available funds
Deduct the funds that are awaiting lockin and can't be used.
This commit is contained in:
committed by
Christian Decker
parent
de1cd7314f
commit
2464c328a2
@@ -133,7 +133,8 @@ def init(configuration, options, plugin):
|
||||
def run_once(plugin, dryrun=False):
|
||||
# Let's start by inspecting the current state of the node
|
||||
funds = plugin.rpc.listfunds()
|
||||
output_funds = sum([o['value'] for o in funds['outputs'] if o['status'] == 'confirmed'])
|
||||
awaiting_lockin_funds = sum([o['channel_sat'] for o in funds['channels'] if o['state'] == 'CHANNELD_AWAITING_LOCKIN'])
|
||||
output_funds = sum([o['value'] for o in funds['outputs'] if o['status'] == 'confirmed']) - awaiting_lockin_funds
|
||||
channels = funds['channels']
|
||||
available_funds = output_funds / 100.0 * plugin.percent
|
||||
|
||||
|
||||
Reference in New Issue
Block a user