Merge pull request #1380 from cfromknecht/nursery-rebroadcast

utxonursery: rebroadcast finalized kinder txns on startup
This commit is contained in:
Olaoluwa Osuntokun 2018-06-15 16:49:58 -07:00 committed by GitHub
commit 7c2307984d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -736,7 +736,7 @@ func (u *utxoNursery) regraduateClass(classHeight uint32) error {
utxnLog.Infof("Re-registering confirmation for kindergarten "+ utxnLog.Infof("Re-registering confirmation for kindergarten "+
"sweep transaction at height=%d ", classHeight) "sweep transaction at height=%d ", classHeight)
err = u.registerSweepConf(finalTx, kgtnOutputs, classHeight) err = u.sweepMatureOutputs(classHeight, finalTx, kgtnOutputs)
if err != nil { if err != nil {
utxnLog.Errorf("Failed to re-register for kindergarten "+ utxnLog.Errorf("Failed to re-register for kindergarten "+
"sweep transaction at height=%d: %v", "sweep transaction at height=%d: %v",
@ -1124,7 +1124,8 @@ 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.
if err := u.cfg.PublishTransaction(finalTx); err != nil { err := u.cfg.PublishTransaction(finalTx)
if err != nil && err != lnwallet.ErrDoubleSpend {
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
@ -1230,7 +1231,8 @@ 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 { err := u.cfg.PublishTransaction(baby.timeoutTx)
if err != nil && err != lnwallet.ErrDoubleSpend {
utxnLog.Errorf("Unable to broadcast baby tx: "+ utxnLog.Errorf("Unable to broadcast baby tx: "+
"%v, %v", err, spew.Sdump(baby.timeoutTx)) "%v, %v", err, spew.Sdump(baby.timeoutTx))
return err return err