alexbosworth / ln-service

Node.js interface to LND
MIT License
319 stars 60 forks source link

probeForRoute issue #131

Closed nicolasburtey closed 4 years ago

nicolasburtey commented 4 years ago

I'm calling ProbeForRoute with the following parameters:

      destination: '0291f76e4d8395fad2a58635d47d3f68cb8421fbadc47c76115d48a337c7df397d',
      lnd: {
        autopilot: ServiceClient
...
...
      },
      tokens: 1000,
      routes: [],
      payment: '54cef7f9591d443230345bb8a79176d0508f05da1c703ace97c108b8a8b1d232',
      cltv_delta: 40,
      features: [
        { bit: 9, is_known: true, is_required: false, type: 'tlv_onion' },
        {
          bit: 15,
          is_known: true,
          is_required: false,
          type: 'payment_identifier'
        },
        {
          bit: 17,
          is_known: true,
          is_required: false,
          type: 'multipath_payments_v0'
        }
      ],
      max_fee: 20
    }

and I get the following err:

    err: [
      503,
      "UnexpectedErrorWhenPayingViaRoute",
      {
        "err": {
          "code": 2,
          "metadata": {
            "_internal_repr": {},
            "flags": 0
          },
          "details": "missing total_msat"
        }
      }
    ]

on a lnd 0.11-beta.

If I don't give payment as an argument, then I don't have this error.

After reading the lightning-rfc, It seems payment and total_msat are related for mpp. but I guess total_msat should be set automatically when payment is passed as an argument?

alexbosworth commented 4 years ago

You must pass total_mtokens

nicolasburtey commented 4 years ago

ok. that works. thanks!

nicolasburtey commented 4 years ago

actually another question. isn't that mtokens should be 1000x tokens?

I have back ExpectedEqualValuesForTokensAndMtokens

alexbosworth commented 4 years ago

actually another question. isn't that mtokens should be 1000x tokens?

I have back ExpectedEqualValuesForTokensAndMtokens

If there is an issue I would only pass one of the values, you do not need to pass both

nicolasburtey commented 4 years ago

ok

nicolasburtey commented 4 years ago

actually, if I have:

mtokens (only), I get: 400,ExpectedTokensValueToProbeForRoute tokens (only), I get: missing total_msat both: ExpectedEqualValuesForTokensAndMtokens (I have done mtokens: tokens * 1000)

alexbosworth commented 4 years ago

Sorry, total_mtokens is separate, you must set that

But for mtokens vs tokens, only set one of those

So for tokens, set tokens=tokens and total_mtokens=mtokens

alexbosworth commented 4 years ago

Ah you're right there is an issue here

alexbosworth commented 4 years ago

I pushed a change to allow specifying mtokens only

You'll still want to specify total mtokens separately, this is for scenarios where the route is only one path of multiple, the total should be the sum of all, the mtokens is the individual path

nicolasburtey commented 4 years ago

I've upgraded to the last version. Still running into some issue. I'm setting both: mtokens, total_mtokens and payment and I have this error:

    err: [
      503,
      "UnexpectedErrorWhenPayingViaRoute",
      {
        "err": {
          "code": 2,
          "metadata": {
            "_internal_repr": {},
            "flags": 0
          },
          "details": "missing total_msat"
        }
      }
    ]
alexbosworth commented 4 years ago

OK I will take a look

alexbosworth commented 4 years ago

This is a new issue where total_mtokens wasn't being passed along - can you try master and see if it is fixed now?

nicolasburtey commented 4 years ago

this works. thanks!