commit 0f2c5b9153fec4fcbc1e4e91b94968a652917e44
parent 845c02f2fa0a547823c0cb59bd784b28390bb85f
Author: Jared Tobin <jared@jtobin.io>
Date: Sat, 10 Oct 2026 13:09:24 +0400
test: remote dependency regression tests
Diffstat:
1 file changed, 27 insertions(+), 0 deletions(-)
diff --git a/test/Main.hs b/test/Main.hs
@@ -25,6 +25,7 @@ tests = testGroup "ppad-bolt9" [
, setFeatureWithDepsTests
, setFeatureForContextTests
, validateNoBothBitsTests
+ , remoteDependencyTests
, propertyTests
]
@@ -417,6 +418,32 @@ validateNoBothBitsTests = testGroup "validateNoBothBits" [
isLeft (validateNoBothBits fv) @?= True
]
+-- Remote dependency tests -----------------------------------------------------
+
+remoteDependencyTests :: TestTree
+remoteDependencyTests = testGroup "validateRemote dependencies" [
+ testCase "rejects option_zeroconf without option_scid_alias" $
+ validateRemote Init (setBit 51 empty) @?=
+ Left [MissingDependency "option_zeroconf" "option_scid_alias"]
+
+ , testCase "rejects basic_mpp without payment_secret (init)" $
+ validateRemote Init (setBit 17 empty) @?=
+ Left [MissingDependency "basic_mpp" "payment_secret"]
+
+ , testCase "rejects basic_mpp without payment_secret (invoice)" $
+ validateRemote Invoice (setBit 17 empty) @?=
+ Left [MissingDependency "basic_mpp" "payment_secret"]
+
+ , testCase "rejects option_simple_close without anysegwit" $
+ validateRemote Init (setBit 60 empty) @?=
+ Left [ MissingDependency
+ "option_simple_close" "option_shutdown_anysegwit" ]
+
+ , testCase "accepts features with dependencies set" $ do
+ validateRemote Init (setBit 51 (setBit 47 empty)) @?= Right ()
+ validateRemote Invoice (setBit 17 (setBit 14 empty)) @?= Right ()
+ ]
+
isInvalidParity :: ValidationError -> Bool
isInvalidParity (InvalidParity _ _) = True
isInvalidParity _ = False