mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-04 09:48:19 +01:00
lnwallet: use current height as FundingBrodcastHeight during funding flow
This commit is contained in:
parent
54f849a62e
commit
3c5d856248
1 changed files with 25 additions and 2 deletions
|
@ -1069,6 +1069,18 @@ func (l *LightningWallet) handleFundingCounterPartySigs(msg *addCounterPartySigs
|
||||||
delete(l.fundingLimbo, res.reservationID)
|
delete(l.fundingLimbo, res.reservationID)
|
||||||
l.limboMtx.Unlock()
|
l.limboMtx.Unlock()
|
||||||
|
|
||||||
|
// As we're about to broadcast the funding transaction, we'll take note
|
||||||
|
// of the current height for record keeping purposes.
|
||||||
|
//
|
||||||
|
// TODO(roasbeef): this info can also be piped into light client's
|
||||||
|
// basic fee estimation?
|
||||||
|
_, bestHeight, err := l.ChainIO.GetBestBlock()
|
||||||
|
if err != nil {
|
||||||
|
msg.err <- err
|
||||||
|
msg.completeChan <- nil
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
walletLog.Infof("Broadcasting funding tx for ChannelPoint(%v): %v",
|
walletLog.Infof("Broadcasting funding tx for ChannelPoint(%v): %v",
|
||||||
res.partialState.FundingOutpoint, spew.Sdump(fundingTx))
|
res.partialState.FundingOutpoint, spew.Sdump(fundingTx))
|
||||||
|
|
||||||
|
@ -1083,7 +1095,8 @@ func (l *LightningWallet) handleFundingCounterPartySigs(msg *addCounterPartySigs
|
||||||
// which will be used for the lifetime of this channel.
|
// which will be used for the lifetime of this channel.
|
||||||
// TODO(roasbeef): revisit faul-tolerance of this flow
|
// TODO(roasbeef): revisit faul-tolerance of this flow
|
||||||
nodeAddr := res.nodeAddr
|
nodeAddr := res.nodeAddr
|
||||||
if err := res.partialState.SyncPending(nodeAddr); err != nil {
|
err = res.partialState.SyncPending(nodeAddr, uint32(bestHeight))
|
||||||
|
if err != nil {
|
||||||
msg.err <- err
|
msg.err <- err
|
||||||
msg.completeChan <- nil
|
msg.completeChan <- nil
|
||||||
return
|
return
|
||||||
|
@ -1217,9 +1230,19 @@ func (l *LightningWallet) handleSingleFunderSigs(req *addSingleFunderSigsMsg) {
|
||||||
}
|
}
|
||||||
pendingReservation.ourCommitmentSig = sigTheirCommit
|
pendingReservation.ourCommitmentSig = sigTheirCommit
|
||||||
|
|
||||||
|
_, bestHeight, err := l.ChainIO.GetBestBlock()
|
||||||
|
if err != nil {
|
||||||
|
req.err <- err
|
||||||
|
req.completeChan <- nil
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Add the complete funding transaction to the DB, in it's open bucket
|
// Add the complete funding transaction to the DB, in it's open bucket
|
||||||
// which will be used for the lifetime of this channel.
|
// which will be used for the lifetime of this channel.
|
||||||
err = pendingReservation.partialState.SyncPending(pendingReservation.nodeAddr)
|
err = pendingReservation.partialState.SyncPending(
|
||||||
|
pendingReservation.nodeAddr,
|
||||||
|
uint32(bestHeight),
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
req.err <- err
|
req.err <- err
|
||||||
req.completeChan <- nil
|
req.completeChan <- nil
|
||||||
|
|
Loading…
Add table
Reference in a new issue