Skip to content

Commit

Permalink
add ignore_fees strategy to README, fix a few typos/code style
Browse files Browse the repository at this point in the history
  • Loading branch information
accumulator committed Nov 22, 2022
1 parent efbb760 commit 83caf18
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ Available strategies:

|Strategy|Description|Parameters|
|:--|:--|:--|
|**ignore** | ignores the channel||
|**ignore** | ignores the channel completely||
|**ignore_fees** | don't make any fee changes, only update htlc size limits and time_lock_delta||
|**static** | sets fixed base fee and fee rate values.| **fee_ppm**|
|**match_peer** | sets the same base fee and fee rate values as the peer|if **base_fee_msat** or **fee_ppm** are set the override the peer values|
|**cost** | calculate cost for opening channel, and set ppm to cover cost when channel depletes.|**cost_factor**|
Expand Down
10 changes: 6 additions & 4 deletions charge_lnd/strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,17 @@ def strategy_static(channel, policy, **kwargs):
@strategy(name = 'proportional')
def strategy_proportional(channel, policy, **kwargs):
if policy.getint('min_fee_ppm_delta',-1) < 0:
policy.set('min_fee_ppm_delta', 10) # set delta to 5 if not defined
policy.set('min_fee_ppm_delta', 10) # set delta to 10 if not defined
ppm_min = policy.getint('min_fee_ppm')
ppm_max = policy.getint('max_fee_ppm')
if ppm_min is None or ppm_max is None:
raise Exception('proportional strategy requires min_fee_ppm and max_fee_ppm properties')

if policy.getbool('sum_peer_chans', False):
lnd = kwargs['lnd']; shared_chans=lnd.get_shared_channels(channel.remote_pubkey)
local_balance = 0; remote_balance = 0
lnd = kwargs['lnd']
shared_chans=lnd.get_shared_channels(channel.remote_pubkey)
local_balance = 0
remote_balance = 0
for c in (shared_chans):
# Include balance of all active channels with peer
if c.active:
Expand Down Expand Up @@ -141,7 +143,7 @@ def strategy_onchain_fee(channel, policy, **kwargs):
raise Exception("No electrum server specified, cannot use strategy 'onchain_fee'")

if policy.getint('min_fee_ppm_delta',-1) < 0:
policy.set('min_fee_ppm_delta', 10) # set delta to 5 if not defined
policy.set('min_fee_ppm_delta', 10) # set delta to 10 if not defined

numblocks = policy.getint('onchain_fee_numblocks', 6)
sat_per_byte = Electrum.get_fee_estimate(numblocks)
Expand Down

0 comments on commit 83caf18

Please sign in to comment.