Skip to content

AssertionError in test_sql: assert 0 == 1 #8497

@whitslack

Description

@whitslack

Running the integration tests on v25.09rc2, I keep seeing this failure:

_____________________________________________________________ test_sql _____________________________________________________________
[gw5] linux -- Python 3.13.5 /usr/bin/python3.13

node_factory = <pyln.testing.utils.NodeFactory object at 0x7f050d8b5de0>
bitcoind = <pyln.testing.utils.BitcoinD object at 0x7f050c6f2ad0>

    @unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need')
    def test_sql(node_factory, bitcoind):
        opts = {'experimental-dual-fund': None,
                'dev-allow-localhost': None,
                'may_reconnect': True}
        l2opts = {'lease-fee-basis': 50,
                  'experimental-dual-fund': None,
                  'lease-fee-base-sat': '2000msat',
                  'channel-fee-max-base-msat': '500sat',
                  'channel-fee-max-proportional-thousandths': 200,
                  'dev-sqlfilename': 'sql.sqlite3',
                  'may_reconnect': True}
        l2opts.update(opts)
        l1, l2, l3 = node_factory.line_graph(3, wait_for_announce=True,
                                             opts=[opts, l2opts, opts])
    
        ret = l2.rpc.sql("SELECT * FROM forwards;")
        assert ret == {'rows': []}
    
        # Test that we correctly clean up subtables!
        assert len(l2.rpc.sql("SELECT * from peerchannels_features")['rows']) == len(l2.rpc.sql("SELECT * from peerchannels_features")['rows'])
    
        expected_schemas = { # [trimmed to fit within GitHub's size limit]
        }
    
        sqltypemap = {'string': 'TEXT',
                      'boolean': 'INTEGER',
                      'u8': 'INTEGER',
                      'u16': 'INTEGER',
                      'u32': 'INTEGER',
                      'u64': 'INTEGER',
                      's64': 'INTEGER',
                      'msat': 'INTEGER',
                      'hex': 'BLOB',
                      'hash': 'BLOB',
                      'txid': 'BLOB',
                      'outpoint': 'TEXT',
                      'pubkey': 'BLOB',
                      'secret': 'BLOB',
                      'number': 'REAL',
                      'short_channel_id': 'TEXT'}
    
        # Check schemas match
        for table, schema in expected_schemas.items():
            res = only_one(l2.rpc.listsqlschemas(table)['schemas'])
            assert res['tablename'] == table
            assert res.get('indices') == schema.get('indices')
            # Those without a created_index get an *explicit* rowid;
            if any([c['name'] == 'created_index' for c in schema['columns']]):
                prefix = []
            else:
                prefix = [{'name': 'rowid', 'type': 'u64'}]
            sqlcolumns = [{'name': c['name'], 'type': sqltypemap[c['type']]} for c in prefix + schema['columns']]
            assert res['columns'] == sqlcolumns
    
        # Make sure we didn't miss any
        assert (sorted([s['tablename'] for s in l1.rpc.listsqlschemas()['schemas']])
                == sorted(expected_schemas.keys()))
        assert len(l1.rpc.listsqlschemas()['schemas']) == len(expected_schemas)
    
        # We need one closed channel (but open a new one)
        l2.rpc.close(l1.info['id'])
        bitcoind.generate_block(1, wait_for_mempool=1)
        scid, _ = l1.fundchannel(l2)
        # Completely forget old channel
        bitcoind.generate_block(99)
        wait_for(lambda: len(l2.rpc.listpeerchannels()['channels']) == 2)
    
        # Make sure l3 sees new channel
        wait_for(lambda: len(l3.rpc.listchannels(scid)['channels']) == 2)
    
        # This should create a forward through l2
        l1.rpc.pay(l3.rpc.invoice(amount_msat=12300, label='inv1', description='description')['bolt11'])
    
        # Very rough checks of other list commands (make sure l2 has one of each)
        l2.rpc.offer(1, 'desc')
        l2.rpc.invoice(1, 'label', 'desc')
        l2.rpc.pay(l3.rpc.invoice(amount_msat=12300, label='inv2', description='description')['bolt11'])
    
        # And I need at least one HTLC in-flight so listpeers.channels.htlcs isn't empty:
        l3.rpc.plugin_start(os.path.join(os.getcwd(), 'tests/plugins/hold_invoice.py'),
                            holdtime=TIMEOUT * 2)
        inv = l3.rpc.invoice(amount_msat=12300, label='inv3', description='description')
        route = l1.rpc.getroute(l3.info['id'], 12300, 1)['route']
        l1.rpc.sendpay(route, inv['payment_hash'], payment_secret=inv['payment_secret'])
        # And an in-flight channel open...
        l2.openchannel(l3, confirm=False, wait_for_announce=False)
    
        for table, schema in expected_schemas.items():
            ret = l2.rpc.sql("SELECT * FROM {};".format(table))
            # If you have created_index, we don't create an explicit rowid.
            has_rowid = not any([c['name'] == 'created_index' for c in schema['columns']])
    
            if has_rowid:
                assert len(ret['rows'][0]) == 1 + len(schema['columns'])
    
                # First column is always rowid!
                for row in ret['rows']:
                    assert row[0] > 0
            else:
                assert len(ret['rows'][0]) == len(schema['columns'])
    
            for col in schema['columns']:
                # We will get a complaint for trying to access deprecated cols by name:
                if 'deprecated' in col:
                    name = f'{table}.{col["name"]}'
                    with pytest.raises(RpcError, match=fr'query failed with access to {name} is prohibited \(Deprecated column table {name}\)'):
                        l2.rpc.sql("SELECT {} FROM {};".format(col['name'], table))
                    continue
                val = only_one(l2.rpc.sql("SELECT {} FROM {};".format(col['name'], table))['rows'][0])
                # Could be null
                if val is None:
                    continue
                if col['type'] == "hex":
                    bytes.fromhex(val)
                elif col['type'] in ("hash", "secret", "txid"):
                    assert len(bytes.fromhex(val)) == 32
                elif col['type'] == "pubkey":
                    assert len(bytes.fromhex(val)) == 33
                elif col['type'] in ("msat", "integer", "s64", "u64", "u32", "u16", "u8", "boolean"):
                    int(val)
                elif col['type'] == "number":
                    float(val)
                elif col['type'] == "string":
                    val += ""
                elif col['type'] == "short_channel_id":
                    assert len(val.split('x')) == 3
                elif col['type'] == "outpoint":
                    txid, vout = val.split(':')
                    assert len(bytes.fromhex(txid)) == 32
                    int(vout)
                else:
                    assert False
    
        ret = l2.rpc.sql("SELECT in_htlc_id,out_msat,status,out_htlc_id FROM forwards WHERE in_htlc_id = 0;")
        assert only_one(ret['rows']) == [0, 12300, 'settled', 0]
    
        with pytest.raises(RpcError, match='Unauthorized'):
            l2.rpc.sql("DELETE FROM forwards;")
    
        assert len(l3.rpc.sql("SELECT * FROM channels;")['rows']) == 4
        # Check that channels gets refreshed!
        scid = l1.get_channel_scid(l2)
        l1.rpc.setchannel(scid, feebase=123)
        wait_for(lambda: l3.rpc.sql("SELECT short_channel_id FROM channels WHERE base_fee_millisatoshi = 123;")['rows'] == [[scid]])
        l3.daemon.wait_for_log("Refreshing channels...")
        l3.daemon.wait_for_log("Refreshing channel: {}".format(scid))
    
        # This has to wait for the hold_invoice plugin to let go!
        txid = only_one(l1.rpc.close(l2.info['id'])['txids'])
        bitcoind.generate_block(13, wait_for_mempool=txid)
        wait_for(lambda: len(l3.rpc.listchannels(source=l1.info['id'])['channels']) == 0)
        assert len(l3.rpc.sql("SELECT * FROM channels WHERE source = X'{}';".format(l1.info['id']))['rows']) == 0
        l3.daemon.wait_for_log("Deleting channel: {}".format(scid))
    
        # No deprecated fields!
        with pytest.raises(RpcError, match='query failed with no such column: funding_local_msat'):
            l2.rpc.sql("SELECT funding_local_msat FROM peerchannels;")
    
        with pytest.raises(RpcError, match='query failed with no such column: funding_remote_msat'):
            l2.rpc.sql("SELECT funding_remote_msat FROM peerchannels;")
    
        with pytest.raises(RpcError, match='query failed with no such table: peers_channels'):
            l2.rpc.sql("SELECT * FROM peers_channels;")
    
        # Test subobject case (option_will_fund)
        ret = l2.rpc.sql("SELECT option_will_fund_lease_fee_base_msat,"
                         " option_will_fund_lease_fee_basis,"
                         " option_will_fund_funding_weight,"
                         " option_will_fund_channel_fee_max_base_msat,"
                         " option_will_fund_channel_fee_max_proportional_thousandths,"
                         " option_will_fund_compact_lease"
                         " FROM nodes WHERE HEX(nodeid) = '{}';".format(l2.info['id'].upper()))
        optret = only_one(l2.rpc.listnodes(l2.info['id'])['nodes'])['option_will_fund']
        row = only_one(ret['rows'])
        assert row == [v for v in optret.values()]
    
        # Correctly handles missing object.
        assert l2.rpc.sql("SELECT option_will_fund_lease_fee_base_msat,"
                          " option_will_fund_lease_fee_basis,"
                          " option_will_fund_funding_weight,"
                          " option_will_fund_channel_fee_max_base_msat,"
                          " option_will_fund_channel_fee_max_proportional_thousandths,"
                          " option_will_fund_compact_lease"
                          " FROM nodes WHERE HEX(nodeid) = '{}';".format(l1.info['id'].upper())) == {'rows': [[None] * 6]}
    
        # Test that nodes get updated.
        l2.stop()
        l2.daemon.opts["alias"] = "TESTALIAS"
        # Don't try to reuse the same db file!
        del l2.daemon.opts["dev-sqlfilename"]
        l2.start()
        # DEV appends stuff to alias!
        alias = l2.rpc.getinfo()['alias']
        assert alias == "TESTALIAS"
        l2.rpc.connect(l3.info['id'], 'localhost', l3.port)
        wait_for(lambda: l3.rpc.sql("SELECT * FROM nodes WHERE alias = '{}'".format(alias))['rows'] != [])
    
        # Test json functions
        l1.fundchannel(l2)
        bitcoind.generate_block(6)
        l1.rpc.pay(l2.rpc.invoice(amount_msat=1000000, label='inv1000', description='description 1000 msat')['bolt11'])
        l1.daemon.wait_for_log('HTLC result state=success, sent=1000000msat')
        ret = l1.rpc.sql("SELECT json_object('peer_id', hex(pc.peer_id), 'alias', alias, 'htlcs',"
                         " (SELECT json_group_array(json_object('id', hex(id), 'amount_msat', amount_msat))"
                         " FROM peerchannels_htlcs ph WHERE ph.row = pc.rowid)) FROM peerchannels pc JOIN nodes n"
                         " ON pc.peer_id = n.nodeid ORDER BY n.alias, pc.peer_id;")
        assert len(ret['rows']) == 2
        row1 = json.loads(ret['rows'][0][0])
        row2 = json.loads(ret['rows'][1][0])
        assert row1['peer_id'] == format(l2.info['id'].upper())
