multi: update funding workflow to be aware of new tweakless commits

In this commit, we update the funding workflow to be aware of the new
channel type that doesn't tweak the remote party's output within the
non-delay script on their commitment transaction. To do this, we now
allow the caller of `InnitChannelReservation` to signal if they want the
old or new (tweakless) commitment style.

The funding tests are also updated to test both funding variants, as
we'll still need to understand the legacy format for older nodes.
This commit is contained in:
Olaoluwa Osuntokun
2019-07-31 20:16:52 -07:00
parent b399203e71
commit 0b62126067
9 changed files with 75 additions and 28 deletions

View File

@@ -34,7 +34,7 @@ func TestChainArbitratorRepublishCommitment(t *testing.T) {
const numChans = 10
var channels []*channeldb.OpenChannel
for i := 0; i < numChans; i++ {
lChannel, _, cleanup, err := lnwallet.CreateTestChannels()
lChannel, _, cleanup, err := lnwallet.CreateTestChannels(true)
if err != nil {
t.Fatal(err)
}

View File

@@ -62,7 +62,7 @@ func TestChainWatcherRemoteUnilateralClose(t *testing.T) {
// First, we'll create two channels which already have established a
// commitment contract between themselves.
aliceChannel, bobChannel, cleanUp, err := lnwallet.CreateTestChannels()
aliceChannel, bobChannel, cleanUp, err := lnwallet.CreateTestChannels(true)
if err != nil {
t.Fatalf("unable to create test channels: %v", err)
}
@@ -149,7 +149,7 @@ func TestChainWatcherRemoteUnilateralClosePendingCommit(t *testing.T) {
// First, we'll create two channels which already have established a
// commitment contract between themselves.
aliceChannel, bobChannel, cleanUp, err := lnwallet.CreateTestChannels()
aliceChannel, bobChannel, cleanUp, err := lnwallet.CreateTestChannels(true)
if err != nil {
t.Fatalf("unable to create test channels: %v", err)
}
@@ -272,7 +272,9 @@ func TestChainWatcherDataLossProtect(t *testing.T) {
dlpScenario := func(t *testing.T, testCase dlpTestCase) bool {
// First, we'll create two channels which already have
// established a commitment contract between themselves.
aliceChannel, bobChannel, cleanUp, err := lnwallet.CreateTestChannels()
aliceChannel, bobChannel, cleanUp, err := lnwallet.CreateTestChannels(
false,
)
if err != nil {
t.Fatalf("unable to create test channels: %v", err)
}
@@ -430,7 +432,7 @@ func TestChainWatcherDataLossProtect(t *testing.T) {
func TestChainWatcherLocalForceCloseDetect(t *testing.T) {
t.Parallel()
// localForceCloseScenario is the primary test we'll use to execut eout
// localForceCloseScenario is the primary test we'll use to execute our
// table driven tests. We'll assert that for any number of state
// updates, and if the commitment transaction has our output or not,
// we're able to properly detect a local force close.
@@ -439,7 +441,9 @@ func TestChainWatcherLocalForceCloseDetect(t *testing.T) {
// First, we'll create two channels which already have
// established a commitment contract between themselves.
aliceChannel, bobChannel, cleanUp, err := lnwallet.CreateTestChannels()
aliceChannel, bobChannel, cleanUp, err := lnwallet.CreateTestChannels(
false,
)
if err != nil {
t.Fatalf("unable to create test channels: %v", err)
}