MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_sql

Function test_sql

tests/test_plugin.py:3585–4509  ·  view source on GitHub ↗
(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

3583
3584@unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need')
3585def test_sql(node_factory, bitcoind):
3586 opts = {'experimental-dual-fund': None,
3587 'dev-allow-localhost': None,
3588 'may_reconnect': True,
3589 'dev-no-reconnect': None}
3590 l2opts = {'lease-fee-basis': 50,
3591 'experimental-dual-fund': None,
3592 'lease-fee-base-sat': '2000msat',
3593 'channel-fee-max-base-msat': '500sat',
3594 'channel-fee-max-proportional-thousandths': 200,
3595 'dev-sqlfilename': 'sql.sqlite3',
3596 'may_reconnect': True,
3597 'dev-no-reconnect': None}
3598 l2opts.update(opts)
3599 l1, l2, l3 = node_factory.line_graph(3, wait_for_announce=True,
3600 opts=[opts, l2opts, opts])
3601
3602 ret = l2.rpc.sql("SELECT * FROM forwards;")
3603 assert ret == {'rows': []}
3604
3605 # Test that we correctly clean up subtables!
3606 assert len(l2.rpc.sql("SELECT * from peerchannels_features")['rows']) == len(l2.rpc.sql("SELECT * from peerchannels_features")['rows'])
3607
3608 expected_schemas = {
3609 'channels': {
3610 'indices': [['short_channel_id']],
3611 'columns': [{'name': 'source',
3612 'type': 'pubkey'},
3613 {'name': 'destination',
3614 'type': 'pubkey'},
3615 {'name': 'short_channel_id',
3616 'type': 'short_channel_id'},
3617 {'name': 'direction',
3618 'type': 'u32'},
3619 {'name': 'public',
3620 'type': 'boolean'},
3621 {'name': 'amount_msat',
3622 'type': 'msat'},
3623 {'name': 'message_flags',
3624 'type': 'u8'},
3625 {'name': 'channel_flags',
3626 'type': 'u8'},
3627 {'name': 'active',
3628 'type': 'boolean'},
3629 {'name': 'last_update',
3630 'type': 'u32'},
3631 {'name': 'base_fee_millisatoshi',
3632 'type': 'u32'},
3633 {'name': 'fee_per_millionth',
3634 'type': 'u32'},
3635 {'name': 'delay',
3636 'type': 'u32'},
3637 {'name': 'htlc_minimum_msat',
3638 'type': 'msat'},
3639 {'name': 'htlc_maximum_msat',
3640 'type': 'msat'},
3641 {'name': 'features',
3642 'type': 'hex'}]},

Callers

nothing calls this directly

Calls 15

only_oneFunction · 0.90
wait_forFunction · 0.90
formatEnum · 0.85
updateMethod · 0.80
line_graphMethod · 0.80
generate_blockMethod · 0.80
listpeerchannelsMethod · 0.80
plugin_startMethod · 0.80
joinMethod · 0.80
single_routeMethod · 0.80
sendpayMethod · 0.80
openchannelMethod · 0.80

Tested by

no test coverage detected