>       assert len(row2['htlcs']) == 1
E       assert 0 == 1
E        +  where 0 = len([])

_          = {'channel_id': 'b463b157cd75008e103efe4f75c7d1f2f1df789689d465a49525c67f8349d43c',
 'channel_type': {'bits': [12, 22],
                  'names': ['static_remotekey/even', 'anchors/even']},
 'outnum': 0,
 'tx': '02000000000102a3666fe155093c590f87f70f42202e65afa149419a921af5507b0b6083510c850000000000fdffffff26de9d4cd334029fad240884201def08dbe65f83cbbd9996ccdfaf108cd933780000000000fdffffff0240420f000000000022002077d621620ef31fb172e1d8b75bebd31c148bc645a40d5a91ff575f6c3ef8f0206e0d0f00000000002251206c27e1956acfa61e68292c80908880e813450f754132e8a2ac471a86bf1326b501401133530159b39d58d3315388929c0636496c903d54130203ec05cd356e146c3f56faa2e42e29bd404b2a69f8f9d753a4628da8ac43a1b17ce023859a693293f50140f210f64a38afb97fbc491ee38e68401cd9a9a59a5053d548b4d83bbe5ee3c6ea467d2238b87cb0bfbf4658f8e803d29c9149d102073177344787d246901d1b7a6e000000',
 'txid': '1c2d0be4936cdec0eaceb18302d3f77dc675213a2f7e487baedc24ab2fa97235'}
