Skip to content

Commit b0f4abd

Browse files
committed
autogenerate-rpc-examples.py: more refinement.
1. Don't mangle bookkeeper events. 2. Use l3, not l1, for listtransactions: it's more stable. 3. Use l2, not l1, for listpeerchannels and listchannels. 3. Use l2, not l2, for listfunds. (l1 has a lot of variation). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent 2533684 commit b0f4abd

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

tests/autogenerate-rpc-examples.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,6 @@ def generate_bookkeeper_examples(l2, l3, c23_2_chan_id):
416416
update_example(node=l3, method='bkpr-listbalances', params={})
417417

418418
bkprlistaccountevents_res1 = l3.rpc.bkpr_listaccountevents(c23_2_chan_id)
419-
bkprlistaccountevents_res1['events'] = [next((event for event in bkprlistaccountevents_res1['events'] if event['tag'] == 'channel_open'), None)]
420419
update_example(node=l3, method='bkpr-listaccountevents', params=[c23_2_chan_id], response=bkprlistaccountevents_res1)
421420
bkprlistaccountevents_res2 = l3.rpc.bkpr_listaccountevents()
422421
update_example(node=l3, method='bkpr-listaccountevents', params={}, response=bkprlistaccountevents_res2)
@@ -1084,8 +1083,8 @@ def generate_list_examples(bitcoind, l1, l2, l3, c12, c23_2, inv_l31, inv_l32, o
10841083
# Make sure all nodes are caught up.
10851084
sync_blockheight(bitcoind, [l1, l2, l3])
10861085
# Transactions Lists
1087-
listfunds_res1 = l1.rpc.listfunds()
1088-
update_example(node=l1, method='listfunds', params={}, response=listfunds_res1)
1086+
listfunds_res1 = l2.rpc.listfunds()
1087+
update_example(node=l2, method='listfunds', params={}, response=listfunds_res1)
10891088

10901089
listforwards_res1 = l2.rpc.listforwards(in_channel=c12, out_channel=c23_2, status='settled')
10911090
update_example(node=l2, method='listforwards', params={'in_channel': c12, 'out_channel': c23_2, 'status': 'settled'}, response=listforwards_res1)
@@ -1112,8 +1111,8 @@ def generate_list_examples(bitcoind, l1, l2, l3, c12, c23_2, inv_l31, inv_l32, o
11121111
listpays_res2 = l2.rpc.listpays()
11131112
update_example(node=l2, method='listpays', params={}, response=listpays_res2)
11141113

1115-
listtransactions_res1 = l1.rpc.listtransactions()
1116-
update_example(node=l1, method='listtransactions', params={}, response=listtransactions_res1)
1114+
listtransactions_res3 = l3.rpc.listtransactions()
1115+
update_example(node=l3, method='listtransactions', params={}, response=listtransactions_res3)
11171116
listclosedchannels_res1 = l2.rpc.listclosedchannels()
11181117
update_example(node=l2, method='listclosedchannels', params={}, response=listclosedchannels_res1)
11191118

@@ -1126,15 +1125,15 @@ def generate_list_examples(bitcoind, l1, l2, l3, c12, c23_2, inv_l31, inv_l32, o
11261125
update_example(node=l2, method='listsqlschemas', params={'table': 'offers'})
11271126
update_example(node=l2, method='listsqlschemas', params=['closedchannels'])
11281127

1129-
listpeerchannels_res1 = l1.rpc.listpeerchannels(l2.info['id'])
1130-
update_example(node=l1, method='listpeerchannels', params={'id': l2.info['id']}, response=listpeerchannels_res1)
1131-
listpeerchannels_res2 = l1.rpc.listpeerchannels()
1132-
update_example(node=l1, method='listpeerchannels', params={}, response=listpeerchannels_res2)
1128+
listpeerchannels_res1 = l2.rpc.listpeerchannels(l1.info['id'])
1129+
update_example(node=l2, method='listpeerchannels', params={'id': l1.info['id']}, response=listpeerchannels_res1)
1130+
listpeerchannels_res2 = l2.rpc.listpeerchannels()
1131+
update_example(node=l2, method='listpeerchannels', params={}, response=listpeerchannels_res2)
11331132

11341133
listchannels_res1 = l1.rpc.listchannels(c12)
11351134
update_example(node=l1, method='listchannels', params={'short_channel_id': c12}, response=listchannels_res1)
1136-
listchannels_res2 = l1.rpc.listchannels()
1137-
update_example(node=l1, method='listchannels', params={}, response=listchannels_res2)
1135+
listchannels_res2 = l2.rpc.listchannels()
1136+
update_example(node=l2, method='listchannels', params={}, response=listchannels_res2)
11381137

11391138
listnodes_res1 = l2.rpc.listnodes(l3.info['id'])
11401139
update_example(node=l2, method='listnodes', params={'id': l3.info['id']}, response=listnodes_res1)

0 commit comments

Comments
 (0)