lnrpc: set a zero value endorsement signal on sender outgoing htlc

Before we have sufficient signaling in the network to relay this
signal, set a zero value experimental endorsement value on the sender's
outgoing htlc. Once the network is relaying this signal and a flag day
has been set, we'll be able to set a non-zero value here.
This commit is contained in:
Carla Kirk-Cohen committed 2024-11-22 09:16:57 -05:00
1 parent 774bfa740a
commit 4bb5b0c27c
3 files changed
+45 -16

No files matched your search

+21
View File
@@ -110,6 +110,10 @@ type RouterBackend struct {
// ParseCustomChannelData is a function that can be used to parse custom
// channel data from the first hop of a route.
ParseCustomChannelData func(message proto.Message) error
// ShouldSetExpEndorsement returns a boolean indicating whether the
// experimental endorsement bit should be set.
ShouldSetExpEndorsement func() bool
}
// MissionControl defines the mission control dependencies of routerrpc.
@@ -891,6 +895,23 @@ func (r *RouterBackend) extractIntentFromSendRequest(
}
payIntent.FirstHopCustomRecords = firstHopRecords
// If the experimental endorsement signal is not already set, propagate
// a zero value field if configured to set this signal.
if r.ShouldSetExpEndorsement() {
if payIntent.FirstHopCustomRecords == nil {
payIntent.FirstHopCustomRecords = make(
map[uint64][]byte,
)
}
t := uint64(lnwire.ExperimentalEndorsementType)
if _, set := payIntent.FirstHopCustomRecords[t]; !set {
payIntent.FirstHopCustomRecords[t] = []byte{
lnwire.ExperimentalUnendorsed,
}
}
}
payIntent.PayAttemptTimeout = time.Second *
time.Duration(rpcPayReq.TimeoutSeconds)