alexbosworth / lightning

Lightning client methods
MIT License
127 stars 33 forks source link

Passing description_hash without description to `createHodlInvoice` does not set the invoice description_hash #147

Open steliosrammos opened 1 year ago

steliosrammos commented 1 year ago

This does not set the description_hash:.

 const invoice = await createHodlInvoice({
        lnd,
        id: '540c398ff10942d362386c648d0b6f918df1fe596c6953873779b6cdf71c4f25',
        description_hash: 'd97653a83596a42e369ceed4e480609f51377e1befa8c65852adecbc0cfca0e6',
        tokens: 10000,
    });

This would set the description_hash to d97653a83596a42e369ceed4e480609f51377e1befa8c65852adecbc0cfca0e6, although it is not the sha256() of test.

 const invoice = await createHodlInvoice({
        lnd,
        id: '540c398ff10942d362386c648d0b6f918df1fe596c6953873779b6cdf71c4f25',
        description: 'test',
        description_hash: 'd97653a83596a42e369ceed4e480609f51377e1befa8c65852adecbc0cfca0e6',
        tokens: 10000,
    });

Expected Behaviour

  1. The first segment would set the description_hash to d97653a83596a42e369ceed4e480609f51377e1befa8c65852adecbc0cfca0e6
  2. The second segment would throw an error (?)
alexbosworth commented 1 year ago

LND doesn't let you set both, it will silently drop one

alexbosworth commented 1 year ago

Hmm hold invoice I thought it was regular, I can take a look

alexbosworth commented 1 year ago

ok yeah it looks like it works the same, this is an LND behavior when you pass both

steliosrammos commented 1 year ago

What about the first case where only the description_hash is passed, without a description?

alexbosworth commented 1 year ago

Yeah that works