mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-03 18:57:06 +01:00
Minor cleanups.
1. connect convenience variable for improved readabilty. 2. a comment explaining that timer is on channel, not HTLC. 3. use modern python style in test_htlc_send_timeout Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
63e4ea17af
commit
65c882ca3a
3 changed files with 14 additions and 12 deletions
|
@ -1073,6 +1073,7 @@ static void try_reach_one_addr(struct reaching *reach)
|
||||||
{
|
{
|
||||||
int fd, af;
|
int fd, af;
|
||||||
bool use_proxy = reach->daemon->use_proxy_always;
|
bool use_proxy = reach->daemon->use_proxy_always;
|
||||||
|
const struct wireaddr_internal *addr = &reach->addrs[reach->addrnum];
|
||||||
|
|
||||||
if (reach->addrnum == tal_count(reach->addrs)) {
|
if (reach->addrnum == tal_count(reach->addrs)) {
|
||||||
connect_failed(reach->daemon, &reach->id, reach->seconds_waited,
|
connect_failed(reach->daemon, &reach->id, reach->seconds_waited,
|
||||||
|
@ -1084,7 +1085,7 @@ static void try_reach_one_addr(struct reaching *reach)
|
||||||
/* Might not even be able to create eg. IPv6 sockets */
|
/* Might not even be able to create eg. IPv6 sockets */
|
||||||
af = -1;
|
af = -1;
|
||||||
|
|
||||||
switch (reach->addrs[reach->addrnum].itype) {
|
switch (addr->itype) {
|
||||||
case ADDR_INTERNAL_SOCKNAME:
|
case ADDR_INTERNAL_SOCKNAME:
|
||||||
af = AF_LOCAL;
|
af = AF_LOCAL;
|
||||||
/* Local sockets don't use tor proxy */
|
/* Local sockets don't use tor proxy */
|
||||||
|
@ -1100,7 +1101,7 @@ static void try_reach_one_addr(struct reaching *reach)
|
||||||
use_proxy = true;
|
use_proxy = true;
|
||||||
break;
|
break;
|
||||||
case ADDR_INTERNAL_WIREADDR:
|
case ADDR_INTERNAL_WIREADDR:
|
||||||
switch (reach->addrs[reach->addrnum].u.wireaddr.type) {
|
switch (addr->u.wireaddr.type) {
|
||||||
case ADDR_TYPE_TOR_V2:
|
case ADDR_TYPE_TOR_V2:
|
||||||
case ADDR_TYPE_TOR_V3:
|
case ADDR_TYPE_TOR_V3:
|
||||||
use_proxy = true;
|
use_proxy = true;
|
||||||
|
@ -1135,7 +1136,7 @@ static void try_reach_one_addr(struct reaching *reach)
|
||||||
tal_append_fmt(&reach->errors,
|
tal_append_fmt(&reach->errors,
|
||||||
"%s: opening %i socket gave %s. ",
|
"%s: opening %i socket gave %s. ",
|
||||||
type_to_string(tmpctx, struct wireaddr_internal,
|
type_to_string(tmpctx, struct wireaddr_internal,
|
||||||
&reach->addrs[reach->addrnum]),
|
addr),
|
||||||
af, strerror(errno));
|
af, strerror(errno));
|
||||||
reach->addrnum++;
|
reach->addrnum++;
|
||||||
try_reach_one_addr(reach);
|
try_reach_one_addr(reach);
|
||||||
|
|
|
@ -445,7 +445,7 @@ enum onion_type send_htlc_out(struct channel *out, u64 amount, u32 cltv,
|
||||||
payment_hash, onion_routing_packet, in);
|
payment_hash, onion_routing_packet, in);
|
||||||
tal_add_destructor(hout, destroy_hout_subd_died);
|
tal_add_destructor(hout, destroy_hout_subd_died);
|
||||||
|
|
||||||
/* We give it 30 seconds to commit htlc. */
|
/* Give channel 30 seconds to commit (first) htlc. */
|
||||||
if (!out->htlc_timeout)
|
if (!out->htlc_timeout)
|
||||||
out->htlc_timeout = new_reltimer(&out->peer->ld->timers,
|
out->htlc_timeout = new_reltimer(&out->peer->ld->timers,
|
||||||
out, time_from_sec(30),
|
out, time_from_sec(30),
|
||||||
|
|
|
@ -807,9 +807,10 @@ def test_htlc_send_timeout(node_factory, bitcoind):
|
||||||
# tries to ping before sending WIRE_COMMITMENT_SIGNED.
|
# tries to ping before sending WIRE_COMMITMENT_SIGNED.
|
||||||
time.sleep(30)
|
time.sleep(30)
|
||||||
inv = l3.rpc.invoice(123000, 'test_htlc_send_timeout', 'description')
|
inv = l3.rpc.invoice(123000, 'test_htlc_send_timeout', 'description')
|
||||||
try:
|
with pytest.raises(RpcError) as excinfo:
|
||||||
l1.rpc.pay(inv['bolt11'])
|
l1.rpc.pay(inv['bolt11'])
|
||||||
except RpcError as err:
|
|
||||||
|
err = excinfo.value
|
||||||
# Complaints it couldn't find route.
|
# Complaints it couldn't find route.
|
||||||
assert err.error['code'] == 205
|
assert err.error['code'] == 205
|
||||||
# Temporary channel failure
|
# Temporary channel failure
|
||||||
|
|
Loading…
Add table
Reference in a new issue