mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-20 05:42:05 +02:00
itest: break down scid alias channel update tests
This commit is contained in:
parent
04a15039d7
commit
21c5d36812
@ -448,10 +448,6 @@ var allTestCases = []*lntest.TestCase{
|
|||||||
Name: "option scid alias",
|
Name: "option scid alias",
|
||||||
TestFunc: testOptionScidAlias,
|
TestFunc: testOptionScidAlias,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
Name: "scid alias channel update",
|
|
||||||
TestFunc: testUpdateChannelPolicyScidAlias,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
Name: "scid alias upgrade",
|
Name: "scid alias upgrade",
|
||||||
TestFunc: testOptionScidUpgrade,
|
TestFunc: testOptionScidUpgrade,
|
||||||
@ -686,4 +682,5 @@ func init() {
|
|||||||
allTestCases = append(allTestCases, remoteSignerTestCases...)
|
allTestCases = append(allTestCases, remoteSignerTestCases...)
|
||||||
allTestCases = append(allTestCases, channelRestoreTestCases...)
|
allTestCases = append(allTestCases, channelRestoreTestCases...)
|
||||||
allTestCases = append(allTestCases, fundUtxoSelectionTestCases...)
|
allTestCases = append(allTestCases, fundUtxoSelectionTestCases...)
|
||||||
|
allTestCases = append(allTestCases, zeroConfPolicyTestCases...)
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,67 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// zeroConfPolicyTestCases checks that option-scid-alias, zero-conf
|
||||||
|
// channel-types, and option-scid-alias feature-bit-only channels have the
|
||||||
|
// expected graph and that payments work when updating the channel policy.
|
||||||
|
var zeroConfPolicyTestCases = []*lntest.TestCase{
|
||||||
|
{
|
||||||
|
Name: "channel policy update private",
|
||||||
|
TestFunc: func(ht *lntest.HarnessTest) {
|
||||||
|
// zeroConf: false
|
||||||
|
// scidAlias: false
|
||||||
|
// private: true
|
||||||
|
testPrivateUpdateAlias(
|
||||||
|
ht, false, false, true,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "channel policy update private scid alias",
|
||||||
|
TestFunc: func(ht *lntest.HarnessTest) {
|
||||||
|
// zeroConf: false
|
||||||
|
// scidAlias: true
|
||||||
|
// private: true
|
||||||
|
testPrivateUpdateAlias(
|
||||||
|
ht, false, true, true,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "channel policy update private zero conf",
|
||||||
|
TestFunc: func(ht *lntest.HarnessTest) {
|
||||||
|
// zeroConf: true
|
||||||
|
// scidAlias: false
|
||||||
|
// private: true
|
||||||
|
testPrivateUpdateAlias(
|
||||||
|
ht, true, false, true,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "channel policy update public zero conf",
|
||||||
|
TestFunc: func(ht *lntest.HarnessTest) {
|
||||||
|
// zeroConf: true
|
||||||
|
// scidAlias: false
|
||||||
|
// private: false
|
||||||
|
testPrivateUpdateAlias(
|
||||||
|
ht, true, false, false,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "channel policy update public",
|
||||||
|
TestFunc: func(ht *lntest.HarnessTest) {
|
||||||
|
// zeroConf: false
|
||||||
|
// scidAlias: false
|
||||||
|
// private: false
|
||||||
|
testPrivateUpdateAlias(
|
||||||
|
ht, false, false, false,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
// testZeroConfChannelOpen tests that opening a zero-conf channel works and
|
// testZeroConfChannelOpen tests that opening a zero-conf channel works and
|
||||||
// sending payments also works.
|
// sending payments also works.
|
||||||
func testZeroConfChannelOpen(ht *lntest.HarnessTest) {
|
func testZeroConfChannelOpen(ht *lntest.HarnessTest) {
|
||||||
@ -395,61 +456,6 @@ func waitForZeroConfGraphChange(hn *node.HarnessNode,
|
|||||||
}, defaultTimeout)
|
}, defaultTimeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
// testUpdateChannelPolicyScidAlias checks that option-scid-alias, zero-conf
|
|
||||||
// channel-types, and option-scid-alias feature-bit-only channels have the
|
|
||||||
// expected graph and that payments work when updating the channel policy.
|
|
||||||
func testUpdateChannelPolicyScidAlias(ht *lntest.HarnessTest) {
|
|
||||||
tests := []struct {
|
|
||||||
name string
|
|
||||||
|
|
||||||
// The option-scid-alias channel type.
|
|
||||||
scidAliasType bool
|
|
||||||
|
|
||||||
// The zero-conf channel type.
|
|
||||||
zeroConf bool
|
|
||||||
|
|
||||||
private bool
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
name: "private scid-alias chantype update",
|
|
||||||
scidAliasType: true,
|
|
||||||
private: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "private zero-conf update",
|
|
||||||
zeroConf: true,
|
|
||||||
private: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "public zero-conf update",
|
|
||||||
zeroConf: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "public no-chan-type update",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "private no-chan-type update",
|
|
||||||
private: true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, test := range tests {
|
|
||||||
test := test
|
|
||||||
|
|
||||||
success := ht.Run(test.name, func(t *testing.T) {
|
|
||||||
st := ht.Subtest(t)
|
|
||||||
|
|
||||||
testPrivateUpdateAlias(
|
|
||||||
st, test.zeroConf, test.scidAliasType,
|
|
||||||
test.private,
|
|
||||||
)
|
|
||||||
})
|
|
||||||
if !success {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func testPrivateUpdateAlias(ht *lntest.HarnessTest,
|
func testPrivateUpdateAlias(ht *lntest.HarnessTest,
|
||||||
zeroConf, scidAliasType, private bool) {
|
zeroConf, scidAliasType, private bool) {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user