Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions channeldb/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,10 @@ func (c *ChannelGraph) AddChannelEdge(edge *models.ChannelEdgeInfo,
}

for _, f := range op {
if f == nil {
return fmt.Errorf("nil scheduler option was used")
}

f(r)
}

Expand Down
26 changes: 22 additions & 4 deletions cmd/commands/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -2359,6 +2359,21 @@ var updateChannelPolicyCommand = cli.Command{
"channels will be updated. Takes the form of " +
"txid:output_index",
},
cli.BoolFlag{
Name: "create_missing_edge",
Usage: "Under unknown circumstances a channel can " +
"exist with a missing edge in the graph " +
"database. This can cause an 'edge not " +
"found' error when calling `getchaninfo` " +
"and/or cause the default channel policy to " +
"be used during forwards. Setting this flag " +
"will recreate the edge if not found, " +
"allowing updating this channel policy and " +
"fixing the missing edge problem for this " +
"channel permanently. For fields not set in " +
"this command, the default policy will be " +
"created.",
},
},
Action: actionDecorator(updateChannelPolicy),
}
Expand Down Expand Up @@ -2518,11 +2533,14 @@ func updateChannelPolicy(ctx *cli.Context) error {
}
}

createMissingEdge := ctx.Bool("create_missing_edge")

req := &lnrpc.PolicyUpdateRequest{
BaseFeeMsat: baseFee,
TimeLockDelta: uint32(timeLockDelta),
MaxHtlcMsat: ctx.Uint64("max_htlc_msat"),
InboundFee: inboundFee,
BaseFeeMsat: baseFee,
TimeLockDelta: uint32(timeLockDelta),
MaxHtlcMsat: ctx.Uint64("max_htlc_msat"),
InboundFee: inboundFee,
CreateMissingEdge: createMissingEdge,
}

if ctx.IsSet("min_htlc_msat") {
Expand Down
4 changes: 4 additions & 0 deletions docs/release-notes/release-notes-0.18.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ types](https://github.com/lightningnetwork/lnd/pull/8960).

## lncli Additions

* [`updatechanpolicy`](https://github.com/lightningnetwork/lnd/pull/8805) will
now update the channel policy if the edge was not found in the graph
database if the `create_missing_edge` flag is set.

# Improvements
## Functional Updates
## RPC Updates
Expand Down
20 changes: 19 additions & 1 deletion lnrpc/lightning.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions lnrpc/lightning.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4558,6 +4558,15 @@ message PolicyUpdateRequest {
// Optional inbound fee. If unset, the previously set value will be
// retained [EXPERIMENTAL].
InboundFee inbound_fee = 10;

// Under unknown circumstances a channel can exist with a missing edge in
// the graph database. This can cause an 'edge not found' error when calling
// `getchaninfo` and/or cause the default channel policy to be used during
// forwards. Setting this flag will recreate the edge if not found, allowing
// updating this channel policy and fixing the missing edge problem for this
// channel permanently. For fields not set in this command, the default
// policy will be created.
bool create_missing_edge = 11;
}

enum UpdateFailure {
Expand Down
4 changes: 4 additions & 0 deletions lnrpc/lightning.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -6751,6 +6751,10 @@
"inbound_fee": {
"$ref": "#/definitions/lnrpcInboundFee",
"description": "Optional inbound fee. If unset, the previously set value will be\nretained [EXPERIMENTAL]."
},
"create_missing_edge": {
"type": "boolean",
"description": "Under unknown circumstances a channel can exist with a missing edge in\nthe graph database. This can cause an 'edge not found' error when calling\n`getchaninfo` and/or cause the default channel policy to be used during\nforwards. Setting this flag will recreate the edge if not found, allowing\nupdating this channel policy and fixing the missing edge problem for this\nchannel permanently. For fields not set in this command, the default\npolicy will be created."
}
}
},
Expand Down
2 changes: 2 additions & 0 deletions log.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import (
"github.com/lightningnetwork/lnd/peernotifier"
"github.com/lightningnetwork/lnd/routing"
"github.com/lightningnetwork/lnd/routing/blindedpath"
"github.com/lightningnetwork/lnd/routing/localchans"
"github.com/lightningnetwork/lnd/rpcperms"
"github.com/lightningnetwork/lnd/signal"
"github.com/lightningnetwork/lnd/sweep"
Expand Down Expand Up @@ -172,6 +173,7 @@ func SetupLoggers(root *build.SubLoggerManager, interceptor signal.Interceptor)
AddSubLogger(root, "CHFD", interceptor, chanfunding.UseLogger)
AddSubLogger(root, "PEER", interceptor, peer.UseLogger)
AddSubLogger(root, "CHCL", interceptor, chancloser.UseLogger)
AddSubLogger(root, "LCHN", interceptor, localchans.UseLogger)

AddSubLogger(root, routing.Subsystem, interceptor, routing.UseLogger)
AddSubLogger(root, routerrpc.Subsystem, interceptor, routerrpc.UseLogger)
Expand Down
31 changes: 31 additions & 0 deletions routing/localchans/log.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package localchans

import (
"github.com/btcsuite/btclog/v2"
"github.com/lightningnetwork/lnd/build"
)

// log is a logger that is initialized with no output filters. This means the
// package will not perform any logging by default until the caller requests
// it.
var log btclog.Logger

const Subsystem = "LCHN"

// The default amount of logging is none.
func init() {
UseLogger(build.NewSubLogger(Subsystem, nil))
}

// DisableLog disables all library log output. Logging output is disabled by
// default until UseLogger is called.
func DisableLog() {
UseLogger(btclog.Disabled)
}

// UseLogger uses a specified Logger to output package logging info. This
// should be used in preference to SetLogWriter if the caller is also using
// btclog.
func UseLogger(logger btclog.Logger) {
log = logger
}
Loading
Loading