lnrpc+itest: expose AMP fields on InvoiceHTLC
We also test that legacy keysend payments are promoted to AMP payments on the receiver-sdie by asserting basic properties of the fields returned via the rpc.
This commit is contained in:
6 files changed
+645
-419
No files matched your search
@@ -15,6 +15,7 @@ import (
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
"github.com/lightningnetwork/lnd/record"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func testSingleHopInvoice(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
@@ -162,6 +163,21 @@ func testSingleHopInvoice(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
t.Fatalf(err.Error())
|
||||
}
|
||||
|
||||
// Assert that the invoice has the proper AMP fields set, since the
|
||||
// legacy keysend payment should have been promoted into an AMP payment
|
||||
// internally.
|
||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
||||
keysendInvoice, err := net.Bob.LookupInvoice(
|
||||
ctxt, &lnrpc.PaymentHash{
|
||||
RHash: keySendHash[:],
|
||||
},
|
||||
)
|
||||
require.NoError(t.t, err)
|
||||
require.Equal(t.t, 1, len(keysendInvoice.Htlcs))
|
||||
htlc := keysendInvoice.Htlcs[0]
|
||||
require.Equal(t.t, uint64(0), htlc.MppTotalAmtMsat)
|
||||
require.Nil(t.t, htlc.Amp)
|
||||
|
||||
// Now create an invoice and specify routing hints.
|
||||
// We will test that the routing hints are encoded properly.
|
||||
hintChannel := lnwire.ShortChannelID{BlockHeight: 10}
|
||||
|
||||
Reference in new issue
Block a user