mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-03 17:26:57 +01:00
funding: make expectsChanType a pointer
This allows us to expect chanType to be nil, which will be possible after the next commit.
This commit is contained in:
parent
34186dee19
commit
0ae9c63d64
1 changed files with 47 additions and 33 deletions
|
@ -20,7 +20,7 @@ func TestCommitmentTypeNegotiation(t *testing.T) {
|
|||
localFeatures *lnwire.RawFeatureVector
|
||||
remoteFeatures *lnwire.RawFeatureVector
|
||||
expectsCommitType lnwallet.CommitmentType
|
||||
expectsChanType lnwire.ChannelType
|
||||
expectsChanType *lnwire.ChannelType
|
||||
zeroConf bool
|
||||
scidAlias bool
|
||||
expectsErr error
|
||||
|
@ -41,10 +41,12 @@ func TestCommitmentTypeNegotiation(t *testing.T) {
|
|||
lnwire.AnchorsZeroFeeHtlcTxOptional,
|
||||
),
|
||||
expectsCommitType: lnwallet.CommitmentTypeAnchorsZeroFeeHtlcTx,
|
||||
expectsChanType: lnwire.ChannelType(*lnwire.NewRawFeatureVector(
|
||||
expectsChanType: (*lnwire.ChannelType)(
|
||||
lnwire.NewRawFeatureVector(
|
||||
lnwire.StaticRemoteKeyRequired,
|
||||
lnwire.AnchorsZeroFeeHtlcTxRequired,
|
||||
)),
|
||||
),
|
||||
),
|
||||
expectsErr: nil,
|
||||
},
|
||||
{
|
||||
|
@ -106,8 +108,8 @@ func TestCommitmentTypeNegotiation(t *testing.T) {
|
|||
lnwire.ExplicitChannelTypeOptional,
|
||||
),
|
||||
expectsCommitType: lnwallet.CommitmentTypeScriptEnforcedLease,
|
||||
expectsChanType: lnwire.ChannelType(
|
||||
*lnwire.NewRawFeatureVector(
|
||||
expectsChanType: (*lnwire.ChannelType)(
|
||||
lnwire.NewRawFeatureVector(
|
||||
lnwire.ZeroConfRequired,
|
||||
lnwire.StaticRemoteKeyRequired,
|
||||
lnwire.AnchorsZeroFeeHtlcTxRequired,
|
||||
|
@ -137,8 +139,8 @@ func TestCommitmentTypeNegotiation(t *testing.T) {
|
|||
lnwire.ExplicitChannelTypeOptional,
|
||||
),
|
||||
expectsCommitType: lnwallet.CommitmentTypeAnchorsZeroFeeHtlcTx,
|
||||
expectsChanType: lnwire.ChannelType(
|
||||
*lnwire.NewRawFeatureVector(
|
||||
expectsChanType: (*lnwire.ChannelType)(
|
||||
lnwire.NewRawFeatureVector(
|
||||
lnwire.ZeroConfRequired,
|
||||
lnwire.StaticRemoteKeyRequired,
|
||||
lnwire.AnchorsZeroFeeHtlcTxRequired,
|
||||
|
@ -170,8 +172,8 @@ func TestCommitmentTypeNegotiation(t *testing.T) {
|
|||
lnwire.ExplicitChannelTypeOptional,
|
||||
),
|
||||
expectsCommitType: lnwallet.CommitmentTypeScriptEnforcedLease,
|
||||
expectsChanType: lnwire.ChannelType(
|
||||
*lnwire.NewRawFeatureVector(
|
||||
expectsChanType: (*lnwire.ChannelType)(
|
||||
lnwire.NewRawFeatureVector(
|
||||
lnwire.ScidAliasRequired,
|
||||
lnwire.StaticRemoteKeyRequired,
|
||||
lnwire.AnchorsZeroFeeHtlcTxRequired,
|
||||
|
@ -201,8 +203,8 @@ func TestCommitmentTypeNegotiation(t *testing.T) {
|
|||
lnwire.ExplicitChannelTypeOptional,
|
||||
),
|
||||
expectsCommitType: lnwallet.CommitmentTypeAnchorsZeroFeeHtlcTx,
|
||||
expectsChanType: lnwire.ChannelType(
|
||||
*lnwire.NewRawFeatureVector(
|
||||
expectsChanType: (*lnwire.ChannelType)(
|
||||
lnwire.NewRawFeatureVector(
|
||||
lnwire.ScidAliasRequired,
|
||||
lnwire.StaticRemoteKeyRequired,
|
||||
lnwire.AnchorsZeroFeeHtlcTxRequired,
|
||||
|
@ -228,10 +230,12 @@ func TestCommitmentTypeNegotiation(t *testing.T) {
|
|||
lnwire.ExplicitChannelTypeOptional,
|
||||
),
|
||||
expectsCommitType: lnwallet.CommitmentTypeAnchorsZeroFeeHtlcTx,
|
||||
expectsChanType: lnwire.ChannelType(*lnwire.NewRawFeatureVector(
|
||||
expectsChanType: (*lnwire.ChannelType)(
|
||||
lnwire.NewRawFeatureVector(
|
||||
lnwire.StaticRemoteKeyRequired,
|
||||
lnwire.AnchorsZeroFeeHtlcTxRequired,
|
||||
)),
|
||||
),
|
||||
),
|
||||
expectsErr: nil,
|
||||
},
|
||||
{
|
||||
|
@ -250,9 +254,11 @@ func TestCommitmentTypeNegotiation(t *testing.T) {
|
|||
lnwire.ExplicitChannelTypeOptional,
|
||||
),
|
||||
expectsCommitType: lnwallet.CommitmentTypeTweakless,
|
||||
expectsChanType: lnwire.ChannelType(*lnwire.NewRawFeatureVector(
|
||||
expectsChanType: (*lnwire.ChannelType)(
|
||||
lnwire.NewRawFeatureVector(
|
||||
lnwire.StaticRemoteKeyRequired,
|
||||
)),
|
||||
),
|
||||
),
|
||||
expectsErr: nil,
|
||||
},
|
||||
{
|
||||
|
@ -269,7 +275,9 @@ func TestCommitmentTypeNegotiation(t *testing.T) {
|
|||
lnwire.ExplicitChannelTypeOptional,
|
||||
),
|
||||
expectsCommitType: lnwallet.CommitmentTypeLegacy,
|
||||
expectsChanType: lnwire.ChannelType(*lnwire.NewRawFeatureVector()),
|
||||
expectsChanType: (*lnwire.ChannelType)(
|
||||
lnwire.NewRawFeatureVector(),
|
||||
),
|
||||
expectsErr: nil,
|
||||
},
|
||||
// Both sides signal the explicit chan type bit, so we expect
|
||||
|
@ -289,10 +297,12 @@ func TestCommitmentTypeNegotiation(t *testing.T) {
|
|||
lnwire.ExplicitChannelTypeOptional,
|
||||
),
|
||||
expectsCommitType: lnwallet.CommitmentTypeAnchorsZeroFeeHtlcTx,
|
||||
expectsChanType: lnwire.ChannelType(*lnwire.NewRawFeatureVector(
|
||||
expectsChanType: (*lnwire.ChannelType)(
|
||||
lnwire.NewRawFeatureVector(
|
||||
lnwire.StaticRemoteKeyRequired,
|
||||
lnwire.AnchorsZeroFeeHtlcTxRequired,
|
||||
)),
|
||||
),
|
||||
),
|
||||
expectsErr: nil,
|
||||
},
|
||||
{
|
||||
|
@ -306,9 +316,11 @@ func TestCommitmentTypeNegotiation(t *testing.T) {
|
|||
lnwire.StaticRemoteKeyOptional,
|
||||
),
|
||||
expectsCommitType: lnwallet.CommitmentTypeTweakless,
|
||||
expectsChanType: lnwire.ChannelType(*lnwire.NewRawFeatureVector(
|
||||
expectsChanType: (*lnwire.ChannelType)(
|
||||
lnwire.NewRawFeatureVector(
|
||||
lnwire.StaticRemoteKeyRequired,
|
||||
)),
|
||||
),
|
||||
),
|
||||
expectsErr: nil,
|
||||
},
|
||||
{
|
||||
|
@ -320,7 +332,9 @@ func TestCommitmentTypeNegotiation(t *testing.T) {
|
|||
lnwire.AnchorsZeroFeeHtlcTxOptional,
|
||||
),
|
||||
expectsCommitType: lnwallet.CommitmentTypeLegacy,
|
||||
expectsChanType: lnwire.ChannelType(*lnwire.NewRawFeatureVector()),
|
||||
expectsChanType: (*lnwire.ChannelType)(
|
||||
lnwire.NewRawFeatureVector(),
|
||||
),
|
||||
expectsErr: nil,
|
||||
},
|
||||
}
|
||||
|
@ -402,11 +416,11 @@ func TestCommitmentTypeNegotiation(t *testing.T) {
|
|||
)
|
||||
|
||||
require.Equal(
|
||||
t, testCase.expectsChanType, *lChan,
|
||||
t, testCase.expectsChanType, lChan,
|
||||
testCase.name,
|
||||
)
|
||||
require.Equal(
|
||||
t, testCase.expectsChanType, *rChan,
|
||||
t, testCase.expectsChanType, rChan,
|
||||
testCase.name,
|
||||
)
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue