diff --git a/contractcourt/contract_resolvers.go b/contractcourt/contract_resolvers.go index 60bb6a171..29eafe033 100644 --- a/contractcourt/contract_resolvers.go +++ b/contractcourt/contract_resolvers.go @@ -801,10 +801,21 @@ func (h *htlcOutgoingContestResolver) Resolve() (ContractResolver, error) { // Otherwise, we'll watch for two external signals to decide if we'll // morph into another resolver, or fully resolve the contract. + // The output we'll be watching for is the *direct* spend from the HTLC + // output. If this isn't our commitment transaction, it'll be right on + // the resolution. Otherwise, we fetch this pointer from the input of + // the time out transaction. + var outPointToWatch wire.OutPoint + if h.htlcResolution.SignedTimeoutTx == nil { + outPointToWatch = h.htlcResolution.ClaimOutpoint + } else { + outPointToWatch = h.htlcResolution.SignedTimeoutTx.TxIn[0].PreviousOutPoint + } + // First, we'll register for a spend notification for this output. If // the remote party sweeps with the pre-image, we'll be notified. spendNtfn, err := h.Notifier.RegisterSpendNtfn( - &h.htlcResolution.ClaimOutpoint, + &outPointToWatch, h.broadcastHeight, ) if err != nil { diff --git a/lnd_test.go b/lnd_test.go index 666e640d4..fc457889b 100644 --- a/lnd_test.go +++ b/lnd_test.go @@ -5136,7 +5136,7 @@ func testMultiHopHtlcLocalTimeout(net *lntest.NetworkHarness, t *harnessTest) { return true }, time.Second*15) if err != nil { - t.Fatalf("htlc mismatch: %v", err) + t.Fatalf("htlc mismatch: %v", predErr) } // We'll now mine enough blocks to trigger Bob's broadcast of his