Merge pull request #11 from ziggie1984/pr_issue_7

pull/8/head
rkfg 2 years ago committed by GitHub
commit 2e3f0183d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -38,36 +38,31 @@ rebalance-lnd](https://github.com/accumulator/rebalance-lnd).
# Parameters
```
-f, --config= config file path
-c, --connect= connect to lnd using host:port
-t, --tlscert= path to tls.cert to connect
--macaroon-dir= path to the macaroon directory
--macaroon-filename= macaroon filename
-n, --network= bitcoin network to use
--pfrom= channels with less than this inbound liquidity percentage will be considered as source channels
--pto= channels with less than this outbound liquidity percentage will be considered as target channels
-p, --perc= use this value as both pfrom and pto from above
-a, --amount= amount to rebalance
-r, --econ-ratio= economical ratio for fee limit calculation as a multiple of target channel fee (for
example, 0.5 means you want to pay at max half the fee you might earn for routing out of
the target channel)
-F, --fee-limit-ppm= don't consider the target channel fee and use this max fee ppm instead
(can rebalance at a loss, be careful)
-l, --lost-profit also consider the outbound channel fees when looking for profitable routes so that
outbound_fee+inbound_fee < route_fee
-b, --probe= if the payment fails at the last hop try to probe lower amount using this many steps
--min-amount= if probing is enabled this will be the minimum amount to try
-i, --exclude-channel-in= don't use this channel as incoming (can be specified multiple times)
-o, --exclude-channel-out= don't use this channel as outgoing (can be specified multiple times)
-e, --exclude-channel= don't use this channel at all (can be specified multiple times)
-d, --exclude-node= don't use this node for routing (can be specified multiple times)
--to= try only this channel as target (should satisfy other constraints too)
--from= try only this channel as source (should satisfy other constraints too)
--allow-unbalance-from let the source channel go below 50% local liquidity, use if you want to drain a channel;
you should also set --pfrom to >50
--allow-unbalance-to let the target channel go above 50% local liquidity, use if you want to refill a channel;
you should also set --pto to >50
-s, --stat= save successful rebalance information to the specified CSV file
-f, --config= config file path
-c, --connect= connect to lnd using host:port
-t, --tlscert= path to tls.cert to connect
--macaroon-dir= path to the macaroon directory
--macaroon-filename= macaroon filename
-n, --network= bitcoin network to use
--pfrom= channels with less than this inbound liquidity percentage will be considered as source channels
--pto= channels with less than this outbound liquidity percentage will be considered as target channels
-p, --perc= use this value as both pfrom and pto from above
-a, --amount= amount to rebalance
-r, --econ-ratio= economical ratio for fee limit calculation as a multiple of target channel fee (for example, 0.5 means you want to pay at max half the fee you might earn for routing out of the target channel)
-F, --fee-limit-ppm= don't consider the target channel fee and use this max fee ppm instead (can rebalance at a loss, be careful)
-l, --lost-profit also consider the outbound channel fees when looking for profitable routes so that outbound_fee+inbound_fee < route_fee
-b, --probe-steps= if the payment fails at the last hop try to probe lower amount using this many steps
--min-amount= if probing is enabled this will be the minimum amount to try
-i, --exclude-channel-in= don't use this channel as incoming (can be specified multiple times)
-o, --exclude-channel-out= don't use this channel as outgoing (can be specified multiple times)
-e, --exclude-channel= don't use this channel at all (can be specified multiple times)
-d, --exclude-node= don't use this node for routing (can be specified multiple times)
--to= try only this channel as target (should satisfy other constraints too; can be specified multiple times)
--from= try only this channel as source (should satisfy other constraints too; can be specified multiple times)
--allow-unbalance-from let the source channel go below 50% local liquidity, use if you want to drain a channel; you should also set --pfrom to >50
--allow-unbalance-to let the target channel go above 50% local liquidity, use if you want to refill a channel; you should also set --pto to >50
-s, --stat= save successful rebalance information to the specified CSV file
```
Look in `config.json.sample` or `config.toml.sample` for corresponding keys,

@ -45,7 +45,7 @@ func (r *regolancer) getChannelCandidates(fromPerc, toPerc, amount int64) error
if _, ok := r.excludeIn[c.ChanId]; ok {
continue
}
if r.toChannelId == 0 || r.toChannelId == c.ChanId {
if _, ok := r.toChannelId[c.ChanId]; ok || len(r.toChannelId) == 0 {
r.toChannels = append(r.toChannels, c)
}
}
@ -55,7 +55,7 @@ func (r *regolancer) getChannelCandidates(fromPerc, toPerc, amount int64) error
if _, ok := r.excludeOut[c.ChanId]; ok {
continue
}
if r.fromChannelId == 0 || r.fromChannelId == c.ChanId {
if _, ok := r.fromChannelId[c.ChanId]; ok || len(r.fromChannelId) == 0 {
r.fromChannels = append(r.fromChannels, c)
}
}

@ -27,6 +27,12 @@
"0363749dbdb99321177082935bf7c36978fc46c725c5c452d48d721ab31e7682c2",
"026165850492521f4ac8abd9bd8088123446d126f648ca35e60f88177dc149ceb2"
],
"from": 824787652482170883,
"to": 822784342311501826
"from": [
794863344113680384,
806323553821196289
],
"to": [
822784342311501826,
821280210373779139
]
}

