loop icon indicating copy to clipboard operation
loop copied to clipboard

Failed loop no refund - Required fee exceeds max miner fee

Open ghost opened this issue 4 years ago • 8 comments

Spun up a new raspibliz node over the weekend, did a few loops successfully but there was one that failed after I paid the 30k server fee so just wanting to report it and whether or not there was something wrong that happened on my end that justified not receiving that back.

Some info I've pulled up with some redactions, happy to DM someone with further info if they need it.

The info from the loop out:

        {
            "amt": "5000000",
            "id": "d7df7a7b5db068bbe3ed2ad82c37c4438133bbdc0173af7af93c3185a4b7d335",
            "id_bytes": "d7df7a7b5db068bbe3ed2ad82c37c4438133bbdc0173af7af93c3185a4b7d335",
            "type": "LOOP_OUT",
            "state": "FAILED",
            "initiation_time": "1601300805672211546",
            "last_update_time": "1601368703669979320",
            "htlc_address": "[redacted]",
            "htlc_address_p2wsh": "[redacted]",
            "htlc_address_np2wsh": "",
            "cost_server": "30000",
            "cost_onchain": "0",
            "cost_offchain": "2"
        }

The info from the paid invoice

{
  "payment_hash": "[redacted]",
  "value": "30000",
  "creation_date": "1601300805",
  "fee": "2",
  "payment_preimage": "[redacted]",
  "value_sat": "30000",
  "value_msat": "30000000",
  "payment_request": "[redacted]",
  "status": "SUCCEEDED",
  "fee_sat": "2",
  "fee_msat": "2030",
  "creation_time_ns": "1601300805706402129",
  "htlcs": [
    {
      "status": "SUCCEEDED",
      "route": {
        "total_time_lock": 650669,
        "total_fees": "2",
        "total_amt": "30002",
        "hops": [
          {
            "chan_id": "[redacted]",
            "chan_capacity": "5868200",
            "amt_to_forward": "30001",
            "fee": "1",
            "expiry": 650629,
            "amt_to_forward_msat": "30001000",
            "fee_msat": "1030",
            "pub_key": "[redacted]",
            "tlv_payload": true,
            "mpp_record": null,
            "custom_records": {}
          },
          {
            "chan_id": "[redacted]",
            "chan_capacity": "45288327",
            "amt_to_forward": "30000",
            "fee": "1",
            "expiry": 650589,
            "amt_to_forward_msat": "30000000",
            "fee_msat": "1000",
            "pub_key": "[redacted]",
            "tlv_payload": true,
            "mpp_record": null,
            "custom_records": {}
          },
          {
            "chan_id": "[redacted]",
            "chan_capacity": "30000",
            "amt_to_forward": "30000",
            "fee": "0",
            "expiry": 650589,
            "amt_to_forward_msat": "30000000",
            "fee_msat": "0",
            "pub_key": "[redacted]",
            "tlv_payload": true,
            "mpp_record": {
              "payment_addr": "[redacted]",
              "total_amt_msat": "30000000"
            },
            "custom_records": {}
          }
        ],
        "total_fees_msat": "2030",
        "total_amt_msat": "30002030"
      },
      "attempt_time_ns": "1601300806195118150",
      "resolve_time_ns": "1601304887448353749",
      "failure": null
    }
  ],
  "payment_index": "12",
  "failure_reason": "FAILURE_REASON_NONE"
}

Loop version: loop version 0.6.5-beta commit= LND version: lncli version 0.10.4-beta commit=v0.10.4-beta

Only thing I'm really getting from journalctl logs are

sudo journalctl -u loopd -b --no-pager -n20
-- Logs begin at Tue 2020-09-29 21:33:38 BST, end at Wed 2020-09-30 04:12:36 BST. --
Sep 30 02:55:11 raspberrypi loopd[6084]: 2020-09-30 02:55:11.425 [INF] LOOPD: Monitor request received
Sep 30 03:26:06 raspberrypi loopd[6084]: 2020-09-30 03:26:06.500 [INF] LOOP: Offchain swap destination: 03fb2a0ca79c005f493f1faa83071d3a937cf220d4051dc48b8fe3a087879cf14a

But I have this warning Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable. so I don't think it's gone as far back as when the loop was.

Edit: Found the logs, the interesting bit is here:

