mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-04 14:54:26 +01:00
lightningd: handle the case where the db contains a resolved HTLC without a preimage.
We need to handle this case (old db) before the next commit, which actually fixes it. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -1704,7 +1704,7 @@ void htlcs_reconnect(struct lightningd *ld,
|
||||
|
||||
/* For fulfilled HTLCs, we fulfill incoming before outgoing is
|
||||
* completely resolved, so it's possible that we don't find
|
||||
* the incoming. FIXME: iff hout->preimage! */
|
||||
* the incoming. */
|
||||
for (hin = htlc_in_map_first(htlcs_in, &ini); hin;
|
||||
hin = htlc_in_map_next(htlcs_in, &ini)) {
|
||||
if (hout->origin_htlc_id == hin->dbid) {
|
||||
@@ -1716,6 +1716,13 @@ void htlcs_reconnect(struct lightningd *ld,
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hout->in && !hout->preimage) {
|
||||
/* FIXME: COMPAT_V061 only */
|
||||
log_broken(ld->log,
|
||||
"Missing preimage for orphaned HTLC; replacing with zeros");
|
||||
hout->preimage = talz(hout, struct preimage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1333,7 +1333,6 @@ def test_restart_multi_htlc_rexmit(node_factory, bitcoind, executor):
|
||||
wait_for(lambda: [p['status'] for p in l1.rpc.listpayments()['payments']] == ['complete', 'complete'])
|
||||
|
||||
|
||||
@pytest.mark.xfail(strict=True)
|
||||
@unittest.skipIf(not DEVELOPER, "needs dev-disconnect")
|
||||
def test_fulfill_incoming_first(node_factory, bitcoind):
|
||||
"""Test that we handle the case where we completely resolve incoming htlc
|
||||
|
||||
Reference in New Issue
Block a user