@ -36,4 +36,13 @@ lost_profit = true
#Boltz
"026165850492521f4ac8abd9bd8088123446d126f648ca35e60f88177dc149ceb2"
]
"to" = [
794863344113680384,
817004209683890177,
806323553821196289
]
"from" = [
821280210377179137,
821280210377179136
]

@ -36,8 +36,8 @@ type configParams struct {
ExcludeChannelsOut []uint64 `short:"o" long:"exclude-channel-out" description:"don't use this channel as outgoing (can be specified multiple times)" json:"exclude_channels_out" toml:"exclude_channels_out"`
ExcludeChannels []uint64 `short:"e" long:"exclude-channel" description:"don't use this channel at all (can be specified multiple times)" json:"exclude_channels" toml:"exclude_channels"`
ExcludeNodes []string `short:"d" long:"exclude-node" description:"don't use this node for routing (can be specified multiple times)" json:"exclude_nodes" toml:"exclude_nodes"`
ToChannel uint64 `long:"to" description:"try only this channel as target (should satisfy other constraints too)" json:"to" toml:"to"`
FromChannel uint64 `long:"from" description:"try only this channel as source (should satisfy other constraints too)" json:"from" toml:"from"`
ToChannel []uint64 `long:"to" description:"try only this channel as target (should satisfy other constraints too; can be specified multiple times)" json:"to" toml:"to"`
FromChannel []uint64 `long:"from" description:"try only this channel as source (should satisfy other constraints too; can be specified multiple times)" json:"from" toml:"from"`
AllowUnbalanceFrom bool `long:"allow-unbalance-from" description:"let the source channel go below 50% local liquidity, use if you want to drain a channel; you should also set --pfrom to >50" json:"allow_unbalance_from" toml:"allow_unbalance_from"`
AllowUnbalanceTo bool `long:"allow-unbalance-to" description:"let the target channel go above 50% local liquidity, use if you want to refill a channel; you should also set --pto to >50" json:"allow_unbalance_to" toml:"allow_unbalance_to"`
StatFilename string `short:"s" long:"stat" description:"save successful rebalance information to the specified CSV file" json:"stat" toml:"stat"`
@ -56,9 +56,9 @@ type regolancer struct {
myPK string
channels []*lnrpc.Channel
fromChannels []*lnrpc.Channel
fromChannelId uint64
fromChannelId map[uint64]struct{}
toChannels []*lnrpc.Channel
toChannelId uint64
toChannelId map[uint64]struct{}
channelPairs map[string][2]*lnrpc.Channel
nodeCache map[string]*lnrpc.NodeInfo
chanCache map[uint64]*lnrpc.ChannelEdge
@ -215,11 +215,11 @@ func main() {
if err != nil {
log.Fatal("Error listing own channels: ", err)
}
if params.FromChannel > 0 {
r.fromChannelId = params.FromChannel
if len(params.FromChannel) > 0 {
r.fromChannelId = makeChanSet(params.FromChannel)
}
if params.ToChannel > 0 {
r.toChannelId = params.ToChannel
if len(params.ToChannel) > 0 {
r.toChannelId = makeChanSet(params.ToChannel)
}
r.excludeIn = makeChanSet(params.ExcludeChannelsIn)
r.excludeOut = makeChanSet(params.ExcludeChannelsOut)

Loading…
Cancel
Save