Merge pull request #711 from Roasbeef/funding-fail-first
funding: during funding error fail before sending Error to peer
This commit is contained in:
commit
cfacc18f72
@ -684,13 +684,16 @@ func (f *fundingManager) failFundingFlow(peer *btcec.PublicKey,
|
|||||||
|
|
||||||
fndgLog.Errorf("Failing funding flow: %v", spew.Sdump(errMsg))
|
fndgLog.Errorf("Failing funding flow: %v", spew.Sdump(errMsg))
|
||||||
|
|
||||||
|
if _, err := f.cancelReservationCtx(peer, tempChanID); err != nil {
|
||||||
|
fndgLog.Errorf("unable to cancel reservation: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
err := f.cfg.SendToPeer(peer, errMsg)
|
err := f.cfg.SendToPeer(peer, errMsg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fndgLog.Errorf("unable to send error message to peer %v", err)
|
fndgLog.Errorf("unable to send error message to peer %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
f.cancelReservationCtx(peer, tempChanID)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -807,6 +807,9 @@ func (l *LightningWallet) handleContributionMsg(req *addContributionMsg) {
|
|||||||
fundingOutpoint := wire.NewOutPoint(&fundingTxID, multiSigIndex)
|
fundingOutpoint := wire.NewOutPoint(&fundingTxID, multiSigIndex)
|
||||||
pendingReservation.partialState.FundingOutpoint = *fundingOutpoint
|
pendingReservation.partialState.FundingOutpoint = *fundingOutpoint
|
||||||
|
|
||||||
|
walletLog.Debugf("Funding tx for ChannelPoint(%v) generated: %v",
|
||||||
|
fundingOutpoint, spew.Sdump(fundingTx))
|
||||||
|
|
||||||
// Initialize an empty sha-chain for them, tracking the current pending
|
// Initialize an empty sha-chain for them, tracking the current pending
|
||||||
// revocation hash (we don't yet know the preimage so we can't add it
|
// revocation hash (we don't yet know the preimage so we can't add it
|
||||||
// to the chain).
|
// to the chain).
|
||||||
@ -879,6 +882,11 @@ func (l *LightningWallet) handleContributionMsg(req *addContributionMsg) {
|
|||||||
txsort.InPlaceSort(ourCommitTx)
|
txsort.InPlaceSort(ourCommitTx)
|
||||||
txsort.InPlaceSort(theirCommitTx)
|
txsort.InPlaceSort(theirCommitTx)
|
||||||
|
|
||||||
|
walletLog.Debugf("Local commit tx for ChannelPoint(%v): %v",
|
||||||
|
fundingOutpoint, spew.Sdump(ourCommitTx))
|
||||||
|
walletLog.Debugf("Remote commit tx for ChannelPoint(%v): %v",
|
||||||
|
fundingOutpoint, spew.Sdump(theirCommitTx))
|
||||||
|
|
||||||
// Record newly available information within the open channel state.
|
// Record newly available information within the open channel state.
|
||||||
chanState.FundingOutpoint = *fundingOutpoint
|
chanState.FundingOutpoint = *fundingOutpoint
|
||||||
chanState.LocalCommitment.CommitTx = ourCommitTx
|
chanState.LocalCommitment.CommitTx = ourCommitTx
|
||||||
@ -1181,6 +1189,11 @@ func (l *LightningWallet) handleSingleFunderSigs(req *addSingleFunderSigsMsg) {
|
|||||||
chanState.LocalCommitment.CommitTx = ourCommitTx
|
chanState.LocalCommitment.CommitTx = ourCommitTx
|
||||||
chanState.RemoteCommitment.CommitTx = theirCommitTx
|
chanState.RemoteCommitment.CommitTx = theirCommitTx
|
||||||
|
|
||||||
|
walletLog.Debugf("Local commit tx for ChannelPoint(%v): %v",
|
||||||
|
req.fundingOutpoint, spew.Sdump(ourCommitTx))
|
||||||
|
walletLog.Debugf("Remote commit tx for ChannelPoint(%v): %v",
|
||||||
|
req.fundingOutpoint, spew.Sdump(theirCommitTx))
|
||||||
|
|
||||||
channelValue := int64(pendingReservation.partialState.Capacity)
|
channelValue := int64(pendingReservation.partialState.Capacity)
|
||||||
hashCache := txscript.NewTxSigHashes(ourCommitTx)
|
hashCache := txscript.NewTxSigHashes(ourCommitTx)
|
||||||
theirKey := pendingReservation.theirContribution.MultiSigKey
|
theirKey := pendingReservation.theirContribution.MultiSigKey
|
||||||
|
Loading…
Reference in New Issue
Block a user