utxonursery: don't ignore any returned error from PublishTransaction

This commit is contained in:
Johan T. Halseth 2018-01-12 15:31:02 +01:00
parent db0928fa6f
commit 7aaa15b8b5
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

@ -5,7 +5,6 @@ import (
"encoding/binary" "encoding/binary"
"fmt" "fmt"
"io" "io"
"strings"
"sync" "sync"
"sync/atomic" "sync/atomic"
@ -1125,9 +1124,7 @@ func (u *utxoNursery) sweepMatureOutputs(classHeight uint32, finalTx *wire.MsgTx
// With the sweep transaction fully signed, broadcast the transaction // With the sweep transaction fully signed, broadcast the transaction
// to the network. Additionally, we can stop tracking these outputs as // to the network. Additionally, we can stop tracking these outputs as
// they've just been swept. // they've just been swept.
// TODO(conner): handle concrete error types returned from publication if err := u.cfg.PublishTransaction(finalTx); err != nil {
err := u.cfg.PublishTransaction(finalTx)
if err != nil && !strings.Contains(err.Error(), "TX rejected:") {
utxnLog.Errorf("unable to broadcast sweep tx: %v, %v", utxnLog.Errorf("unable to broadcast sweep tx: %v, %v",
err, spew.Sdump(finalTx)) err, spew.Sdump(finalTx))
return err return err
@ -1233,14 +1230,9 @@ func (u *utxoNursery) sweepCribOutput(classHeight uint32, baby *babyOutput) erro
// We'll now broadcast the HTLC transaction, then wait for it to be // We'll now broadcast the HTLC transaction, then wait for it to be
// confirmed before transitioning it to kindergarten. // confirmed before transitioning it to kindergarten.
// if err := u.cfg.PublishTransaction(baby.timeoutTx); err != nil {
// TODO(conner): handle concrete error types returned from publication
err := u.cfg.PublishTransaction(baby.timeoutTx)
if err != nil &&
!strings.Contains(err.Error(), "TX rejected:") {
utxnLog.Errorf("Unable to broadcast baby tx: "+ utxnLog.Errorf("Unable to broadcast baby tx: "+
"%v, %v", err, "%v, %v", err, spew.Sdump(baby.timeoutTx))
spew.Sdump(baby.timeoutTx))
return err return err
} }