multi: add debug logs for edge policy flow
This commit adds more logs around the ChannelUpdate->edge policy process flow.
This commit is contained in:
8 files changed
+43
-10
No files matched your search
@@ -2797,6 +2797,10 @@ func (c *ChannelGraph) UpdateEdgePolicy(edge *models.ChannelEdgePolicy,
|
||||
tx, edge, c.graphCache,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
log.Errorf("UpdateEdgePolicy faild: %v", err)
|
||||
}
|
||||
|
||||
// Silence ErrEdgeNotFound so that the batch can
|
||||
// succeed, but propagate the error via local state.
|
||||
if errors.Is(err, ErrEdgeNotFound) {
|
||||
|
||||
@@ -228,6 +228,9 @@ func (c *GraphCache) UpdatePolicy(policy *models.ChannelEdgePolicy, fromNode,
|
||||
var inboundFee lnwire.Fee
|
||||
_, err := policy.ExtraOpaqueData.ExtractRecords(&inboundFee)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to extract records from edge policy %v: %v",
|
||||
policy.ChannelID, err)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -236,11 +239,16 @@ func (c *GraphCache) UpdatePolicy(policy *models.ChannelEdgePolicy, fromNode,
|
||||
|
||||
updatePolicy := func(nodeKey route.Vertex) {
|
||||
if len(c.nodeChannels[nodeKey]) == 0 {
|
||||
log.Warnf("Node=%v not found in graph cache", nodeKey)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
channel, ok := c.nodeChannels[nodeKey][policy.ChannelID]
|
||||
if !ok {
|
||||
log.Warnf("Channel=%v not found in graph cache",
|
||||
policy.ChannelID)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec/v2/ecdsa"
|
||||
@@ -113,3 +114,10 @@ func (c *ChannelEdgePolicy) ComputeFee(
|
||||
|
||||
return c.FeeBaseMSat + (amt*c.FeeProportionalMillionths)/feeRateParts
|
||||
}
|
||||
|
||||
// String returns a human-readable version of the channel edge policy.
|
||||
func (c *ChannelEdgePolicy) String() string {
|
||||
return fmt.Sprintf("ChannelID=%v, MessageFlags=%v, ChannelFlags=%v, "+
|
||||
"LastUpdate=%v", c.ChannelID, c.MessageFlags, c.ChannelFlags,
|
||||
c.LastUpdate)
|
||||
}
|
||||
Reference in new issue
Block a user