multi: query circuit map inside contractcourt

This commit adds a new config method `QueryIncomingCircuit` that can be
used to query the payment's incoming circuit for giving its outgoing
circuit key.
This commit is contained in:
yyforyongyu committed 2024-04-19 21:33:35 +08:00
1 parent 4134b1c00a
commit 07466c4f8c
10 files changed
+130 -44

No files matched your search

+4 -8
View File
@@ -170,7 +170,7 @@ type ChannelArbitratorConfig struct {
// deadline is defined by the timeout height of its corresponding
// incoming HTLC - this is the expiry height the that remote peer can
// spend his/her outgoing HTLC via the timeout path.
FindOutgoingHTLCDeadline func(rHash chainhash.Hash) fn.Option[int32]
FindOutgoingHTLCDeadline func(htlc channeldb.HTLC) fn.Option[int32]
ChainArbitratorConfig
}
@@ -764,7 +764,7 @@ func (c *ChannelArbitrator) relaunchResolvers(commitSet *CommitSet,
// the resolver with the expiry block height of its
// corresponding incoming HTLC.
if !htlc.Incoming {
deadline := c.cfg.FindOutgoingHTLCDeadline(htlc.RHash)
deadline := c.cfg.FindOutgoingHTLCDeadline(*htlc)
htlcResolver.SupplementDeadline(deadline)
}
}
@@ -2421,9 +2421,7 @@ func (c *ChannelArbitrator) prepContractResolutions(
// supplement the resolver with the expiry
// block height of its corresponding incoming
// HTLC.
deadline := c.cfg.FindOutgoingHTLCDeadline(
htlc.RHash,
)
deadline := c.cfg.FindOutgoingHTLCDeadline(htlc)
resolver.SupplementDeadline(deadline)
htlcResolvers = append(htlcResolvers, resolver)
@@ -2523,9 +2521,7 @@ func (c *ChannelArbitrator) prepContractResolutions(
// supplement the resolver with the expiry
// block height of its corresponding incoming
// HTLC.
deadline := c.cfg.FindOutgoingHTLCDeadline(
htlc.RHash,
)
deadline := c.cfg.FindOutgoingHTLCDeadline(htlc)
resolver.SupplementDeadline(deadline)
htlcResolvers = append(htlcResolvers, resolver)