cnct/contract_resolvers: reliably publish htlc success sweep
This commit is contained in:
parent
b7aebd92cf
commit
682c4c96c7
@ -481,22 +481,22 @@ func (h *htlcSuccessResolver) Resolve() (ContractResolver, error) {
|
|||||||
log.Infof("%T(%x): crafted sweep tx=%v", h,
|
log.Infof("%T(%x): crafted sweep tx=%v", h,
|
||||||
h.payHash[:], spew.Sdump(h.sweepTx))
|
h.payHash[:], spew.Sdump(h.sweepTx))
|
||||||
|
|
||||||
// With the sweep transaction confirmed, we'll now
|
// With the sweep transaction signed, we'll now
|
||||||
// Checkpoint our state.
|
// Checkpoint our state.
|
||||||
if err := h.Checkpoint(h); err != nil {
|
if err := h.Checkpoint(h); err != nil {
|
||||||
log.Errorf("unable to Checkpoint: %v", err)
|
log.Errorf("unable to Checkpoint: %v", err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Finally, we'll broadcast the sweep transaction to
|
// Regardless of whether an existing transaction was found or newly
|
||||||
// the network.
|
// constructed, we'll broadcast the sweep transaction to the
|
||||||
//
|
// network.
|
||||||
// TODO(roasbeef): validate first?
|
err := h.PublishTx(h.sweepTx)
|
||||||
if err := h.PublishTx(h.sweepTx); err != nil {
|
if err != nil && err != lnwallet.ErrDoubleSpend {
|
||||||
log.Infof("%T(%x): unable to publish tx: %v",
|
log.Infof("%T(%x): unable to publish tx: %v",
|
||||||
h, h.payHash[:], err)
|
h, h.payHash[:], err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// With the sweep transaction broadcast, we'll wait for its
|
// With the sweep transaction broadcast, we'll wait for its
|
||||||
// confirmation.
|
// confirmation.
|
||||||
|
Loading…
Reference in New Issue
Block a user