rpc+peer: use pkScripts for close ntfns
This commit is contained in:
parent
55d6586a67
commit
07defe5f93
4
mock.go
4
mock.go
@ -85,8 +85,8 @@ type mockNotfier struct {
|
||||
confChannel chan *chainntnfs.TxConfirmation
|
||||
}
|
||||
|
||||
func (m *mockNotfier) RegisterConfirmationsNtfn(txid *chainhash.Hash, numConfs,
|
||||
heightHint uint32) (*chainntnfs.ConfirmationEvent, error) {
|
||||
func (m *mockNotfier) RegisterConfirmationsNtfn(txid *chainhash.Hash,
|
||||
_ []byte, numConfs, heightHint uint32) (*chainntnfs.ConfirmationEvent, error) {
|
||||
return &chainntnfs.ConfirmationEvent{
|
||||
Confirmed: m.confChannel,
|
||||
}, nil
|
||||
|
9
peer.go
9
peer.go
@ -1837,7 +1837,7 @@ func (p *peer) finalizeChanClosure(chanCloser *channelCloser) {
|
||||
}
|
||||
|
||||
go waitForChanToClose(chanCloser.negotiationHeight, notifier, errChan,
|
||||
chanPoint, &closingTxid, func() {
|
||||
chanPoint, &closingTxid, closingTx.TxOut[0].PkScript, func() {
|
||||
// Respond to the local subsystem which requested the
|
||||
// channel closure.
|
||||
if closeReq != nil {
|
||||
@ -1872,15 +1872,16 @@ func (p *peer) finalizeChanClosure(chanCloser *channelCloser) {
|
||||
// the function, then it will be sent over the errChan.
|
||||
func waitForChanToClose(bestHeight uint32, notifier chainntnfs.ChainNotifier,
|
||||
errChan chan error, chanPoint *wire.OutPoint,
|
||||
closingTxID *chainhash.Hash, cb func()) {
|
||||
closingTxID *chainhash.Hash, closeScript []byte, cb func()) {
|
||||
|
||||
peerLog.Infof("Waiting for confirmation of cooperative close of "+
|
||||
"ChannelPoint(%v) with txid: %v", chanPoint,
|
||||
closingTxID)
|
||||
|
||||
// TODO(roasbeef): add param for num needed confs
|
||||
confNtfn, err := notifier.RegisterConfirmationsNtfn(closingTxID, 1,
|
||||
bestHeight)
|
||||
confNtfn, err := notifier.RegisterConfirmationsNtfn(
|
||||
closingTxID, closeScript, 1, bestHeight,
|
||||
)
|
||||
if err != nil {
|
||||
if errChan != nil {
|
||||
errChan <- err
|
||||
|
@ -1083,7 +1083,7 @@ func (r *rpcServer) CloseChannel(in *lnrpc.CloseChannelRequest,
|
||||
errChan = make(chan error, 1)
|
||||
notifier := r.server.cc.chainNotifier
|
||||
go waitForChanToClose(uint32(bestHeight), notifier, errChan, chanPoint,
|
||||
&closingTxid, func() {
|
||||
&closingTxid, closingTx.TxOut[0].PkScript, func() {
|
||||
// Respond to the local subsystem which
|
||||
// requested the channel closure.
|
||||
updateChan <- &lnrpc.CloseStatusUpdate{
|
||||
|
Loading…
Reference in New Issue
Block a user