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

Function test_sql

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

Source from the content-addressed store, hash-verified

3500
3501@unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need')
3502def test_sql(node_factory, bitcoind):
3503 opts = {'experimental-dual-fund': None,
3504 'dev-allow-localhost': None,
3505 'may_reconnect': True,
3506 'dev-no-reconnect': None}
3507 l2opts = {'lease-fee-basis': 50,
3508 'experimental-dual-fund': None,
3509 'lease-fee-base-sat': '2000msat',
3510 'channel-fee-max-base-msat': '500sat',
3511 'channel-fee-max-proportional-thousandths': 200,
3512 'dev-sqlfilename': 'sql.sqlite3',
3513 'may_reconnect': True,
3514 'dev-no-reconnect': None}
3515 l2opts.update(opts)
3516 l1, l2, l3 = node_factory.line_graph(3, wait_for_announce=True,
3517 opts=[opts, l2opts, opts])
3518
3519 ret = l2.rpc.sql("SELECT * FROM forwards;")
3520 assert ret == {'rows': []}
3521
3522 # Test that we correctly clean up subtables!
3523 assert len(l2.rpc.sql("SELECT * from peerchannels_features")['rows']) == len(l2.rpc.sql("SELECT * from peerchannels_features")['rows'])
3524
3525 expected_schemas = {
3526 'channels': {
3527 'indices': [['short_channel_id']],
3528 'columns': [{'name': 'source',
3529 'type': 'pubkey'},
3530 {'name': 'destination',
3531 'type': 'pubkey'},
3532 {'name': 'short_channel_id',
3533 'type': 'short_channel_id'},
3534 {'name': 'direction',
3535 'type': 'u32'},
3536 {'name': 'public',
3537 'type': 'boolean'},
3538 {'name': 'amount_msat',
3539 'type': 'msat'},
3540 {'name': 'message_flags',
3541 'type': 'u8'},
3542 {'name': 'channel_flags',
3543 'type': 'u8'},
3544 {'name': 'active',
3545 'type': 'boolean'},
3546 {'name': 'last_update',
3547 'type': 'u32'},
3548 {'name': 'base_fee_millisatoshi',
3549 'type': 'u32'},
3550 {'name': 'fee_per_millionth',
3551 'type': 'u32'},
3552 {'name': 'delay',
3553 'type': 'u32'},
3554 {'name': 'htlc_minimum_msat',
3555 'type': 'msat'},
3556 {'name': 'htlc_maximum_msat',
3557 'type': 'msat'},
3558 {'name': 'features',
3559 '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