mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-11 02:42:52 +02:00
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:
@@ -90,10 +90,16 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
// noUpdate is a function which can be used as a parameter in createTestPeer to
|
||||
// call the setup code with no custom values on the channels set up.
|
||||
var noUpdate = func(a, b *channeldb.OpenChannel) {}
|
||||
|
||||
// createTestPeer creates a channel between two nodes, and returns a peer for
|
||||
// one of the nodes, together with the channel seen from both nodes.
|
||||
func createTestPeer(notifier chainntnfs.ChainNotifier,
|
||||
publTx chan *wire.MsgTx) (*peer, *lnwallet.LightningChannel,
|
||||
// one of the nodes, together with the channel seen from both nodes. It takes
|
||||
// an updateChan function which can be used to modify the default values on
|
||||
// the channel states for each peer.
|
||||
func createTestPeer(notifier chainntnfs.ChainNotifier, publTx chan *wire.MsgTx,
|
||||
updateChan func(a, b *channeldb.OpenChannel)) (*peer, *lnwallet.LightningChannel,
|
||||
*lnwallet.LightningChannel, func(), error) {
|
||||
|
||||
aliceKeyPriv, aliceKeyPub := btcec.PrivKeyFromBytes(btcec.S256(),
|
||||
@@ -285,6 +291,9 @@ func createTestPeer(notifier chainntnfs.ChainNotifier,
|
||||
Packager: channeldb.NewChannelPackager(shortChanID),
|
||||
}
|
||||
|
||||
// Set custom values on the channel states.
|
||||
updateChan(aliceChannelState, bobChannelState)
|
||||
|
||||
aliceAddr := &net.TCPAddr{
|
||||
IP: net.ParseIP("127.0.0.1"),
|
||||
Port: 18555,
|
||||
|
Reference in New Issue
Block a user