multi: Use user provided close address for cooperative closes

This commit is adapted from @Bluetegu's original
pull request #1462.

This commit reads an optional address to pay funds out to
from a user iniitiated close channel address. If the channel
already has a shutdown script set, the request will fail if
an address is provided. Otherwise, the cooperative close will
pay out to the address provided.
This commit is contained in:
carla committed 2019-12-10 09:13:01 +02:00
1 parent ef4d9334b7
commit 94d3eb60a4
7 files changed
+367 -41

No files matched your search

+5 -1
View File
@@ -824,7 +824,11 @@ func newServer(listenAddrs []net.Addr, chanDB *channeldb.DB,
closureType htlcswitch.ChannelCloseType) {
// TODO(conner): Properly respect the update and error channels
// returned by CloseLink.
s.htlcSwitch.CloseLink(chanPoint, closureType, 0)
// Instruct the switch to close the channel. Provide no close out
// delivery script or target fee per kw because user input is not
// available when the remote peer closes the channel.
s.htlcSwitch.CloseLink(chanPoint, closureType, 0, nil)
}
// We will use the following channel to reliably hand off contract