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

Function test_sql

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

Source from the content-addressed store, hash-verified

3460
3461@unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need')
3462def test_sql(node_factory, bitcoind):
3463 opts = {'experimental-dual-fund': None,
3464 'dev-allow-localhost': None,
3465 'may_reconnect': True,
3466 'dev-no-reconnect': None}
3467 l2opts = {'lease-fee-basis': 50,
3468 'experimental-dual-fund': None,
3469 'lease-fee-base-sat': '2000msat',
3470 'channel-fee-max-base-msat': '500sat',
3471 'channel-fee-max-proportional-thousandths': 200,
3472 'dev-sqlfilename': 'sql.sqlite3',
3473 'may_reconnect': True,
3474 'dev-no-reconnect': None}
3475 l2opts.update(opts)
3476 l1, l2, l3 = node_factory.line_graph(3, wait_for_announce=True,
3477 opts=[opts, l2opts, opts])
3478
3479 ret = l2.rpc.sql("SELECT * FROM forwards;")
3480 assert ret == {'rows': []}
3481
3482 # Test that we correctly clean up subtables!
3483 assert len(l2.rpc.sql("SELECT * from peerchannels_features")['rows']) == len(l2.rpc.sql("SELECT * from peerchannels_features")['rows'])
3484
3485 expected_schemas = {
3486 'channels': {
3487 'indices': [['short_channel_id']],
3488 'columns': [{'name': 'source',
3489 'type': 'pubkey'},
3490 {'name': 'destination',
3491 'type': 'pubkey'},
3492 {'name': 'short_channel_id',
3493 'type': 'short_channel_id'},
3494 {'name': 'direction',
3495 'type': 'u32'},
3496 {'name': 'public',
3497 'type': 'boolean'},
3498 {'name': 'amount_msat',
3499 'type': 'msat'},
3500 {'name': 'message_flags',
3501 'type': 'u8'},
3502 {'name': 'channel_flags',
3503 'type': 'u8'},
3504 {'name': 'active',
3505 'type': 'boolean'},
3506 {'name': 'last_update',
3507 'type': 'u32'},
3508 {'name': 'base_fee_millisatoshi',
3509 'type': 'u32'},
3510 {'name': 'fee_per_millionth',
3511 'type': 'u32'},
3512 {'name': 'delay',
3513 'type': 'u32'},
3514 {'name': 'htlc_minimum_msat',
3515 'type': 'msat'},
3516 {'name': 'htlc_maximum_msat',
3517 'type': 'msat'},
3518 {'name': 'features',
3519 '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