|
|
@ -1178,22 +1178,23 @@ bool channel_force_htlcs(struct channel *channel, |
|
|
|
struct htlc_map_iter it; |
|
|
|
|
|
|
|
if (tal_count(hstates) != tal_count(htlcs)) { |
|
|
|
status_debug("#hstates %zu != #htlcs %zu", |
|
|
|
status_broken("#hstates %zu != #htlcs %zu", |
|
|
|
tal_count(hstates), tal_count(htlcs)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
if (tal_count(fulfilled) != tal_count(fulfilled_sides)) { |
|
|
|
status_debug("#fulfilled sides %zu != #fulfilled %zu", |
|
|
|
status_broken("#fulfilled sides %zu != #fulfilled %zu", |
|
|
|
tal_count(fulfilled_sides), tal_count(fulfilled)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
if (tal_count(failed) != tal_count(failed_sides)) { |
|
|
|
status_debug("#failed sides %zu != #failed %zu", |
|
|
|
status_broken("#failed sides %zu != #failed %zu", |
|
|
|
tal_count(failed_sides), tal_count(failed)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
for (i = 0; i < tal_count(htlcs); i++) { |
|
|
|
enum channel_add_err e; |
|
|
|
struct htlc *htlc; |
|
|
@ -1215,7 +1216,7 @@ bool channel_force_htlcs(struct channel *channel, |
|
|
|
&htlcs[i].payment_hash, |
|
|
|
htlcs[i].onion_routing_packet, &htlc, false, NULL); |
|
|
|
if (e != CHANNEL_ERR_ADD_OK) { |
|
|
|
status_debug("%s HTLC %"PRIu64" failed error %u", |
|
|
|
status_broken("%s HTLC %"PRIu64" failed error %u", |
|
|
|
htlc_state_owner(hstates[i]) == LOCAL |
|
|
|
? "out" : "in", htlcs[i].id, e); |
|
|
|
return false; |
|
|
@ -1227,31 +1228,31 @@ bool channel_force_htlcs(struct channel *channel, |
|
|
|
fulfilled_sides[i], |
|
|
|
fulfilled[i].id); |
|
|
|
if (!htlc) { |
|
|
|
status_debug("Fulfill %s HTLC %"PRIu64" not found", |
|
|
|
status_broken("Fulfill %s HTLC %"PRIu64" not found", |
|
|
|
fulfilled_sides[i] == LOCAL ? "out" : "in", |
|
|
|
fulfilled[i].id); |
|
|
|
return false; |
|
|
|
} |
|
|
|
if (htlc->r) { |
|
|
|
status_debug("Fulfill %s HTLC %"PRIu64" already fulfilled", |
|
|
|
status_broken("Fulfill %s HTLC %"PRIu64" already fulfilled", |
|
|
|
fulfilled_sides[i] == LOCAL ? "out" : "in", |
|
|
|
fulfilled[i].id); |
|
|
|
return false; |
|
|
|
} |
|
|
|
if (htlc->fail) { |
|
|
|
status_debug("Fulfill %s HTLC %"PRIu64" already failed", |
|
|
|
status_broken("Fulfill %s HTLC %"PRIu64" already failed", |
|
|
|
fulfilled_sides[i] == LOCAL ? "out" : "in", |
|
|
|
fulfilled[i].id); |
|
|
|
return false; |
|
|
|
} |
|
|
|
if (htlc->failcode) { |
|
|
|
status_debug("Fulfill %s HTLC %"PRIu64" already fail %u", |
|
|
|
status_broken("Fulfill %s HTLC %"PRIu64" already fail %u", |
|
|
|
fulfilled_sides[i] == LOCAL ? "out" : "in", |
|
|
|
fulfilled[i].id, htlc->failcode); |
|
|
|
return false; |
|
|
|
} |
|
|
|
if (!htlc_has(htlc, HTLC_REMOVING)) { |
|
|
|
status_debug("Fulfill %s HTLC %"PRIu64" state %s", |
|
|
|
status_broken("Fulfill %s HTLC %"PRIu64" state %s", |
|
|
|
fulfilled_sides[i] == LOCAL ? "out" : "in", |
|
|
|
fulfilled[i].id, |
|
|
|
htlc_state_name(htlc->state)); |
|
|
@ -1266,31 +1267,31 @@ bool channel_force_htlcs(struct channel *channel, |
|
|
|
htlc = channel_get_htlc(channel, failed_sides[i], |
|
|
|
failed[i]->id); |
|
|
|
if (!htlc) { |
|
|
|
status_debug("Fail %s HTLC %"PRIu64" not found", |
|
|
|
status_broken("Fail %s HTLC %"PRIu64" not found", |
|
|
|
failed_sides[i] == LOCAL ? "out" : "in", |
|
|
|
failed[i]->id); |
|
|
|
return false; |
|
|
|
} |
|
|
|
if (htlc->r) { |
|
|
|
status_debug("Fail %s HTLC %"PRIu64" already fulfilled", |
|
|
|
status_broken("Fail %s HTLC %"PRIu64" already fulfilled", |
|
|
|
failed_sides[i] == LOCAL ? "out" : "in", |
|
|
|
failed[i]->id); |
|
|
|
return false; |
|
|
|
} |
|
|
|
if (htlc->fail) { |
|
|
|
status_debug("Fail %s HTLC %"PRIu64" already failed", |
|
|
|
status_broken("Fail %s HTLC %"PRIu64" already failed", |
|
|
|
failed_sides[i] == LOCAL ? "out" : "in", |
|
|
|
failed[i]->id); |
|
|
|
return false; |
|
|
|
} |
|
|
|
if (htlc->failcode) { |
|
|
|
status_debug("Fail %s HTLC %"PRIu64" already fail %u", |
|
|
|
status_broken("Fail %s HTLC %"PRIu64" already fail %u", |
|
|
|
failed_sides[i] == LOCAL ? "out" : "in", |
|
|
|
failed[i]->id, htlc->failcode); |
|
|
|
return false; |
|
|
|
} |
|
|
|
if (!htlc_has(htlc, HTLC_REMOVING)) { |
|
|
|
status_debug("Fail %s HTLC %"PRIu64" state %s", |
|
|
|
status_broken("Fail %s HTLC %"PRIu64" state %s", |
|
|
|
failed_sides[i] == LOCAL ? "out" : "in", |
|
|
|
fulfilled[i].id, |
|
|
|
htlc_state_name(htlc->state)); |
|
|
|