alias      = 'TESTALIAS'
bitcoind   = <pyln.testing.utils.BitcoinD object at 0x7f050c6f2ad0>
col        = {'name': 'payment_id', 'type': 'hex'}
expected_schemas = {'bkpr_accountevents': {'columns': [{'name': 'account', 'type': 'string'},
                                    {'name': 'type', 'type': 'string'},
                                    {'name': 'tag', 'type': 'string'},
                                    {'name': 'credit_msat', 'type': 'msat'},
                                    {'name': 'debit_msat', 'type': 'msat'},
                                    {'name': 'currency', 'type': 'string'},
                                    {'name': 'timestamp', 'type': 'u32'},
                                    {'name': 'description', 'type': 'string'},
                                    {'name': 'outpoint', 'type': 'string'},
                                    {'name': 'blockheight', 'type': 'u32'},
                                    {'name': 'origin', 'type': 'string'},
                                    {'name': 'payment_id', 'type': 'hex'},
                                    {'name': 'txid', 'type': 'txid'},
                                    {'name': 'fees_msat', 'type': 'msat'},
                                    {'name': 'is_rebalance', 'type': 'boolean'},
                                    {'name': 'part_id', 'type': 'u32'}]},
 'bkpr_income': {'columns': [{'name': 'account', 'type': 'string'},
                             {'name': 'tag', 'type': 'string'},
                             {'name': 'credit_msat', 'type': 'msat'},
                             {'name': 'debit_msat', 'type': 'msat'},
                             {'name': 'currency', 'type': 'string'},
                             {'name': 'timestamp', 'type': 'u32'},
                             {'name': 'description', 'type': 'string'},
                             {'name': 'outpoint', 'type': 'string'},
                             {'name': 'txid', 'type': 'txid'},
                             {'name': 'payment_id', 'type': 'hex'}]},
 'chainmoves': {'columns': [{'name': 'created_index', 'type': 'u64'},
                            {'name': 'account_id', 'type': 'string'},
                            {'name': 'credit_msat', 'type': 'msat'},
                            {'name': 'debit_msat', 'type': 'msat'},
                            {'name': 'timestamp', 'type': 'u64'},
                            {'name': 'primary_tag', 'type': 'string'},
                            {'name': 'peer_id', 'type': 'pubkey'},
                            {'name': 'originating_account', 'type': 'string'},
                            {'name': 'spending_txid', 'type': 'txid'},
                            {'name': 'utxo', 'type': 'outpoint'},
                            {'name': 'payment_hash', 'type': 'hash'},
                            {'name': 'output_msat', 'type': 'msat'},
                            {'name': 'output_count', 'type': 'u32'},
                            {'name': 'blockheight', 'type': 'u32'}],
                'indices': [['account_id']]},
 'chainmoves_extra_tags': {'columns': [{'name': 'row', 'type': 'u64'},
                                       {'name': 'arrindex', 'type': 'u64'},
                                       {'name': 'extra_tags',
                                        'type': 'string'}]},
 'channelmoves': {'columns': [{'name': 'created_index', 'type': 'u64'},
                              {'name': 'account_id', 'type': 'string'},
                              {'name': 'credit_msat', 'type': 'msat'},
                              {'name': 'debit_msat', 'type': 'msat'},
                              {'name': 'timestamp', 'type': 'u64'},
                              {'name': 'primary_tag', 'type': 'string'},
                              {'name': 'payment_hash', 'type': 'hash'},
                              {'name': 'part_id', 'type': 'u64'},
                              {'name': 'group_id', 'type': 'u64'},
                              {'name': 'fees_msat', 'type': 'msat'}],
                  'indices': [['account_id']]},
 'channels': {'columns': [{'name': 'source', 'type': 'pubkey'},
                          {'name': 'destination', 'type': 'pubkey'},
                          {'name': 'short_channel_id',
                           'type': 'short_channel_id'},
                          {'name': 'direction', 'type': 'u32'},
                          {'name': 'public', 'type': 'boolean'},
                          {'name': 'amount_msat', 'type': 'msat'},
                          {'name': 'message_flags', 'type': 'u8'},
                          {'name': 'channel_flags', 'type': 'u8'},
                          {'name': 'active', 'type': 'boolean'},
                          {'name': 'last_update', 'type': 'u32'},
                          {'name': 'base_fee_millisatoshi', 'type': 'u32'},
                          {'name': 'fee_per_millionth', 'type': 'u32'},
                          {'name': 'delay', 'type': 'u32'},
                          {'name': 'htlc_minimum_msat', 'type': 'msat'},
                          {'name': 'htlc_maximum_msat', 'type': 'msat'},
                          {'name': 'features', 'type': 'hex'}],
              'indices': [['short_channel_id']]},
 'closedchannels': {'columns': [{'name': 'peer_id', 'type': 'pubkey'},
                                {'name': 'channel_id', 'type': 'hash'},
                                {'name': 'short_channel_id',
                                 'type': 'short_channel_id'},
                                {'name': 'alias_local',
                                 'type': 'short_channel_id'},
                                {'name': 'alias_remote',
                                 'type': 'short_channel_id'},
                                {'name': 'opener', 'type': 'string'},
                                {'name': 'closer', 'type': 'string'},
                                {'name': 'private', 'type': 'boolean'},
                                {'name': 'total_local_commitments',
                                 'type': 'u64'},
                                {'name': 'total_remote_commitments',
                                 'type': 'u64'},
                                {'name': 'total_htlcs_sent', 'type': 'u64'},
                                {'name': 'funding_txid', 'type': 'txid'},
                                {'name': 'funding_outnum', 'type': 'u32'},
                                {'name': 'leased', 'type': 'boolean'},
                                {'name': 'funding_fee_paid_msat',
                                 'type': 'msat'},
                                {'name': 'funding_fee_rcvd_msat',
                                 'type': 'msat'},
                                {'name': 'funding_pushed_msat', 'type': 'msat'},
                                {'name': 'total_msat', 'type': 'msat'},
                                {'name': 'final_to_us_msat', 'type': 'msat'},
                                {'name': 'min_to_us_msat', 'type': 'msat'},
                                {'name': 'max_to_us_msat', 'type': 'msat'},
                                {'name': 'last_commitment_txid',
                                 'type': 'txid'},
                                {'name': 'last_commitment_fee_msat',
                                 'type': 'msat'},
                                {'name': 'close_cause', 'type': 'string'},
                                {'name': 'last_stable_connection',
                                 'type': 'u64'}]},
 'closedchannels_channel_type_bits': {'columns': [{'name': 'row',
                                                   'type': 'u64'},
                                                  {'name': 'arrindex',
                                                   'type': 'u64'},
                                                  {'name': 'bits',
                                                   'type': 'u64'}]},
 'closedchannels_channel_type_names': {'columns': [{'name': 'row',
                                                    'type': 'u64'},
                                                   {'name': 'arrindex',
                                                    'type': 'u64'},
                                                   {'name': 'names',
                                                    'type': 'string'}]},
 'forwards': {'columns': [{'name': 'created_index', 'type': 'u64'},
                          {'name': 'in_channel', 'type': 'short_channel_id'},
                          {'name': 'in_htlc_id', 'type': 'u64'},
                          {'name': 'in_msat', 'type': 'msat'},
                          {'name': 'status', 'type': 'string'},
                          {'name': 'received_time', 'type': 'number'},
                          {'name': 'out_channel', 'type': 'short_channel_id'},
                          {'name': 'out_htlc_id', 'type': 'u64'},
                          {'name': 'updated_index', 'type': 'u64'},
                          {'name': 'style', 'type': 'string'},
                          {'name': 'fee_msat', 'type': 'msat'},
                          {'name': 'out_msat', 'type': 'msat'},
                          {'name': 'resolved_time', 'type': 'number'},
                          {'name': 'failcode', 'type': 'u32'},
                          {'name': 'failreason', 'type': 'string'}],
              'indices': [['in_channel', 'in_htlc_id']]},
 'htlcs': {'columns': [{'name': 'short_channel_id', 'type': 'short_channel_id'},
                       {'name': 'created_index', 'type': 'u64'},
                       {'name': 'updated_index', 'type': 'u64'},
                       {'name': 'id', 'type': 'u64'},
                       {'name': 'expiry', 'type': 'u32'},
                       {'name': 'amount_msat', 'type': 'msat'},
                       {'name': 'direction', 'type': 'string'},
                       {'name': 'payment_hash', 'type': 'hash'},
                       {'name': 'state', 'type': 'string'}],
           'indices': [['short_channel_id', 'id']]},
 'invoices': {'columns': [{'name': 'label', 'type': 'string'},
                          {'name': 'description', 'type': 'string'},
                          {'name': 'payment_hash', 'type': 'hash'},
                          {'name': 'status', 'type': 'string'},
                          {'name': 'expires_at', 'type': 'u64'},
                          {'name': 'amount_msat', 'type': 'msat'},
                          {'name': 'bolt11', 'type': 'string'},
                          {'name': 'bolt12', 'type': 'string'},
                          {'name': 'local_offer_id', 'type': 'hex'},
                          {'name': 'invreq_payer_note', 'type': 'string'},
                          {'name': 'created_index', 'type': 'u64'},
                          {'name': 'updated_index', 'type': 'u64'},
                          {'name': 'pay_index', 'type': 'u64'},
                          {'name': 'amount_received_msat', 'type': 'msat'},
                          {'name': 'paid_at', 'type': 'u64'},
                          {'name': 'paid_outpoint_txid', 'type': 'txid'},
                          {'name': 'paid_outpoint_outnum', 'type': 'u32'},
                          {'name': 'payment_preimage', 'type': 'secret'}],
              'indices': [['payment_hash']]},
 'nodes': {'columns': [{'name': 'nodeid', 'type': 'pubkey'},
                       {'name': 'last_timestamp', 'type': 'u32'},
                       {'name': 'alias', 'type': 'string'},
                       {'name': 'color', 'type': 'hex'},
                       {'name': 'features', 'type': 'hex'},
                       {'name': 'option_will_fund_lease_fee_base_msat',
                        'type': 'msat'},
                       {'name': 'option_will_fund_lease_fee_basis',
                        'type': 'u32'},
                       {'name': 'option_will_fund_funding_weight',
                        'type': 'u32'},
                       {'name': 'option_will_fund_channel_fee_max_base_msat',
                        'type': 'msat'},
                       {'name': 'option_will_fund_channel_fee_max_proportional_thousandths',
                        'type': 'u32'},
                       {'name': 'option_will_fund_compact_lease',
                        'type': 'hex'}],
           'indices': [['nodeid']]},
 'nodes_addresses': {'columns': [{'name': 'row', 'type': 'u64'},
                                 {'name': 'arrindex', 'type': 'u64'},
                                 {'name': 'type', 'type': 'string'},
                                 {'name': 'port', 'type': 'u16'},
                                 {'name': 'address', 'type': 'string'}]},
 'offers': {'columns': [{'name': 'offer_id', 'type': 'hex'},
                        {'name': 'active', 'type': 'boolean'},
                        {'name': 'single_use', 'type': 'boolean'},
                        {'name': 'bolt12', 'type': 'string'},
                        {'name': 'used', 'type': 'boolean'},
                        {'name': 'label', 'type': 'string'}],
            'indices': [['offer_id']]},
 'peerchannels': {'columns': [{'name': 'peer_id', 'type': 'pubkey'},
                              {'name': 'peer_connected', 'type': 'boolean'},
                              {'name': 'reestablished', 'type': 'boolean'},
                              {'name': 'state', 'type': 'string'},
                              {'name': 'scratch_txid', 'type': 'txid'},
                              {'name': 'local_htlc_minimum_msat',
                               'type': 'msat'},
                              {'name': 'local_htlc_maximum_msat',
                               'type': 'msat'},
                              {'name': 'local_cltv_expiry_delta',
                               'type': 'u32'},
                              {'name': 'local_fee_base_msat', 'type': 'msat'},
                              {'name': 'local_fee_proportional_millionths',
                               'type': 'u32'},
                              {'name': 'remote_htlc_minimum_msat',
                               'type': 'msat'},
                              {'name': 'remote_htlc_maximum_msat',
                               'type': 'msat'},
                              {'name': 'remote_cltv_expiry_delta',
                               'type': 'u32'},
                              {'name': 'remote_fee_base_msat', 'type': 'msat'},
                              {'name': 'remote_fee_proportional_millionths',
                               'type': 'u32'},
                              {'name': 'ignore_fee_limits', 'type': 'boolean'},
                              {'name': 'lost_state', 'type': 'boolean'},
                              {'name': 'feerate_perkw', 'type': 'u32'},
                              {'name': 'feerate_perkb', 'type': 'u32'},
                              {'name': 'owner', 'type': 'string'},
                              {'name': 'short_channel_id',
                               'type': 'short_channel_id'},
                              {'name': 'channel_id', 'type': 'hash'},
                              {'name': 'funding_txid', 'type': 'txid'},
                              {'name': 'funding_outnum', 'type': 'u32'},
                              {'name': 'initial_feerate', 'type': 'string'},
                              {'name': 'last_feerate', 'type': 'string'},
                              {'name': 'next_feerate', 'type': 'string'},
                              {'name': 'next_fee_step', 'type': 'u32'},
                              {'name': 'close_to', 'type': 'hex'},
                              {'name': 'private', 'type': 'boolean'},
                              {'name': 'opener', 'type': 'string'},
                              {'name': 'closer', 'type': 'string'},
                              {'name': 'funding_pushed_msat', 'type': 'msat'},
                              {'name': 'funding_local_funds_msat',
                               'type': 'msat'},
                              {'name': 'funding_remote_funds_msat',
                               'type': 'msat'},
                              {'name': 'funding_fee_paid_msat', 'type': 'msat'},
                              {'name': 'funding_fee_rcvd_msat', 'type': 'msat'},
                              {'name': 'to_us_msat', 'type': 'msat'},
                              {'name': 'min_to_us_msat', 'type': 'msat'},
                              {'name': 'max_to_us_msat', 'type': 'msat'},
                              {'name': 'total_msat', 'type': 'msat'},
                              {'name': 'fee_base_msat', 'type': 'msat'},
                              {'name': 'fee_proportional_millionths',
                               'type': 'u32'},
                              {'name': 'dust_limit_msat', 'type': 'msat'},
                              {'deprecated': True,
                               'name': 'max_total_htlc_in_msat',
                               'type': 'msat'},
                              {'name': 'their_max_htlc_value_in_flight_msat',
                               'type': 'msat'},
                              {'name': 'our_max_htlc_value_in_flight_msat',
                               'type': 'msat'},
                              {'name': 'their_reserve_msat', 'type': 'msat'},
                              {'name': 'our_reserve_msat', 'type': 'msat'},
                              {'name': 'spendable_msat', 'type': 'msat'},
                              {'name': 'receivable_msat', 'type': 'msat'},
                              {'name': 'minimum_htlc_in_msat', 'type': 'msat'},
                              {'name': 'minimum_htlc_out_msat', 'type': 'msat'},
                              {'name': 'maximum_htlc_out_msat', 'type': 'msat'},
                              {'name': 'their_to_self_delay', 'type': 'u32'},
                              {'name': 'our_to_self_delay', 'type': 'u32'},
                              {'name': 'max_accepted_htlcs', 'type': 'u32'},
                              {'name': 'alias_local',
                               'type': 'short_channel_id'},
                              {'name': 'alias_remote',
                               'type': 'short_channel_id'},
                              {'name': 'in_payments_offered', 'type': 'u64'},
                              {'name': 'in_offered_msat', 'type': 'msat'},
                              {'name': 'in_payments_fulfilled', 'type': 'u64'},
                              {'name': 'in_fulfilled_msat', 'type': 'msat'},
                              {'name': 'out_payments_offered', 'type': 'u64'},
                              {'name': 'out_offered_msat', 'type': 'msat'},
                              {'name': 'out_payments_fulfilled', 'type': 'u64'},
                              {'name': 'out_fulfilled_msat', 'type': 'msat'},
                              {'name': 'last_stable_connection', 'type': 'u64'},
                              {'name': 'close_to_addr', 'type': 'string'},
                              {'name': 'last_tx_fee_msat', 'type': 'msat'},
                              {'name': 'direction', 'type': 'u32'}],
                  'indices': [['peer_id']]},
 'peerchannels_channel_type_bits': {'columns': [{'name': 'row', 'type': 'u64'},
                                                {'name': 'arrindex',
                                                 'type': 'u64'},
                                                {'name': 'bits',
                                                 'type': 'u64'}]},
 'peerchannels_channel_type_names': {'columns': [{'name': 'row', 'type': 'u64'},
                                                 {'name': 'arrindex',
                                                  'type': 'u64'},
                                                 {'name': 'names',
                                                  'type': 'string'}]},
 'peerchannels_features': {'columns': [{'name': 'row', 'type': 'u64'},
                                       {'name': 'arrindex', 'type': 'u64'},
                                       {'name': 'features', 'type': 'string'}]},
 'peerchannels_htlcs': {'columns': [{'name': 'row', 'type': 'u64'},
                                    {'name': 'arrindex', 'type': 'u64'},
                                    {'name': 'direction', 'type': 'string'},
                                    {'name': 'id', 'type': 'u64'},
                                    {'name': 'amount_msat', 'type': 'msat'},
                                    {'name': 'expiry', 'type': 'u32'},
                                    {'name': 'payment_hash', 'type': 'hash'},
                                    {'name': 'local_trimmed',
                                     'type': 'boolean'},
                                    {'name': 'status', 'type': 'string'},
                                    {'name': 'state', 'type': 'string'}]},
 'peerchannels_inflight': {'columns': [{'name': 'row', 'type': 'u64'},
                                       {'name': 'arrindex', 'type': 'u64'},
                                       {'name': 'funding_txid', 'type': 'txid'},
                                       {'name': 'funding_outnum',
                                        'type': 'u32'},
                                       {'name': 'feerate', 'type': 'string'},
                                       {'name': 'total_funding_msat',
                                        'type': 'msat'},
                                       {'name': 'splice_amount', 'type': 's64'},
                                       {'name': 'our_funding_msat',
                                        'type': 'msat'},
                                       {'name': 'scratch_txid',
                                        'type': 'txid'}]},
 'peerchannels_state_changes': {'columns': [{'name': 'row', 'type': 'u64'},
                                            {'name': 'arrindex', 'type': 'u64'},
                                            {'name': 'timestamp',
                                             'type': 'string'},
                                            {'name': 'old_state',
                                             'type': 'string'},
                                            {'name': 'new_state',
                                             'type': 'string'},
                                            {'name': 'cause', 'type': 'string'},
                                            {'name': 'message',
                                             'type': 'string'}]},
 'peerchannels_status': {'columns': [{'name': 'row', 'type': 'u64'},
                                     {'name': 'arrindex', 'type': 'u64'},
                                     {'name': 'status', 'type': 'string'}]},
 'peers': {'columns': [{'name': 'id', 'type': 'pubkey'},
                       {'name': 'connected', 'type': 'boolean'},
                       {'name': 'num_channels', 'type': 'u32'},
                       {'name': 'remote_addr', 'type': 'string'},
                       {'name': 'features', 'type': 'hex'}],
           'indices': [['id']]},
 'peers_netaddr': {'columns': [{'name': 'row', 'type': 'u64'},
                               {'name': 'arrindex', 'type': 'u64'},
                               {'name': 'netaddr', 'type': 'string'}]},
 'sendpays': {'columns': [{'name': 'created_index', 'type': 'u64'},
                          {'name': 'id', 'type': 'u64'},
                          {'name': 'groupid', 'type': 'u64'},
                          {'name': 'partid', 'type': 'u64'},
                          {'name': 'payment_hash', 'type': 'hash'},
                          {'name': 'updated_index', 'type': 'u64'},
                          {'name': 'status', 'type': 'string'},
                          {'name': 'amount_msat', 'type': 'msat'},
                          {'name': 'destination', 'type': 'pubkey'},
                          {'name': 'created_at', 'type': 'u64'},
                          {'name': 'amount_sent_msat', 'type': 'msat'},
                          {'name': 'label', 'type': 'string'},
                          {'name': 'bolt11', 'type': 'string'},
                          {'name': 'description', 'type': 'string'},
                          {'name': 'bolt12', 'type': 'string'},
                          {'name': 'completed_at', 'type': 'u64'},
                          {'name': 'payment_preimage', 'type': 'secret'},
                          {'name': 'erroronion', 'type': 'hex'}],
              'indices': [['payment_hash']]},
 'transactions': {'columns': [{'name': 'hash', 'type': 'txid'},
                              {'name': 'rawtx', 'type': 'hex'},
                              {'name': 'blockheight', 'type': 'u32'},
                              {'name': 'txindex', 'type': 'u32'},
                              {'name': 'locktime', 'type': 'u32'},
                              {'name': 'version', 'type': 'u32'}],
                  'indices': [['hash']]},
 'transactions_inputs': {'columns': [{'name': 'row', 'type': 'u64'},
                                     {'name': 'arrindex', 'type': 'u64'},
                                     {'name': 'txid', 'type': 'hex'},
                                     {'name': 'idx', 'type': 'u32'},
                                     {'name': 'sequence', 'type': 'u32'}]},
 'transactions_outputs': {'columns': [{'name': 'row', 'type': 'u64'},
                                      {'name': 'arrindex', 'type': 'u64'},
                                      {'name': 'idx', 'type': 'u32'},
                                      {'name': 'amount_msat', 'type': 'msat'},
                                      {'name': 'scriptPubKey', 'type': 'hex'}]}}
