commit 4fdf1b9b842eeb58d22bf24e829da02938cc22fe
parent 5d375de30e76cb4a35ff95fb7c726151975850bb
Author: Janus <ysangkok@gmail.com>
Date: Tue, 22 May 2018 17:01:56 +0200
lnbase: use small buffer when reading, support new_channel without payment in online test, send channel_reserve_satoshis
Diffstat:
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/lib/lnbase.py b/lib/lnbase.py
@@ -625,7 +625,7 @@ class Peer(PrintError):
rn_l, rk_l = self.rn()
rn_m, rk_m = self.rn()
while True:
- s = await self.reader.read(2**10)
+ s = await self.reader.read(1)
if not s:
raise Exception('connection closed')
self.read_buffer += s
@@ -851,7 +851,8 @@ class Peer(PrintError):
delayed_payment_basepoint=local_config.delayed_basepoint.pubkey,
first_per_commitment_point=per_commitment_point_first,
to_self_delay=local_config.to_self_delay,
- max_htlc_value_in_flight_msat=local_config.max_htlc_value_in_flight_msat
+ max_htlc_value_in_flight_msat=local_config.max_htlc_value_in_flight_msat,
+ channel_reserve_satoshis=10
)
self.send_message(msg)
try:
diff --git a/lib/tests/test_lnbase_online.py b/lib/tests/test_lnbase_online.py
@@ -136,14 +136,14 @@ if __name__ == "__main__":
payment_hash = addr.paymenthash
pubkey = addr.pubkey.serialize()
amt = int(addr.amount * COIN)
- advanced_channel = await peer.pay(wallet, openchannel, amt, payment_hash, pubkey, addr.min_final_cltv_expiry)
+ openchannel = await peer.pay(wallet, openchannel, amt, payment_hash, pubkey, addr.min_final_cltv_expiry)
elif "get_paid" in sys.argv[1]:
expected_received_sat = 200000
pay_req = lnencode(LnAddr(RHASH, amount=1/Decimal(COIN)*expected_received_sat, tags=[('d', 'one cup of coffee')]), peer.privkey[:32])
print("payment request", pay_req)
- advanced_channel = await peer.receive_commitment_revoke_ack(openchannel, expected_received_sat, payment_preimage)
+ openchannel = await peer.receive_commitment_revoke_ack(openchannel, expected_received_sat, payment_preimage)
- dumped = serialize_channels([advanced_channel])
+ dumped = serialize_channels([openchannel])
wallet.storage.put("channels", dumped)
wallet.storage.write()
fut = asyncio.run_coroutine_threadsafe(async_test(), network.asyncio_loop)