Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions tests/autogenerate-rpc-examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ def update_examples_in_schema_files():
with open(TEMP_EXAMPLES_FILE, 'w+', encoding='utf-8') as file:
json.dump({'new_values_list': NEW_VALUES_LIST, 'replace_response_values': REPLACE_RESPONSE_VALUES[4:], 'examples_json': EXAMPLES_JSON, 'updated_examples_json': updated_examples}, file, indent=2, ensure_ascii=False)

logger.info(f'Updated All Examples in Schema Files!')
logger.info('Updated All Examples in Schema Files!')
return None


Expand Down Expand Up @@ -1138,12 +1138,12 @@ def generate_wait_examples(l1, l2, bitcoind, executor):
if curr_blockheight < 130:
bitcoind.generate_block(130 - curr_blockheight)
sync_blockheight(bitcoind, [l2])
update_example(node=l2, method='waitblockheight', params={'blockheight': 126}, description=[f'This will return immediately since the current blockheight exceeds the requested waitblockheight.'])
update_example(node=l2, method='waitblockheight', params={'blockheight': 126}, description=['This will return immediately since the current blockheight exceeds the requested waitblockheight.'])
wbh = executor.submit(l2.rpc.waitblockheight, curr_blockheight + 1, 600)
bitcoind.generate_block(1)
sync_blockheight(bitcoind, [l2])
wbhres = wbh.result(5)
update_example(node=l2, method='waitblockheight', params={'blockheight': curr_blockheight + 1, 'timeout': 600}, response=wbhres, description=[f'This will return after the next block is mined because requested waitblockheight is one block higher than the current blockheight.'])
update_example(node=l2, method='waitblockheight', params={'blockheight': curr_blockheight + 1, 'timeout': 600}, response=wbhres, description=['This will return after the next block is mined because requested waitblockheight is one block higher than the current blockheight.'])
REPLACE_RESPONSE_VALUES.extend([
{'data_keys': ['payment_hash'], 'original_value': wspc_res['details']['payment_hash'], 'new_value': NEW_VALUES_LIST['payment_hash_wspc_1']},
{'data_keys': ['paid_at'], 'original_value': waires['paid_at'], 'new_value': NEW_VALUES_LIST['time_at_850']},
Expand Down Expand Up @@ -1257,7 +1257,7 @@ def generate_utils_examples(l1, l2, l3, l4, l5, l6, c23_2, c34_2, inv_l11, inv_l

# SQL
update_example(node=l1, method='sql', params={'query': 'SELECT id FROM peers'}, description=['A simple peers selection query:'])
update_example(node=l1, method='sql', params=[f"SELECT label, description, status FROM invoices WHERE label='label inv_l12'"], description=["A statement containing `=` needs `-o` in shell:"])
update_example(node=l1, method='sql', params=["SELECT label, description, status FROM invoices WHERE label='label inv_l12'"], description=["A statement containing `=` needs `-o` in shell:"])
sql_res3 = l1.rpc.sql(f"SELECT nodeid FROM nodes WHERE nodeid != x'{l3.info['id']}'")
update_example(node=l1, method='sql', params=[f"SELECT nodeid FROM nodes WHERE nodeid != x'{NEW_VALUES_LIST['l3_id']}'"], description=['If you want to get specific nodeid values from the nodes table:'], response=sql_res3)
sql_res4 = l1.rpc.sql(f"SELECT nodeid FROM nodes WHERE nodeid IN (x'{l1.info['id']}', x'{l3.info['id']}')")
Expand Down Expand Up @@ -1524,7 +1524,7 @@ def generate_channels_examples(node_factory, bitcoind, l1, l3, l4, l5):
utxo = f"{outputs[0]['txid']}:{outputs[0]['output']}"
c41res = update_example(node=l4, method='fundchannel',
params={'id': l1.info['id'], 'amount': 'all', 'feerate': 'normal', 'push_msat': 100000, 'utxos': [utxo]},
description=[f'This example shows how to to open new channel with peer 1 from one whole utxo (you can use **listfunds** command to get txid and vout):'])
description=['This example shows how to to open new channel with peer 1 from one whole utxo (you can use **listfunds** command to get txid and vout):'])
# Close newly funded channels to bring the setup back to initial state
l3.rpc.close(c35res['channel_id'])
l4.rpc.close(c41res['channel_id'])
Expand Down Expand Up @@ -1593,7 +1593,7 @@ def generate_channels_examples(node_factory, bitcoind, l1, l3, l4, l5):
]
example_destinations_2 = [
{
'id': f'fakenodeid' + ('03' * 28) + '@127.0.0.1:19736',
'id': 'fakenodeid' + ('03' * 28) + '@127.0.0.1:19736',
'amount': 50000
},
{
Expand Down Expand Up @@ -1696,7 +1696,7 @@ def generate_autoclean_delete_examples(l1, l2, l3, l4, l5, c12, c23):
try:
logger.info('Auto-clean and Delete Start...')
l2.rpc.close(l5.info['id'])
dfc_res1 = update_example(node=l2, method='dev-forget-channel', params={'id': l5.info['id']}, description=[f'Forget a channel by peer pubkey when only one channel exists with the peer:'])
dfc_res1 = update_example(node=l2, method='dev-forget-channel', params={'id': l5.info['id']}, description=['Forget a channel by peer pubkey when only one channel exists with the peer:'])

# Create invoices for delpay and delinvoice examples
inv_l35 = l3.rpc.invoice('50000sat', 'lbl_l35', 'l35 description')
Expand Down Expand Up @@ -1741,7 +1741,7 @@ def generate_autoclean_delete_examples(l1, l2, l3, l4, l5, c12, c23):
update_example(node=l2, method='delforward', params={'in_channel': c12, 'in_htlc_id': local_failed_forwards[0]['in_htlc_id'], 'status': 'local_failed'})
if len(failed_forwards) > 0 and 'in_htlc_id' in failed_forwards[0]:
update_example(node=l2, method='delforward', params={'in_channel': c12, 'in_htlc_id': failed_forwards[0]['in_htlc_id'], 'status': 'failed'})
dfc_res2 = update_example(node=l2, method='dev-forget-channel', params={'id': l3.info['id'], 'short_channel_id': c23, 'force': True}, description=[f'Forget a channel by short channel id when peer has multiple channels:'])
dfc_res2 = update_example(node=l2, method='dev-forget-channel', params={'id': l3.info['id'], 'short_channel_id': c23, 'force': True}, description=['Forget a channel by short channel id when peer has multiple channels:'])

# Autoclean
update_example(node=l2, method='autoclean-once', params=['failedpays', 1])
Expand Down
12 changes: 6 additions & 6 deletions tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4258,8 +4258,8 @@ def test_all_subscription(node_factory, directory):
assert l2.daemon.is_in_log(f'.*test_libplugin: all: {notstr}.*')

# shutdown and connect are subscribed before the wildcard, so is handled by that handler
assert not l2.daemon.is_in_log(f'.*test_libplugin: all: shutdown.*')
assert not l2.daemon.is_in_log(f'.*test_libplugin: all: connect.*')
assert not l2.daemon.is_in_log('.*test_libplugin: all: shutdown.*')
assert not l2.daemon.is_in_log('.*test_libplugin: all: connect.*')


def test_dynamic_option_python_plugin(node_factory):
Expand Down Expand Up @@ -4369,7 +4369,7 @@ def test_sql_crash(node_factory, bitcoind):
l1.rpc.fundchannel_start(l2.info['id'], '10000000sat')

assert 'updates' not in only_one(l1.rpc.listpeerchannels()['channels'])
l1.rpc.sql(f"SELECT * FROM peerchannels;")
l1.rpc.sql("SELECT * FROM peerchannels;")


def test_sql_parallel(node_factory, executor):
Expand Down Expand Up @@ -4669,7 +4669,7 @@ def zero_timestamps(obj):
l1.rpc.pay(inv1['bolt11'])

# It gets a channel hint update notification
line = l1.daemon.wait_for_log(f"plugin-all_notifications.py: notification channel_hint_update: ")
line = l1.daemon.wait_for_log("plugin-all_notifications.py: notification channel_hint_update: ")
dict_str = line.split("notification channel_hint_update: ", 1)[1]
data = zero_timestamps(ast.literal_eval(dict_str))

Expand All @@ -4687,7 +4687,7 @@ def zero_timestamps(obj):
assert data == channel_hint_update

# It gets a success notification
line = l1.daemon.wait_for_log(f"plugin-all_notifications.py: notification pay_success: ")
line = l1.daemon.wait_for_log("plugin-all_notifications.py: notification pay_success: ")
dict_str = line.split("notification pay_success: ", 1)[1]
data = ast.literal_eval(dict_str)
success_core = {'payment_hash': inv1['payment_hash'],
Expand All @@ -4704,7 +4704,7 @@ def zero_timestamps(obj):
with pytest.raises(RpcError, match="WIRE_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS"):
l1.rpc.pay(inv2['bolt11'])

line = l1.daemon.wait_for_log(f"plugin-all_notifications.py: notification pay_failure: ")
line = l1.daemon.wait_for_log("plugin-all_notifications.py: notification pay_failure: ")
dict_str = line.split("notification pay_failure: ", 1)[1]
data = ast.literal_eval(dict_str)
failure_core = {'payment_hash': inv2['payment_hash'], 'bolt11': inv2['bolt11'], 'error': {'message': 'failed: WIRE_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS (reply from remote)'}}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -2777,7 +2777,7 @@ def test_rescan_missing_utxo(node_factory, bitcoind):
l3.daemon.wait_for_log("Scanning for missed UTXOs finished")

# Found it?
assert only_one(l3.db_query(f"SELECT spendheight as spendheight FROM utxoset WHERE blockheight=103 AND txindex=1"))['spendheight'] == 129
assert only_one(l3.db_query("SELECT spendheight as spendheight FROM utxoset WHERE blockheight=103 AND txindex=1"))['spendheight'] == 129

# Restart will NOT invoke scan.
oldstart_l3 = l3.daemon.logsearch_start
Expand Down
2 changes: 1 addition & 1 deletion tests/test_xpay.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ def test_xpay_no_mpp(node_factory, chainparams):
f"currency={chainparams['bip173_prefix']}",
f"p={no_mpp['payment_hash']}",
f"s={no_mpp['payment_secret']}",
f"d=Paying l3 without mpp",
"d=Paying l3 without mpp",
f"amount={AMOUNT}"]).decode('utf-8').strip()

# This should not mpp!
Expand Down