mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-20 10:34:20 +01:00
WIP: New melt flow (#622)
* `PaymentResult` * ledger: rely on PaymentResult instead of paid flag. Double check for payments marked pending. * `None` is `PENDING` * make format * reflected changes API tests where `PaymentStatus` is used + reflected changes in lnbits * reflect changes in blink backend and tests * fix lnbits get_payment_status * remove paid flag * fix mypy * remove more paid flags * fix strike mypy * green * shorten all state checks * fix * fix some tests * gimme ✅ * fix............ * fix lnbits * fix error * lightning refactor * add more regtest tests * add tests for pending state and failure * shorten checks * use match case for startup check - and remember modified checking_id from pay_invoice * fix strike pending return * new tests? * refactor startup routine into get_melt_quote * test with purge * refactor blink * cleanup responses * blink: return checking_id on failure * fix lndgrpc try except * add more testing for melt branches * speed things up a bit * remove comments * remove comments * block pending melt quotes * remove comments --------- Co-authored-by: lollerfirst <lollerfirst@gmail.com>
This commit is contained in:
@@ -96,6 +96,7 @@ docker_lightning_unconnected_cli = [
|
||||
"--rpcserver=lnd-2",
|
||||
]
|
||||
|
||||
|
||||
def docker_clightning_cli(index):
|
||||
return [
|
||||
"docker",
|
||||
@@ -104,9 +105,9 @@ def docker_clightning_cli(index):
|
||||
"lightning-cli",
|
||||
"--network",
|
||||
"regtest",
|
||||
"--keywords",
|
||||
]
|
||||
|
||||
|
||||
def run_cmd(cmd: list) -> str:
|
||||
timeout = 20
|
||||
process = Popen(cmd, stdout=PIPE, stderr=PIPE)
|
||||
@@ -171,11 +172,22 @@ def pay_real_invoice(invoice: str) -> str:
|
||||
cmd.extend(["payinvoice", "--force", invoice])
|
||||
return run_cmd(cmd)
|
||||
|
||||
|
||||
def partial_pay_real_invoice(invoice: str, amount: int, node: int) -> str:
|
||||
cmd = docker_clightning_cli(node)
|
||||
cmd.extend(["pay", f"bolt11={invoice}", f"partial_msat={amount*1000}"])
|
||||
return run_cmd(cmd)
|
||||
|
||||
|
||||
def get_real_invoice_cln(sats: int) -> str:
|
||||
cmd = docker_clightning_cli(1)
|
||||
cmd.extend(
|
||||
["invoice", f"{sats*1000}", hashlib.sha256(os.urandom(32)).hexdigest(), "test"]
|
||||
)
|
||||
result = run_cmd_json(cmd)
|
||||
return result["bolt11"]
|
||||
|
||||
|
||||
def mine_blocks(blocks: int = 1) -> str:
|
||||
cmd = docker_bitcoin_cli.copy()
|
||||
cmd.extend(["-generate", str(blocks)])
|
||||
|
||||
Reference in New Issue
Block a user