diff --git a/contractcourt/contract_resolvers.go b/contractcourt/contract_resolvers.go index 29eafe03..92049eb5 100644 --- a/contractcourt/contract_resolvers.go +++ b/contractcourt/contract_resolvers.go @@ -487,8 +487,9 @@ func (h *htlcSuccessResolver) Resolve() (ContractResolver, error) { return nil, err } - log.Debugf("%T(%x): using %v sat/weight to sweep htlc", - "incoming+remote htlc confirmed", h, h.payHash[:]) + log.Debugf("%T(%x): using %v sat/weight to sweep htlc"+ + "incoming+remote htlc confirmed", h, + h.payHash[:], int64(satWeight)) // Using a weight estimator, we'll compute the total // fee required, and from that the value we'll end up @@ -511,9 +512,6 @@ func (h *htlcSuccessResolver) Resolve() (ContractResolver, error) { Value: sweepAmt, }) - log.Infof("%T(%v): crafted sweep tx=%v", h, - h.payHash[:], spew.Sdump(h.sweepTx)) - // With the transaction fully assembled, we can now // generate a valid witness for the transaction. h.htlcResolution.SweepSignDesc.SigHashes = txscript.NewTxSigHashes( @@ -527,6 +525,9 @@ func (h *htlcSuccessResolver) Resolve() (ContractResolver, error) { return nil, err } + log.Infof("%T(%x): crafted sweep tx=%v", h, + h.payHash[:], spew.Sdump(h.sweepTx)) + // With the sweep transaction confirmed, we'll now // Checkpoint our state. if err := h.Checkpoint(h); err != nil { @@ -538,6 +539,8 @@ func (h *htlcSuccessResolver) Resolve() (ContractResolver, error) { // // TODO(roasbeef): validate first? if err := h.PublishTx(h.sweepTx); err != nil { + log.Infof("%T(%x): unable to publish tx: %v", + h, h.payHash[:], err) return nil, err } } @@ -551,6 +554,10 @@ func (h *htlcSuccessResolver) Resolve() (ContractResolver, error) { if err != nil { return nil, err } + + log.Infof("%T(%x): waiting for sweep tx (txid=%v) to be "+ + "confirmed", h, h.payHash[:], sweepTXID) + select { case _, ok := <-confNtfn.Confirmed: if !ok { @@ -561,9 +568,6 @@ func (h *htlcSuccessResolver) Resolve() (ContractResolver, error) { return nil, fmt.Errorf("quitting") } - log.Infof("%T(%x): waiting for sweep tx (txid=%v) to be "+ - "confirmed", h, h.payHash[:], sweepTXID) - // Once the transaction has received a sufficient number of // confirmations, we'll mark ourselves as fully resolved and exit. h.resolved = true diff --git a/lnd_test.go b/lnd_test.go index fc457889..37a5e30a 100644 --- a/lnd_test.go +++ b/lnd_test.go @@ -6233,7 +6233,7 @@ func testMultiHopHtlcRemoteChainClaim(net *lntest.NetworkHarness, t *harnessTest // With the block mined above, Bob should detect that Carol is // attempting to sweep the HTLC on-chain, and should obtain the // preimage. - _, err = waitForTxInMempool(net.Miner.Node, time.Second*10) + _, err = waitForNTxsInMempool(net.Miner.Node, 2, time.Second*15) if err != nil { t.Fatalf("unable to find bob's sweeping transaction") }