@@ -3280,10 +3280,16 @@ def test_block_added_notifications(node_factory, bitcoind):
3280
3280
@pytest .mark .openchannel ('v2' )
3281
3281
@pytest .mark .developer ("wants dev-announce-localhost so we see listnodes.addresses" )
3282
3282
def test_sql (node_factory , bitcoind ):
3283
+ opts = {'experimental-offers' : None ,
3284
+ 'dev-allow-localhost' : None }
3285
+ l2opts = {'lease-fee-basis' : 50 ,
3286
+ 'lease-fee-base-sat' : '2000msat' ,
3287
+ 'channel-fee-max-base-msat' : '500sat' ,
3288
+ 'channel-fee-max-proportional-thousandths' : 200 ,
3289
+ 'sqlfilename' : 'sql.sqlite3' }
3290
+ l2opts .update (opts )
3283
3291
l1 , l2 , l3 = node_factory .line_graph (3 , wait_for_announce = True ,
3284
- opts = {'experimental-offers' : None ,
3285
- 'sqlfilename' : 'sql.sqlite3' ,
3286
- 'dev-allow-localhost' : None })
3292
+ opts = [opts , l2opts , opts ])
3287
3293
3288
3294
ret = l2 .rpc .sql ("SELECT * FROM forwards;" )
3289
3295
assert ret == {'rows' : []}
@@ -3794,6 +3800,27 @@ def test_sql(node_factory, bitcoind):
3794
3800
with pytest .raises (RpcError , match = 'query failed with no such table: peers_channels' ):
3795
3801
l2 .rpc .sql ("SELECT * FROM peers_channels;" )
3796
3802
3803
+ # Test subobject case (option_will_fund)
3804
+ ret = l2 .rpc .sql ("SELECT option_will_fund_lease_fee_base_msat,"
3805
+ " option_will_fund_lease_fee_basis,"
3806
+ " option_will_fund_funding_weight,"
3807
+ " option_will_fund_channel_fee_max_base_msat,"
3808
+ " option_will_fund_channel_fee_max_proportional_thousandths,"
3809
+ " option_will_fund_compact_lease"
3810
+ " FROM nodes WHERE HEX(nodeid) = '{}';" .format (l2 .info ['id' ].upper ()))
3811
+ optret = only_one (l2 .rpc .listnodes (l2 .info ['id' ])['nodes' ])['option_will_fund' ]
3812
+ row = only_one (ret ['rows' ])
3813
+ assert row == [v for v in optret .values ()]
3814
+
3815
+ # Correctly handles missing object.
3816
+ assert l2 .rpc .sql ("SELECT option_will_fund_lease_fee_base_msat,"
3817
+ " option_will_fund_lease_fee_basis,"
3818
+ " option_will_fund_funding_weight,"
3819
+ " option_will_fund_channel_fee_max_base_msat,"
3820
+ " option_will_fund_channel_fee_max_proportional_thousandths,"
3821
+ " option_will_fund_compact_lease"
3822
+ " FROM nodes WHERE HEX(nodeid) = '{}';" .format (l1 .info ['id' ].upper ())) == {'rows' : [[None ] * 6 ]}
3823
+
3797
3824
3798
3825
def test_sql_deprecated (node_factory , bitcoind ):
3799
3826
# deprecated-apis breaks schemas...
0 commit comments