multi: make static remote key compulsory

This commit is contained in:
Keagan McClelland
2023-12-13 17:58:08 -08:00
parent d47338cd45
commit 109265c77a
7 changed files with 15 additions and 23 deletions

View File

@@ -23,7 +23,7 @@ var testSetDesc = setDesc{
SetInit: {}, // I SetInit: {}, // I
SetNodeAnn: {}, // N SetNodeAnn: {}, // N
}, },
lnwire.StaticRemoteKeyOptional: { lnwire.StaticRemoteKeyRequired: {
SetInit: {}, // I SetInit: {}, // I
SetNodeAnn: {}, // N SetNodeAnn: {}, // N
}, },
@@ -108,6 +108,7 @@ func testManager(t *testing.T, test managerTest) {
assertUnset(lnwire.TLVOnionPayloadOptional) assertUnset(lnwire.TLVOnionPayloadOptional)
} }
if test.cfg.NoStaticRemoteKey { if test.cfg.NoStaticRemoteKey {
assertUnset(lnwire.StaticRemoteKeyRequired)
assertUnset(lnwire.StaticRemoteKeyOptional) assertUnset(lnwire.StaticRemoteKeyOptional)
} }
if test.cfg.NoAnchors { if test.cfg.NoAnchors {
@@ -133,7 +134,7 @@ func testManager(t *testing.T, test managerTest) {
assertSet(lnwire.TLVOnionPayloadRequired) assertSet(lnwire.TLVOnionPayloadRequired)
} }
if !test.cfg.NoStaticRemoteKey { if !test.cfg.NoStaticRemoteKey {
assertSet(lnwire.StaticRemoteKeyOptional) assertSet(lnwire.StaticRemoteKeyRequired)
} }
} }

View File

