lnbase: organize channel data
This commit is contained in:
@@ -4,6 +4,7 @@ import json
|
||||
import binascii
|
||||
import asyncio
|
||||
import time
|
||||
import os
|
||||
|
||||
from lib.bitcoin import sha256
|
||||
from decimal import Decimal
|
||||
@@ -50,12 +51,12 @@ if __name__ == "__main__":
|
||||
async def async_test():
|
||||
payment_preimage = bytes.fromhex("01"*32)
|
||||
RHASH = sha256(payment_preimage)
|
||||
channel_id, per_commitment_secret_seed, local_ctx_args, remote_funding_pubkey, remote_funding_locked_msg, remote_revocation_basepoint, remote_htlc_basepoint, local_htlc_basepoint, delayed_payment_basepoint, revocation_basepoint, remote_delayed_payment_basepoint, remote_delay, remote_dust_limit_satoshis, funding_privkey, htlc_privkey = await peer.channel_establishment_flow(wallet, config, funding_satoshis, push_msat)
|
||||
openchannel = await peer.channel_establishment_flow(wallet, config, funding_satoshis, push_msat, temp_channel_id=os.urandom(32))
|
||||
expected_received_sat = 400000
|
||||
pay_req = lnencode(LnAddr(RHASH, amount=Decimal("0.00000001")*expected_received_sat, tags=[('d', 'one cup of coffee')]), peer.privkey[:32])
|
||||
print("payment request", pay_req)
|
||||
last_pcs_index = 2**48 - 1
|
||||
await peer.receive_commitment_revoke_ack(channel_id, per_commitment_secret_seed, last_pcs_index, local_ctx_args, expected_received_sat, remote_funding_pubkey, local_next_commitment_number=1, remote_next_commitment_point=remote_funding_locked_msg["next_per_commitment_point"], remote_revocation_basepoint=remote_revocation_basepoint, remote_htlc_basepoint=remote_htlc_basepoint, local_htlc_basepoint=local_htlc_basepoint, delayed_payment_basepoint=delayed_payment_basepoint, revocation_basepoint=revocation_basepoint, remote_delayed_payment_basepoint=remote_delayed_payment_basepoint, remote_delay=remote_delay, remote_dust_limit_satoshis=remote_dust_limit_satoshis, funding_privkey=funding_privkey, htlc_privkey=htlc_privkey, payment_preimage=payment_preimage)
|
||||
await peer.receive_commitment_revoke_ack(openchannel, expected_received_sat, payment_preimage)
|
||||
fut = asyncio.run_coroutine_threadsafe(async_test(), network.asyncio_loop)
|
||||
while not fut.done():
|
||||
time.sleep(1)
|
||||
|
||||
Reference in New Issue
Block a user