@@ -726,36 +726,33 @@ def test_listconfigs(node_factory, bitcoind, chainparams):
726726 # Make extremely long entry, check it works
727727 for deprecated in (True , False ):
728728 l1 = node_factory .get_node (options = {'log-prefix' : 'lightning1-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' ,
729- 'allow-deprecated-apis' : deprecated })
730-
731- configs = l1 .rpc .listconfigs ()
732- # See utils.py
733- assert configs ['allow-deprecated-apis' ] == deprecated
734- assert configs ['network' ] == chainparams ['name' ]
735- assert configs ['ignore-fee-limits' ] is False
736- assert configs ['log-prefix' ] == 'lightning1-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
729+ 'allow-deprecated-apis' : deprecated ,
730+ 'wumbo' : None })
731+
732+ configs = l1 .rpc .listconfigs ()['configs' ]
733+ # See utils.py for these values
734+ for name , valfield , val in (('allow-deprecated-apis' , 'value_bool' , deprecated ),
735+ ('network' , 'value_str' , chainparams ['name' ]),
736+ ('ignore-fee-limits' , 'value_bool' , False ),
737+ ('log-prefix' , 'value_str' , 'lightning1-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' )):
738+ c = configs [name ]
739+ assert c ['source' ] == 'cmdline'
740+ assert c [valfield ] == val
737741
738742 # These are aliases, but we don't print the (unofficial!) wumbo.
739743 assert 'wumbo' not in configs
740- assert configs ['large-channels' ] is False
741-
742- # Test one at a time.
743- for c in configs .keys ():
744- if c .startswith ('#' ) or c .startswith ('plugins' ) or c == 'important-plugins' or c == 'configs' :
745- continue
746- oneconfig = l1 .rpc .listconfigs (config = c )
747- assert (oneconfig [c ] == configs [c ])
744+ assert configs ['large-channels' ]['set' ] is True
745+ assert configs ['large-channels' ]['source' ] == 'cmdline'
748746
749747 # Test modern ones!
750- for c in configs [ 'configs' ] .keys ():
748+ for c in configs .keys ():
751749 oneconfig = l1 .rpc .listconfigs (config = c )['configs' ]
752- assert ( oneconfig [c ] == configs ['configs' ][ c ])
750+ assert oneconfig [c ] == configs [c ]
753751
754752
755753def test_listconfigs_plugins (node_factory , bitcoind , chainparams ):
756- l1 = node_factory .get_node ()
754+ l1 = node_factory .get_node (options = { 'allow-deprecated-apis' : True } )
757755
758- # assert that we have pay plugin and that plugins have a name and path
759756 configs = l1 .rpc .listconfigs ()
760757 assert configs ['important-plugins' ]
761758 assert len ([p for p in configs ['important-plugins' ] if p ['name' ] == "pay" ]) == 1
@@ -1701,8 +1698,19 @@ def check_new_log():
17011698 .format (l2 .daemon .lightning_dir ),
17021699 '-H' ,
17031700 'listconfigs' ]).decode ('utf-8' ).splitlines ()
1701+ # Arrays get split awkwardly by -H!
17041702 assert 'log-file=logfile1' in lines
1705- assert 'log-file=logfile2' in lines
1703+ assert 'logfile2' in lines
1704+
1705+ # Flat mode is better!
1706+ lines = subprocess .check_output (['cli/lightning-cli' ,
1707+ '--network={}' .format (TEST_NETWORK ),
1708+ '--lightning-dir={}'
1709+ .format (l2 .daemon .lightning_dir ),
1710+ '-F' ,
1711+ 'listconfigs' ]).decode ('utf-8' ).splitlines ()
1712+ assert 'configs.log-file.values_str[0]=logfile1' in lines
1713+ assert 'configs.log-file.values_str[1]=logfile2' in lines
17061714
17071715
17081716@unittest .skipIf (VALGRIND ,
@@ -1738,8 +1746,8 @@ def test_configfile_before_chdir(node_factory):
17381746 # Update executable to point to right place
17391747 l1 .daemon .executable = os .path .join (olddir , l1 .daemon .executable )
17401748 l1 .start ()
1741- assert l1 .rpc .listconfigs ()['always-use-proxy' ]
1742- assert l1 .rpc .listconfigs ()['proxy' ] == ' 127.0.0.1:100'
1749+ assert l1 .rpc .listconfigs ()['configs' ][ ' always-use-proxy' ] == { 'source' : os . path . abspath ( config ) + ":1" , 'value_bool' : True }
1750+ assert l1 .rpc .listconfigs ()['configs' ][ ' proxy' ] == { 'source' : os . path . abspath ( config ) + ":2" , 'value_str' : ' 127.0.0.1:100'}
17431751 os .chdir (olddir )
17441752
17451753
@@ -2159,7 +2167,7 @@ def test_relative_config_dir(node_factory):
21592167 os .chdir ('/' .join (root_dir ))
21602168 l1 .daemon .executable = os .path .join (initial_dir , l1 .daemon .executable )
21612169 l1 .start ()
2162- assert os .path .isabs (l1 .rpc .listconfigs ()["lightning-dir" ])
2170+ assert os .path .isabs (l1 .rpc .listconfigs ()['configs' ][ "lightning-dir" ][ 'value_str' ])
21632171 l1 .stop ()
21642172 os .chdir (initial_dir )
21652173
@@ -2236,7 +2244,7 @@ def test_include(node_factory):
22362244 l1 .daemon .opts ['conf' ] = os .path .join (subdir , "conf1" )
22372245 l1 .start ()
22382246
2239- assert l1 .rpc .listconfigs ('alias' )['alias' ] == ' conf2'
2247+ assert l1 .rpc .listconfigs ('alias' )['configs' ][ ' alias' ] == { 'source' : os . path . join ( subdir , " conf2" ) + ":1" , 'value_str' : 'conf2' }
22402248
22412249
22422250def test_config_in_subdir (node_factory , chainparams ):
@@ -2248,7 +2256,7 @@ def test_config_in_subdir(node_factory, chainparams):
22482256 f .write ('alias=test_config_in_subdir' )
22492257 l1 .start ()
22502258
2251- assert l1 .rpc .listconfigs ('alias' )['alias' ] == ' test_config_in_subdir'
2259+ assert l1 .rpc .listconfigs ('alias' )['configs' ][ ' alias' ] == { 'source' : os . path . join ( subdir , "config" ) + ":1" , 'value_str' : ' test_config_in_subdir'}
22522260
22532261 l1 .stop ()
22542262
@@ -2928,7 +2936,7 @@ def test_notimestamp_logging(node_factory):
29282936 l1 .start ()
29292937 assert l1 .daemon .logs [0 ].startswith ("DEBUG" )
29302938
2931- assert l1 .rpc .listconfigs ()['log-timestamps' ] is False
2939+ assert l1 .rpc .listconfigs ()['configs' ][ ' log-timestamps' ][ 'value_bool ' ] is False
29322940
29332941
29342942def test_getlog (node_factory ):
@@ -2954,7 +2962,7 @@ def test_log_filter(node_factory):
29542962
29552963def test_force_feerates (node_factory ):
29562964 l1 = node_factory .get_node (options = {'force-feerates' : 1111 })
2957- assert l1 .rpc .listconfigs ()['force-feerates' ] == '1111'
2965+ assert l1 .rpc .listconfigs ()['configs' ][ ' force-feerates' ][ 'value_str ' ] == '1111'
29582966
29592967 # Note that estimates are still valid here, despite "force-feerates"
29602968 estimates = [{"blockcount" : 2 ,
@@ -2984,7 +2992,7 @@ def test_force_feerates(node_factory):
29842992 l1 .daemon .opts ['force-feerates' ] = '1111/2222'
29852993 l1 .start ()
29862994
2987- assert l1 .rpc .listconfigs ()['force-feerates' ] == '1111/2222'
2995+ assert l1 .rpc .listconfigs ()['configs' ][ ' force-feerates' ][ 'value_str ' ] == '1111/2222'
29882996 assert l1 .rpc .feerates ('perkw' )['perkw' ] == {
29892997 "opening" : 1111 ,
29902998 "mutual_close" : 2222 ,
@@ -2999,7 +3007,7 @@ def test_force_feerates(node_factory):
29993007 l1 .daemon .opts ['force-feerates' ] = '1111/2222/3333/4444/5555/6666'
30003008 l1 .start ()
30013009
3002- assert l1 .rpc .listconfigs ()['force-feerates' ] == '1111/2222/3333/4444/5555/6666'
3010+ assert l1 .rpc .listconfigs ()['configs' ][ ' force-feerates' ][ 'value_str ' ] == '1111/2222/3333/4444/5555/6666'
30033011 assert l1 .rpc .feerates ('perkw' )['perkw' ] == {
30043012 "opening" : 1111 ,
30053013 "mutual_close" : 2222 ,
0 commit comments