2020-09-29 08:46:36.378 [WRN] LOOP: d7df7a Required fee 0.00007333 BTC exceeds max miner fee of 0.00002426 BTC
2020-09-29 08:46:36.379 [WRN] LOOP: d7df7a Not revealing preimage
2020-09-29 08:51:29.297 [WRN] LOOP: d7df7a Required fee 0.00007333 BTC exceeds max miner fee of 0.00002426 BTC
2020-09-29 08:51:29.299 [WRN] LOOP: d7df7a Not revealing preimage
2020-09-29 09:13:08.611 [WRN] LOOP: d7df7a Required fee 0.00007333 BTC exceeds max miner fee of 0.00002426 BTC
2020-09-29 09:13:08.611 [WRN] LOOP: d7df7a Not revealing preimage
2020-09-29 09:15:00.702 [WRN] LOOP: d7df7a Required fee 0.00007678 BTC exceeds max miner fee of 0.00002426 BTC
2020-09-29 09:15:00.702 [WRN] LOOP: d7df7a Not revealing preimage
2020-09-29 09:15:29.007 [WRN] LOOP: d7df7a Required fee 0.00007678 BTC exceeds max miner fee of 0.00002426 BTC
2020-09-29 09:15:29.007 [WRN] LOOP: d7df7a Not revealing preimage
2020-09-29 09:27:31.608 [WRN] LOOP: d7df7a Required fee 0.00007678 BTC exceeds max miner fee of 0.00002426 BTC
2020-09-29 09:27:31.608 [WRN] LOOP: d7df7a Not revealing preimage
2020-09-29 09:28:46.893 [WRN] LOOP: d7df7a Required fee 0.00007678 BTC exceeds max miner fee of 0.00002426 BTC
2020-09-29 09:28:46.893 [WRN] LOOP: d7df7a Not revealing preimage
2020-09-29 09:33:11.118 [WRN] LOOP: d7df7a Required fee 0.00007678 BTC exceeds max miner fee of 0.00002426 BTC
2020-09-29 09:33:11.118 [WRN] LOOP: d7df7a Not revealing preimage
2020-09-29 09:38:22.925 [INF] LOOP: d7df7a Payment d7df7a7b5db068bbe3ed2ad82c37c4438133bbdc0173af7af93c3185a4b7d335: state=IN_FLIGHT, inflight_htlcs=0, inflight_amt=0 mSAT
2020-09-29 09:38:22.955 [INF] LOOP: d7df7a Payment d7df7a7b5db068bbe3ed2ad82c37c4438133bbdc0173af7af93c3185a4b7d335: state=FAILED
2020-09-29 09:38:23.664 [INF] LOOP: d7df7a Htlc spend by tx: [redacted]
2020-09-29 09:38:23.668 [INF] LOOP: d7df7a Wait for server pulling off-chain payment(s)
2020-09-29 09:38:23.668 [INF] LOOP: d7df7a Swap payment failed: payment failed
2020-09-29 09:38:23.669 [INF] LOOP: d7df7a Swap completed: FailSweepTimeout (final cost: server 0.0003 BTC, onchain 0 BTC, offchain 0.00000002 BTC)
2020-09-29 09:38:23.694 [INF] LOOP: d7df7a Loop out swap state: FailSweepTimeout

It appears as though it thought the on chain redemption fee was too high? 7000 sats is still pretty low, would have happily paid that instead of losing my 30k. Perhaps the limit should be the prepaid amount at least given that that's how much I'll lose if I don't redeem. Is that a configuration on my end that I need to raise?

ghost avatar Sep 30 '20 03:09 ghost

I think the problem is here:

https://github.com/lightninglabs/loop/blob/98bdbcddfbf64d1ee31e5790df4893ca874a52fb/loopout.go#L913-L928

Should it do a additional fee check if the expiration is close and the fee is less than the prepaid server fee? The client is out the prepaid amount no matter what, so if the fee is less than the prepaid amount it should go through.

Something like:

if fee > s.MaxMinerFee && (s.CltvExpiry-s.height <= DefaultSweepConfTargetDelta && fee > s.prepayInvoiceAmt) {
    s.log.Warnf("Required fee %v exceeds max miner fee of %v",
			fee, s.MaxMinerFee)
...
}

ghost avatar Oct 03 '20 23:10 ghost

Should it do a additional fee check if the expiration is close and the fee is less than the prepaid server fee? The client is out the prepaid amount no matter what, so if the fee is less than the prepaid amount it should go through.

Yeah I definitely think this heuristic is worth reconsidering

Potentially you could say that if there were to be a large fee gap between when you started a swap and when it came time to sweep, so much so that you might potentially want to just give up on the sweep altogether (imagine if the sweep fee went to $100 and the prepay were $1, oof why would I even do the sweep?)

All things considered though, I don't think this is necessarily the right strategy to minimize the cost of the swap

alexbosworth avatar Oct 03 '20 23:10 alexbosworth

Is there a way to manually force loop to accept a higher miner fee for an existing loop? I have one that's only off by a few sats and would rather not pay the 30k fee if it expires.

mb300sd avatar Jul 28 '21 20:07 mb300sd

Is there a way to manually force loop to accept a higher miner fee for an existing loop? I have one that's only off by a few sats and would rather not pay the 30k fee if it expires.

If it's only off by a few sats total there would be an issue using a higher fee than the fee that was already broadcast because of Bitcoin p2p network relay policy rules

You could create a separate issue though for more fine grained controls around fee bumping, as it is now it will just do it automatically based on your conf target

alexbosworth avatar Jul 28 '21 21:07 alexbosworth

I don't believe anything has been broadcast yet, the state it's stuck in is

Required fee 0.00000365 BTC exceeds max miner fee of 0.00000325 BTC Not revealing preimage

From what I understand, the server has confirmed it's transaction, however my node is not claiming the btc over 40 sats.

mb300sd avatar Jul 28 '21 21:07 mb300sd

Yeah I would make an issue then, I think it should probably reveal it in this case

alexbosworth avatar Jul 28 '21 21:07 alexbosworth

I think I managed to solve it by temporarily changing my lnd's fee estimate to economical from conservative.

Should I make a second issue? It seems like the same issue as the original poster was having.

mb300sd avatar Jul 28 '21 23:07 mb300sd

I agree, if the difference is (much?) smaller than the 30k server fee, it would be nice to be able to get this through.

The question is: what would an acceptable value be? <30k? Or smaller? Or should there be some way to ask the user for confirmation in this case?

ibz avatar Nov 22 '21 14:11 ibz