funding: only broadcast the funding transaction if we actually have it
This commit is contained in:
parent
6753a02439
commit
f9d22cd900
@ -521,8 +521,9 @@ func (f *fundingManager) start() error {
|
|||||||
|
|
||||||
// Rebroadcast the funding transaction for any pending
|
// Rebroadcast the funding transaction for any pending
|
||||||
// channel that we initiated. No error will be returned
|
// channel that we initiated. No error will be returned
|
||||||
// if the transaction already has been broadcasted.
|
// if the transaction already has been broadcast.
|
||||||
if channel.ChanType.IsSingleFunder() &&
|
chanType := channel.ChanType
|
||||||
|
if chanType.IsSingleFunder() && chanType.HasFundingTx() &&
|
||||||
channel.IsInitiator {
|
channel.IsInitiator {
|
||||||
|
|
||||||
err := f.cfg.PublishTransaction(
|
err := f.cfg.PublishTransaction(
|
||||||
@ -1739,21 +1740,28 @@ func (f *fundingManager) handleFundingSigned(fmsg *fundingSignedMsg) {
|
|||||||
// delete it from our set of active reservations.
|
// delete it from our set of active reservations.
|
||||||
f.deleteReservationCtx(peerKey, pendingChanID)
|
f.deleteReservationCtx(peerKey, pendingChanID)
|
||||||
|
|
||||||
// Broadcast the finalized funding transaction to the network.
|
// Broadcast the finalized funding transaction to the network, but only
|
||||||
fundingTx := completeChan.FundingTxn
|
// if we actually have the funding transaction.
|
||||||
fndgLog.Infof("Broadcasting funding tx for ChannelPoint(%v): %v",
|
if completeChan.ChanType.HasFundingTx() {
|
||||||
completeChan.FundingOutpoint, spew.Sdump(fundingTx))
|
fundingTx := completeChan.FundingTxn
|
||||||
|
|
||||||
err = f.cfg.PublishTransaction(fundingTx)
|
fndgLog.Infof("Broadcasting funding tx for ChannelPoint(%v): %v",
|
||||||
if err != nil {
|
completeChan.FundingOutpoint, spew.Sdump(fundingTx))
|
||||||
fndgLog.Errorf("Unable to broadcast funding tx for "+
|
|
||||||
"ChannelPoint(%v): %v", completeChan.FundingOutpoint,
|
err = f.cfg.PublishTransaction(fundingTx)
|
||||||
err)
|
if err != nil {
|
||||||
// We failed to broadcast the funding transaction, but watch
|
fndgLog.Errorf("Unable to broadcast funding tx for "+
|
||||||
// the channel regardless, in case the transaction made it to
|
"ChannelPoint(%v): %v",
|
||||||
// the network. We will retry broadcast at startup.
|
completeChan.FundingOutpoint, err)
|
||||||
// TODO(halseth): retry more often? Handle with CPFP? Just
|
|
||||||
// delete from the DB?
|
// We failed to broadcast the funding transaction, but
|
||||||
|
// watch the channel regardless, in case the
|
||||||
|
// transaction made it to the network. We will retry
|
||||||
|
// broadcast at startup.
|
||||||
|
//
|
||||||
|
// TODO(halseth): retry more often? Handle with CPFP?
|
||||||
|
// Just delete from the DB?
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now that we have a finalized reservation for this funding flow,
|
// Now that we have a finalized reservation for this funding flow,
|
||||||
|
Loading…
Reference in New Issue
Block a user