Skip to content

Commit deff121

Browse files
authored
Merge pull request #736 from pinheadmz/lninit-fee-spacing
ln_init: space out channel open tx fee rates more
2 parents 6d4aff6 + 3e313e9 commit deff121

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

resources/scenarios/ln_init.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,11 @@ def open_channel(self, ch, fee_rate):
240240

241241
channels = sorted(ch_by_block[target_block], key=lambda ch: ch["id"]["index"])
242242
index = 0
243-
fee_rate = 5006 # s/vB, decreases by 5 per tx for up to 1000 txs per block
243+
fee_rate = 5006 # s/vB, decreases by 20 per tx for up to 250 txs per block
244244
ch_threads = []
245245
for ch in channels:
246246
index += 1 # noqa
247-
fee_rate -= 5
247+
fee_rate -= 20
248248
assert index == ch["id"]["index"], "Channel ID indexes are not consecutive"
249249
assert fee_rate >= 1, "Too many TXs in block, out of fee range"
250250
t = threading.Thread(target=open_channel, args=(self, ch, fee_rate))
@@ -311,7 +311,13 @@ def ln_all_chs(self, ln):
311311

312312
def update_policy(self, ln, txid_hex, policy, capacity):
313313
self.log.info(f"Sending update from {ln.name} for channel with outpoint: {txid_hex}:0")
314-
res = ln.update(txid_hex, policy, capacity)
314+
res = None
315+
while res is None:
316+
try:
317+
res = ln.update(txid_hex, policy, capacity)
318+
break
319+
except Exception:
320+
sleep(1)
315321
assert len(res["failed_updates"]) == 0, (
316322
f" Failed updates: {res['failed_updates']}\n txid: {txid_hex}\n policy:{policy}"
317323
)

src/warnet/graph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ def _import_network(graph_file_path, output_path):
356356
}
357357
tanks[source]["lnd"]["channels"].append(channel)
358358
index += 1
359-
if index > 1000:
359+
if index > 250:
360360
index = 1
361361
block += 1
362362
count += 1

0 commit comments

Comments
 (0)