Open eNzyOfficial opened 1 year ago
nm i see the issue
what happens if you use mtokens instead of tokens? it works ok?
It doesn't, it throws the following:
Error: UnexpectedDifferingMtokensAndTokens
at module.exports (/.../node_modules/lightning/bolt00/payment_amounts.js:71:13)
at asyncAuto.params (/.../node_modules/lightning/lnd_methods/offchain/subscribe_to_pay.js:352:23)
at runTask (/.../node_modules/async/auto.js:293:13)
at /.../node_modules/async/auto.js:233:31
at processQueue (/.../node_modules/async/auto.js:243:13)
at taskComplete (/.../node_modules/async/auto.js:259:9)
at /.../node_modules/async/auto.js:286:17
at /.../node_modules/async/internal/onlyOnce.js:12:16
at asyncAuto.maxCltvDelta (/.../node_modules/lightning/lnd_methods/offchain/subscribe_to_pay.js:331:16)
at runTask (/.../node_modules/async/auto.js:293:13)
I mean if you use the mtokens and tokens together like pass both that you get from decodePaymentRequest
Same error:
const { lnd } = authenticatedLndGrpc({
cert,
macaroon,
socket
})
const request = 'lnbcrt50u...'
const { destination, tokens } = await decodePaymentRequest({
request,
lnd
})
const isPayable = await isDestinationPayable({
destination,
tokens,
mtokens: tokens,
lnd
})
EDIT: Nevermind I'm an idiot, forgot to convert tokens to mtokens first
sorry i mean decodePaymentRequest will return mtokens as well as tokens
so
const { destination, mtokens } = await decodePaymentRequest({
const isPayable = await isDestinationPayable({
destination,
mtokens,
lnd
})
If I use only mtokens
I'm still getting UnexpectedDifferingMtokensAndTokens
inside payment_amounts.js
I add console.log(tokensAsMtokens, args.mtokens)
which returns 1000 500000
if I include both mtokens
and tokens
in the initial call, it works fine.
const { destination, tokens, mtokens } = await decodePaymentRequest({
request,
lnd
})
const isPayable = await isDestinationPayable({
destination,
mtokens,
tokens,
lnd
})
ok sounds like something is wrong there then, can take a look
it should work with tokens alone and mtokens alone
should be corrected now
https://github.com/alexbosworth/lightning/blob/37837f21aaeec005b16fbc549fc706384e5379e7/lnd_methods/offchain/is_destination_payable.js#L59
Can you confirm the above logic is correct?
If I pass in
tokens
it's always null andsubscribeToPayViaDetails
function fails withExpectedTokenAmountToPayInPaymentDetails
.Example: