diff --git a/lightningd/peer_htlcs.c b/lightningd/peer_htlcs.c index 535d0a01c..ffff21ca6 100644 --- a/lightningd/peer_htlcs.c +++ b/lightningd/peer_htlcs.c @@ -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); + } } } diff --git a/tests/test_connection.py b/tests/test_connection.py index eab7987b5..680399131 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -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