diff --git a/watchtower/blob/type.go b/watchtower/blob/type.go index f24b41f3..73d963c8 100644 --- a/watchtower/blob/type.go +++ b/watchtower/blob/type.go @@ -138,8 +138,9 @@ func (t Type) String() string { // supportedTypes is the set of all configurations known to be supported by the // package. var supportedTypes = map[Type]struct{}{ - TypeAltruistCommit: {}, - TypeRewardCommit: {}, + TypeAltruistCommit: {}, + TypeRewardCommit: {}, + TypeAltruistAnchorCommit: {}, } // IsSupportedType returns true if the given type is supported by the package. diff --git a/watchtower/blob/type_test.go b/watchtower/blob/type_test.go index a88965b2..026263df 100644 --- a/watchtower/blob/type_test.go +++ b/watchtower/blob/type_test.go @@ -123,6 +123,12 @@ func TestSupportedTypes(t *testing.T) { t.Fatalf("default type %s is not supported", blob.TypeAltruistCommit) } + // Assert that the altruist anchor commit types are supported. + if !blob.IsSupportedType(blob.TypeAltruistAnchorCommit) { + t.Fatalf("default type %s is not supported", + blob.TypeAltruistAnchorCommit) + } + // Assert that all claimed supported types are actually supported. for _, supType := range blob.SupportedTypes() { if blob.IsSupportedType(supType) { diff --git a/watchtower/wtserver/server.go b/watchtower/wtserver/server.go index faf39819..c46447b2 100644 --- a/watchtower/wtserver/server.go +++ b/watchtower/wtserver/server.go @@ -96,7 +96,10 @@ type Server struct { // sessions and send state updates. func New(cfg *Config) (*Server, error) { localInit := wtwire.NewInitMessage( - lnwire.NewRawFeatureVector(wtwire.AltruistSessionsOptional), + lnwire.NewRawFeatureVector( + wtwire.AltruistSessionsOptional, + wtwire.AnchorCommitOptional, + ), cfg.ChainHash, ) diff --git a/watchtower/wtserver/server_test.go b/watchtower/wtserver/server_test.go index 0bb5806d..5915d2d4 100644 --- a/watchtower/wtserver/server_test.go +++ b/watchtower/wtserver/server_test.go @@ -161,6 +161,28 @@ type createSessionTestCase struct { } var createSessionTests = []createSessionTestCase{ + { + name: "duplicate session create altruist anchor commit", + initMsg: wtwire.NewInitMessage( + lnwire.NewRawFeatureVector(), + testnetChainHash, + ), + createMsg: &wtwire.CreateSession{ + BlobType: blob.TypeAltruistAnchorCommit, + MaxUpdates: 1000, + RewardBase: 0, + RewardRate: 0, + SweepFeeRate: 10000, + }, + expReply: &wtwire.CreateSessionReply{ + Code: wtwire.CodeOK, + Data: []byte{}, + }, + expDupReply: &wtwire.CreateSessionReply{ + Code: wtwire.CodeOK, + Data: []byte{}, + }, + }, { name: "duplicate session create", initMsg: wtwire.NewInitMessage(