has_rowid  = True
inv        = {'bolt11': 'lnbcrt123n1p524596sp5xu49rrkg69w73aq5ctjl6scrfyjhv4csvp6tuat7nwfmq7466nzspp55a94yvsfc9cxet9kwevdw9na8qd20twt78xk6vaef5xz0tmhks8sdqjv3jhxcmjd9c8g6t0dcxqyjw5qcqp9rzjqgkjyd3q5dv6gllh77kygly9c3kfy0d9xwyjyxsq2nq3c83u5vw4jqqqvuqqqqgqqyqqqqqpqqqqqzsqqc9qxpqysgqy32m22y2e2y3lz6374lzgwytz4pppzz883k9f95a4gkc7vz6pkuhgll9ra3zc8mqdhfz3ucueu04ntftykzn94zhuycuxt8yw3lr3qqqvjg9wh',
 'created_index': 3,
 'expires_at': 1756629818,
 'payment_hash': 'a74b523209c1706cacb67658d7167d381aa7adcbf1cd6d33b94d0c27af77b40f',
 'payment_secret': '372a518ec8d15de8f414c2e5fd430349257657106074be757e9b93b07abad4c5'}
l1         = <fixtures.LightningNode object at 0x7f050c44f4d0>
l2         = <fixtures.LightningNode object at 0x7f0508ae26c0>
l2opts     = {'channel-fee-max-base-msat': '500sat',
 'channel-fee-max-proportional-thousandths': 200,
 'dev-allow-localhost': None,
 'dev-sqlfilename': 'sql.sqlite3',
 'experimental-dual-fund': None,
 'lease-fee-base-sat': '2000msat',
 'lease-fee-basis': 50,
 'may_reconnect': True}
