mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-04 17:55:36 +01:00
invoices/test: move payment address required global into test using it
This commit is contained in:
parent
d080d07a22
commit
94e434d2f1
2 changed files with 17 additions and 20 deletions
|
@ -1431,10 +1431,25 @@ func TestSettleInvoicePaymentAddrRequired(t *testing.T) {
|
||||||
|
|
||||||
require.Equal(t, subscription.PayHash(), &testInvoicePaymentHash)
|
require.Equal(t, subscription.PayHash(), &testInvoicePaymentHash)
|
||||||
|
|
||||||
|
invoice := &invpkg.Invoice{
|
||||||
|
Terms: invpkg.ContractTerm{
|
||||||
|
PaymentPreimage: &testInvoicePreimage,
|
||||||
|
Value: testInvoiceAmount,
|
||||||
|
Expiry: time.Hour,
|
||||||
|
Features: lnwire.NewFeatureVector(
|
||||||
|
lnwire.NewRawFeatureVector(
|
||||||
|
lnwire.TLVOnionPayloadOptional,
|
||||||
|
lnwire.PaymentAddrRequired,
|
||||||
|
),
|
||||||
|
lnwire.Features,
|
||||||
|
),
|
||||||
|
},
|
||||||
|
CreationDate: testInvoiceCreationDate,
|
||||||
|
}
|
||||||
// Add the invoice, which requires the MPP payload to always be
|
// Add the invoice, which requires the MPP payload to always be
|
||||||
// included due to its set of feature bits.
|
// included due to its set of feature bits.
|
||||||
addIdx, err := ctx.registry.AddInvoice(
|
addIdx, err := ctx.registry.AddInvoice(
|
||||||
testPayAddrReqInvoice, testInvoicePaymentHash,
|
invoice, testInvoicePaymentHash,
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, int(addIdx), 1)
|
require.Equal(t, int(addIdx), 1)
|
||||||
|
@ -1467,7 +1482,7 @@ func TestSettleInvoicePaymentAddrRequired(t *testing.T) {
|
||||||
// information, so it should be forced to the updateLegacy path then
|
// information, so it should be forced to the updateLegacy path then
|
||||||
// fail as a required feature bit exists.
|
// fail as a required feature bit exists.
|
||||||
resolution, err := ctx.registry.NotifyExitHopHtlc(
|
resolution, err := ctx.registry.NotifyExitHopHtlc(
|
||||||
testInvoicePaymentHash, testPayAddrReqInvoice.Terms.Value,
|
testInvoicePaymentHash, invoice.Terms.Value,
|
||||||
uint32(testCurrentHeight)+testInvoiceCltvDelta-1,
|
uint32(testCurrentHeight)+testInvoiceCltvDelta-1,
|
||||||
testCurrentHeight, getCircuitKey(10), hodlChan, testPayload,
|
testCurrentHeight, getCircuitKey(10), hodlChan, testPayload,
|
||||||
)
|
)
|
||||||
|
|
|
@ -131,24 +131,6 @@ var (
|
||||||
testInvoiceCreationDate = testTime
|
testInvoiceCreationDate = testTime
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
|
||||||
testPayAddrReqInvoice = &invpkg.Invoice{
|
|
||||||
Terms: invpkg.ContractTerm{
|
|
||||||
PaymentPreimage: &testInvoicePreimage,
|
|
||||||
Value: testInvoiceAmount,
|
|
||||||
Expiry: time.Hour,
|
|
||||||
Features: lnwire.NewFeatureVector(
|
|
||||||
lnwire.NewRawFeatureVector(
|
|
||||||
lnwire.TLVOnionPayloadOptional,
|
|
||||||
lnwire.PaymentAddrRequired,
|
|
||||||
),
|
|
||||||
lnwire.Features,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
CreationDate: testInvoiceCreationDate,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
func newTestChannelDB(t *testing.T, clock clock.Clock) (*channeldb.DB, error) {
|
func newTestChannelDB(t *testing.T, clock clock.Clock) (*channeldb.DB, error) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue