htlcswitch: fix docs on LookupCircuit

This commit is contained in:
yyforyongyu 2021-07-01 07:34:37 +08:00
parent c525c3d34e
commit 22848df07a
No known key found for this signature in database
GPG key ID: 9BCD95C4FF296868
2 changed files with 6 additions and 6 deletions

View file

@ -509,8 +509,8 @@ func (cm *circuitMap) TrimOpenCircuits(chanID lnwire.ShortChannelID,
}, func() {})
}
// LookupByHTLC looks up the payment circuit by the outgoing channel and HTLC
// IDs. Returns nil if there is no such circuit.
// LookupCircuit queries the circuit map for the circuit identified by its
// incoming circuit key. Returns nil if there is no such circuit.
func (cm *circuitMap) LookupCircuit(inKey CircuitKey) *PaymentCircuit {
cm.mtx.RLock()
defer cm.mtx.RUnlock()

View file

@ -377,7 +377,7 @@ func (s *Switch) GetPaymentResult(attemptID uint64, paymentHash lntypes.Hash,
var (
nChan <-chan *networkResult
err error
outKey = CircuitKey{
inKey = CircuitKey{
ChanID: hop.Source,
HtlcID: attemptID,
}
@ -386,7 +386,7 @@ func (s *Switch) GetPaymentResult(attemptID uint64, paymentHash lntypes.Hash,
// If the payment is not found in the circuit map, check whether a
// result is already available.
// Assumption: no one will add this payment ID other than the caller.
if s.circuits.LookupCircuit(outKey) == nil {
if s.circuits.LookupCircuit(inKey) == nil {
res, err := s.networkResults.getResult(attemptID)
if err != nil {
return nil, err