l3         = <fixtures.LightningNode object at 0x7f0508ae3d40>
name       = 'peerchannels.max_total_htlc_in_msat'
node_factory = <pyln.testing.utils.NodeFactory object at 0x7f050d8b5de0>
optret     = {'channel_fee_max_base_msat': 500000,
 'channel_fee_max_proportional_thousandths': 200,
 'compact_lease': '0248003200c80000000207a120',
 'funding_weight': 584,
 'lease_fee_base_msat': 2000,
 'lease_fee_basis': 50}
opts       = {'dev-allow-localhost': None,
 'experimental-dual-fund': None,
 'may_reconnect': True}
prefix     = [{'name': 'rowid', 'type': 'u64'}]
res        = {'columns': [{'name': 'rowid', 'type': 'INTEGER'},
             {'name': 'account', 'type': 'TEXT'},
             {'name': 'tag', 'type': 'TEXT'},
             {'name': 'credit_msat', 'type': 'INTEGER'},
             {'name': 'debit_msat', 'type': 'INTEGER'},
             {'name': 'currency', 'type': 'TEXT'},
             {'name': 'timestamp', 'type': 'INTEGER'},
             {'name': 'description', 'type': 'TEXT'},
             {'name': 'outpoint', 'type': 'TEXT'},
             {'name': 'txid', 'type': 'BLOB'},
             {'name': 'payment_id', 'type': 'BLOB'}],
 'tablename': 'bkpr_income'}
