peer+rpc: set new rbf coop close rbf update fields

This commit is contained in:
Olaoluwa Osuntokun
2024-03-07 20:14:52 -08:00
parent b32f576aeb
commit 81d34c4ac2
2 changed files with 53 additions and 8 deletions

View File

@@ -2912,6 +2912,7 @@ func (r *rpcServer) CloseChannel(in *lnrpc.CloseChannelRequest,
return err
}
}
out:
for {
select {
@@ -2957,6 +2958,7 @@ out:
h, _ := chainhash.NewHash(closeUpdate.ClosingTxid)
rpcsLog.Infof("[closechannel] close completed: "+
"txid(%v)", h)
break out
}
@@ -3047,12 +3049,23 @@ func createRPCCloseUpdate(
}, nil
case *peer.PendingUpdate:
upd := &lnrpc.PendingUpdate{
Txid: u.Txid,
OutputIndex: u.OutputIndex,
}
// Potentially set the optional fields that are only set for
// the new RBF close flow.
u.IsLocalCloseTx.WhenSome(func(isLocal bool) {
upd.LocalCloseTx = isLocal
})
u.FeePerVbyte.WhenSome(func(feeRate chainfee.SatPerVByte) {
upd.FeePerVbyte = int64(feeRate)
})
return &lnrpc.CloseStatusUpdate{
Update: &lnrpc.CloseStatusUpdate_ClosePending{
ClosePending: &lnrpc.PendingUpdate{
Txid: u.Txid,
OutputIndex: u.OutputIndex,
},
ClosePending: upd,
},
}, nil
}