@@ -31,7 +31,7 @@ func TestCommitmentTypeNegotiation(t *testing.T) {
lnwire.AnchorsZeroFeeHtlcTxRequired, lnwire.AnchorsZeroFeeHtlcTxRequired,
), ),
localFeatures: lnwire.NewRawFeatureVector( localFeatures: lnwire.NewRawFeatureVector(
lnwire.StaticRemoteKeyOptional, lnwire.StaticRemoteKeyRequired,
lnwire.AnchorsZeroFeeHtlcTxOptional, lnwire.AnchorsZeroFeeHtlcTxOptional,
lnwire.ExplicitChannelTypeOptional, lnwire.ExplicitChannelTypeOptional,
), ),
@@ -39,6 +39,7 @@ func TestCommitmentTypeNegotiation(t *testing.T) {
lnwire.StaticRemoteKeyOptional, lnwire.StaticRemoteKeyOptional,
lnwire.AnchorsZeroFeeHtlcTxOptional, lnwire.AnchorsZeroFeeHtlcTxOptional,
), ),
//nolint:lll
expectsCommitType: lnwallet.CommitmentTypeAnchorsZeroFeeHtlcTx, expectsCommitType: lnwallet.CommitmentTypeAnchorsZeroFeeHtlcTx,
expectsChanType: nil, expectsChanType: nil,
expectsErr: nil, expectsErr: nil,
@@ -50,7 +51,7 @@ func TestCommitmentTypeNegotiation(t *testing.T) {
lnwire.AnchorsZeroFeeHtlcTxRequired, lnwire.AnchorsZeroFeeHtlcTxRequired,
), ),
localFeatures: lnwire.NewRawFeatureVector( localFeatures: lnwire.NewRawFeatureVector(
lnwire.StaticRemoteKeyOptional, lnwire.StaticRemoteKeyRequired,
lnwire.AnchorsZeroFeeHtlcTxOptional, lnwire.AnchorsZeroFeeHtlcTxOptional,
lnwire.ExplicitChannelTypeOptional, lnwire.ExplicitChannelTypeOptional,
), ),
@@ -70,7 +71,7 @@ func TestCommitmentTypeNegotiation(t *testing.T) {
), ),
localFeatures: lnwire.NewRawFeatureVector( localFeatures: lnwire.NewRawFeatureVector(
lnwire.ZeroConfOptional, lnwire.ZeroConfOptional,
lnwire.StaticRemoteKeyOptional, lnwire.StaticRemoteKeyRequired,
lnwire.AnchorsZeroFeeHtlcTxOptional, lnwire.AnchorsZeroFeeHtlcTxOptional,
lnwire.ScriptEnforcedLeaseOptional, lnwire.ScriptEnforcedLeaseOptional,
lnwire.ExplicitChannelTypeOptional, lnwire.ExplicitChannelTypeOptional,
@@ -103,7 +104,7 @@ func TestCommitmentTypeNegotiation(t *testing.T) {
), ),
localFeatures: lnwire.NewRawFeatureVector( localFeatures: lnwire.NewRawFeatureVector(
lnwire.ZeroConfOptional, lnwire.ZeroConfOptional,
lnwire.StaticRemoteKeyOptional, lnwire.StaticRemoteKeyRequired,
lnwire.AnchorsZeroFeeHtlcTxOptional, lnwire.AnchorsZeroFeeHtlcTxOptional,
lnwire.ExplicitChannelTypeOptional, lnwire.ExplicitChannelTypeOptional,
), ),
@@ -134,7 +135,7 @@ func TestCommitmentTypeNegotiation(t *testing.T) {
), ),
localFeatures: lnwire.NewRawFeatureVector( localFeatures: lnwire.NewRawFeatureVector(
lnwire.ScidAliasOptional, lnwire.ScidAliasOptional,
lnwire.StaticRemoteKeyOptional, lnwire.StaticRemoteKeyRequired,
lnwire.AnchorsZeroFeeHtlcTxOptional, lnwire.AnchorsZeroFeeHtlcTxOptional,
lnwire.ScriptEnforcedLeaseOptional, lnwire.ScriptEnforcedLeaseOptional,
lnwire.ExplicitChannelTypeOptional, lnwire.ExplicitChannelTypeOptional,
@@ -167,7 +168,7 @@ func TestCommitmentTypeNegotiation(t *testing.T) {
), ),
localFeatures: lnwire.NewRawFeatureVector( localFeatures: lnwire.NewRawFeatureVector(
lnwire.ScidAliasOptional, lnwire.ScidAliasOptional,
lnwire.StaticRemoteKeyOptional, lnwire.StaticRemoteKeyRequired,
lnwire.AnchorsZeroFeeHtlcTxOptional, lnwire.AnchorsZeroFeeHtlcTxOptional,
lnwire.ExplicitChannelTypeOptional, lnwire.ExplicitChannelTypeOptional,
), ),
@@ -195,7 +196,7 @@ func TestCommitmentTypeNegotiation(t *testing.T) {
lnwire.AnchorsZeroFeeHtlcTxRequired, lnwire.AnchorsZeroFeeHtlcTxRequired,
), ),
localFeatures: lnwire.NewRawFeatureVector( localFeatures: lnwire.NewRawFeatureVector(
lnwire.StaticRemoteKeyOptional, lnwire.StaticRemoteKeyRequired,
lnwire.AnchorsZeroFeeHtlcTxOptional, lnwire.AnchorsZeroFeeHtlcTxOptional,
lnwire.ExplicitChannelTypeOptional, lnwire.ExplicitChannelTypeOptional,
), ),
@@ -219,7 +220,7 @@ func TestCommitmentTypeNegotiation(t *testing.T) {
lnwire.StaticRemoteKeyRequired, lnwire.StaticRemoteKeyRequired,
), ),
localFeatures: lnwire.NewRawFeatureVector( localFeatures: lnwire.NewRawFeatureVector(
lnwire.StaticRemoteKeyOptional, lnwire.StaticRemoteKeyRequired,
lnwire.AnchorsZeroFeeHtlcTxOptional, lnwire.AnchorsZeroFeeHtlcTxOptional,
lnwire.ExplicitChannelTypeOptional, lnwire.ExplicitChannelTypeOptional,
), ),
@@ -240,7 +241,7 @@ func TestCommitmentTypeNegotiation(t *testing.T) {
name: "explicit legacy", name: "explicit legacy",
channelFeatures: lnwire.NewRawFeatureVector(), channelFeatures: lnwire.NewRawFeatureVector(),
localFeatures: lnwire.NewRawFeatureVector( localFeatures: lnwire.NewRawFeatureVector(
lnwire.StaticRemoteKeyOptional, lnwire.StaticRemoteKeyRequired,
lnwire.AnchorsZeroFeeHtlcTxOptional, lnwire.AnchorsZeroFeeHtlcTxOptional,
lnwire.ExplicitChannelTypeOptional, lnwire.ExplicitChannelTypeOptional,
), ),
@@ -262,7 +263,7 @@ func TestCommitmentTypeNegotiation(t *testing.T) {
name: "default explicit anchors", name: "default explicit anchors",
channelFeatures: nil, channelFeatures: nil,
localFeatures: lnwire.NewRawFeatureVector( localFeatures: lnwire.NewRawFeatureVector(
lnwire.StaticRemoteKeyOptional, lnwire.StaticRemoteKeyRequired,
lnwire.AnchorsZeroFeeHtlcTxOptional, lnwire.AnchorsZeroFeeHtlcTxOptional,
lnwire.ExplicitChannelTypeOptional, lnwire.ExplicitChannelTypeOptional,
), ),
@@ -284,7 +285,7 @@ func TestCommitmentTypeNegotiation(t *testing.T) {
name: "implicit tweakless", name: "implicit tweakless",
channelFeatures: nil, channelFeatures: nil,
localFeatures: lnwire.NewRawFeatureVector( localFeatures: lnwire.NewRawFeatureVector(
lnwire.StaticRemoteKeyOptional, lnwire.StaticRemoteKeyRequired,
lnwire.AnchorsZeroFeeHtlcTxOptional, lnwire.AnchorsZeroFeeHtlcTxOptional,
), ),
remoteFeatures: lnwire.NewRawFeatureVector( remoteFeatures: lnwire.NewRawFeatureVector(

View File

@@ -245,7 +245,6 @@ func testChannelForceClosure(ht *lntest.HarnessTest) {
// We'll test the scenario for some of the commitment types, to ensure // We'll test the scenario for some of the commitment types, to ensure
// outputs can be swept. // outputs can be swept.
commitTypes := []lnrpc.CommitmentType{ commitTypes := []lnrpc.CommitmentType{
lnrpc.CommitmentType_LEGACY,
lnrpc.CommitmentType_ANCHORS, lnrpc.CommitmentType_ANCHORS,
lnrpc.CommitmentType_SIMPLE_TAPROOT, lnrpc.CommitmentType_SIMPLE_TAPROOT,
} }

View File

@@ -32,7 +32,6 @@ func testBasicChannelFunding(ht *lntest.HarnessTest) {
// Run through the test with combinations of all the different // Run through the test with combinations of all the different
// commitment types. // commitment types.
allTypes := []lnrpc.CommitmentType{ allTypes := []lnrpc.CommitmentType{
lnrpc.CommitmentType_LEGACY,
lnrpc.CommitmentType_STATIC_REMOTE_KEY, lnrpc.CommitmentType_STATIC_REMOTE_KEY,
lnrpc.CommitmentType_ANCHORS, lnrpc.CommitmentType_ANCHORS,
lnrpc.CommitmentType_SIMPLE_TAPROOT, lnrpc.CommitmentType_SIMPLE_TAPROOT,

View File

@@ -30,10 +30,6 @@ var commitWithZeroConf = []struct {
commitType lnrpc.CommitmentType commitType lnrpc.CommitmentType
zeroConf bool zeroConf bool
}{ }{
{
commitType: lnrpc.CommitmentType_LEGACY,
zeroConf: false,
},
{ {
commitType: lnrpc.CommitmentType_ANCHORS, commitType: lnrpc.CommitmentType_ANCHORS,
zeroConf: false, zeroConf: false,

View File

@@ -26,7 +26,6 @@ func testSendDirectPayment(ht *lntest.HarnessTest) {
// Create a list of commitment types we want to test. // Create a list of commitment types we want to test.
commitTyes := []lnrpc.CommitmentType{ commitTyes := []lnrpc.CommitmentType{
lnrpc.CommitmentType_LEGACY,
lnrpc.CommitmentType_ANCHORS, lnrpc.CommitmentType_ANCHORS,
lnrpc.CommitmentType_SIMPLE_TAPROOT, lnrpc.CommitmentType_SIMPLE_TAPROOT,
} }

View File

@@ -195,7 +195,6 @@ func breachRetributionTestCase(ht *lntest.HarnessTest,
// the mempool. // the mempool.
func testRevokedCloseRetribution(ht *lntest.HarnessTest) { func testRevokedCloseRetribution(ht *lntest.HarnessTest) {
for _, commitType := range []lnrpc.CommitmentType{ for _, commitType := range []lnrpc.CommitmentType{
lnrpc.CommitmentType_LEGACY,
lnrpc.CommitmentType_SIMPLE_TAPROOT, lnrpc.CommitmentType_SIMPLE_TAPROOT,
} { } {
testName := fmt.Sprintf("%v", commitType.String()) testName := fmt.Sprintf("%v", commitType.String())
@@ -378,7 +377,6 @@ func revokedCloseRetributionZeroValueRemoteOutputCase(ht *lntest.HarnessTest,
// commitment output has zero-value. // commitment output has zero-value.
func testRevokedCloseRetributionZeroValueRemoteOutput(ht *lntest.HarnessTest) { func testRevokedCloseRetributionZeroValueRemoteOutput(ht *lntest.HarnessTest) {
for _, commitType := range []lnrpc.CommitmentType{ for _, commitType := range []lnrpc.CommitmentType{
lnrpc.CommitmentType_LEGACY,
lnrpc.CommitmentType_SIMPLE_TAPROOT, lnrpc.CommitmentType_SIMPLE_TAPROOT,
} { } {
testName := fmt.Sprintf("%v", commitType.String()) testName := fmt.Sprintf("%v", commitType.String())
@@ -700,7 +698,6 @@ func revokedCloseRetributionRemoteHodlCase(ht *lntest.HarnessTest,
// remote party breaches before settling extended HTLCs. // remote party breaches before settling extended HTLCs.
func testRevokedCloseRetributionRemoteHodl(ht *lntest.HarnessTest) { func testRevokedCloseRetributionRemoteHodl(ht *lntest.HarnessTest) {
for _, commitType := range []lnrpc.CommitmentType{ for _, commitType := range []lnrpc.CommitmentType{
lnrpc.CommitmentType_LEGACY,
lnrpc.CommitmentType_SIMPLE_TAPROOT, lnrpc.CommitmentType_SIMPLE_TAPROOT,
} { } {
testName := fmt.Sprintf("%v", commitType.String()) testName := fmt.Sprintf("%v", commitType.String())