ret        = {'rows': [['{"peer_id":"022D223620A359A47FF7F7AC447C85C46C923DA53389221A0054C11C1E3CA31D59","alias":"TESTALIAS","htlcs":[]}'],
          ['{"peer_id":"022D223620A359A47FF7F7AC447C85C46C923DA53389221A0054C11C1E3CA31D59","alias":"TESTALIAS","htlcs":[]}']]}
route      = [{'amount_msat': 12301,
  'channel': '111x1x0',
  'delay': 15,
  'direction': 1,
  'id': '022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59',
  'style': 'tlv'},
 {'amount_msat': 12300,
  'channel': '103x1x1',
  'delay': 9,
  'direction': 0,
  'id': '035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d',
  'style': 'tlv'}]
row        = [2000, 50, 584, 500000, 200, '0248003200c80000000207a120']
row1       = {'alias': 'TESTALIAS',
 'htlcs': [],
 'peer_id': '022D223620A359A47FF7F7AC447C85C46C923DA53389221A0054C11C1E3CA31D59'}
row2       = {'alias': 'TESTALIAS',
 'htlcs': [],
 'peer_id': '022D223620A359A47FF7F7AC447C85C46C923DA53389221A0054C11C1E3CA31D59'}
schema     = {'columns': [{'name': 'account', 'type': 'string'},
             {'name': 'tag', 'type': 'string'},
             {'name': 'credit_msat', 'type': 'msat'},
             {'name': 'debit_msat', 'type': 'msat'},
             {'name': 'currency', 'type': 'string'},
             {'name': 'timestamp', 'type': 'u32'},
             {'name': 'description', 'type': 'string'},
             {'name': 'outpoint', 'type': 'string'},
             {'name': 'txid', 'type': 'txid'},
             {'name': 'payment_id', 'type': 'hex'}]}
scid       = '111x1x0'
sqlcolumns = [{'name': 'rowid', 'type': 'INTEGER'},
 {'name': 'account', 'type': 'TEXT'},
 {'name': 'tag', 'type': 'TEXT'},
 {'name': 'credit_msat', 'type': 'INTEGER'},
 {'name': 'debit_msat', 'type': 'INTEGER'},
 {'name': 'currency', 'type': 'TEXT'},
 {'name': 'timestamp', 'type': 'INTEGER'},
 {'name': 'description', 'type': 'TEXT'},
 {'name': 'outpoint', 'type': 'TEXT'},
 {'name': 'txid', 'type': 'BLOB'},
 {'name': 'payment_id', 'type': 'BLOB'}]
sqltypemap = {'boolean': 'INTEGER',
 'hash': 'BLOB',
 'hex': 'BLOB',
 'msat': 'INTEGER',
 'number': 'REAL',
 'outpoint': 'TEXT',
 'pubkey': 'BLOB',
 's64': 'INTEGER',
 'secret': 'BLOB',
 'short_channel_id': 'TEXT',
 'string': 'TEXT',
 'txid': 'BLOB',
 'u16': 'INTEGER',
 'u32': 'INTEGER',
 'u64': 'INTEGER',
 'u8': 'INTEGER'}
table      = 'bkpr_income'
txid       = '9fe18133809c163b672f0db945ca4937615084331ea2f351902e49c4011f8787'
val        = None
vout       = '1'

tests/test_plugin.py:4060: AssertionError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions