invoices/test: remove duplicate test invoice amount global

We have testInvoiceAmt and testInvoiceAmount with the same value.
This commit is contained in:
Carla Kirk-Cohen
2023-07-12 17:08:07 -04:00
parent 40f695743a
commit d080d07a22
2 changed files with 9 additions and 11 deletions

View File

@@ -299,7 +299,7 @@ func testCancelInvoice(t *testing.T, gc bool) {
// result in a cancel resolution. // result in a cancel resolution.
hodlChan := make(chan interface{}) hodlChan := make(chan interface{})
resolution, err := ctx.registry.NotifyExitHopHtlc( resolution, err := ctx.registry.NotifyExitHopHtlc(
testInvoicePaymentHash, testInvoiceAmt, testHtlcExpiry, testInvoicePaymentHash, testInvoiceAmount, testHtlcExpiry,
testCurrentHeight, getCircuitKey(0), hodlChan, testPayload, testCurrentHeight, getCircuitKey(0), hodlChan, testPayload,
) )
if err != nil { if err != nil {
@@ -850,7 +850,7 @@ func TestMppPayment(t *testing.T) {
} }
mppPayload := &mockPayload{ mppPayload := &mockPayload{
mpp: record.NewMPP(testInvoiceAmt, [32]byte{}), mpp: record.NewMPP(testInvoiceAmount, [32]byte{}),
} }
// Send htlc 1. // Send htlc 1.
@@ -949,7 +949,7 @@ func TestMppPaymentWithOverpayment(t *testing.T) {
} }
mppPayload := &mockPayload{ mppPayload := &mockPayload{
mpp: record.NewMPP(testInvoiceAmt, [32]byte{}), mpp: record.NewMPP(testInvoiceAmount, [32]byte{}),
} }
// We constrain overpayment amount to be [1,1000]. // We constrain overpayment amount to be [1,1000].
@@ -1236,7 +1236,7 @@ func testHeightExpiryWithRegistry(t *testing.T, numParts int, settle bool) {
payLoad := testPayload payLoad := testPayload
if numParts > 1 { if numParts > 1 {
payLoad = &mockPayload{ payLoad = &mockPayload{
mpp: record.NewMPP(testInvoiceAmt, [32]byte{}), mpp: record.NewMPP(testInvoiceAmount, [32]byte{}),
} }
} }
@@ -1338,7 +1338,7 @@ func TestMultipleSetHeightExpiry(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
mppPayload := &mockPayload{ mppPayload := &mockPayload{
mpp: record.NewMPP(testInvoiceAmt, [32]byte{}), mpp: record.NewMPP(testInvoiceAmount, [32]byte{}),
} }
// Send htlc 1. // Send htlc 1.
@@ -1507,7 +1507,7 @@ func TestSettleInvoicePaymentAddrRequiredOptionalGrace(t *testing.T) {
invoice := &invpkg.Invoice{ invoice := &invpkg.Invoice{
Terms: invpkg.ContractTerm{ Terms: invpkg.ContractTerm{
PaymentPreimage: &testInvoicePreimage, PaymentPreimage: &testInvoicePreimage,
Value: testInvoiceAmt, Value: testInvoiceAmount,
Expiry: time.Hour, Expiry: time.Hour,
Features: lnwire.NewFeatureVector( Features: lnwire.NewFeatureVector(
lnwire.NewRawFeatureVector( lnwire.NewRawFeatureVector(
@@ -1555,7 +1555,7 @@ func TestSettleInvoicePaymentAddrRequiredOptionalGrace(t *testing.T) {
// no problem as we should allow these existing invoices to be settled. // no problem as we should allow these existing invoices to be settled.
hodlChan := make(chan interface{}, 1) hodlChan := make(chan interface{}, 1)
resolution, err := ctx.registry.NotifyExitHopHtlc( resolution, err := ctx.registry.NotifyExitHopHtlc(
testInvoicePaymentHash, testInvoiceAmt, testInvoicePaymentHash, testInvoiceAmount,
testHtlcExpiry, testCurrentHeight, testHtlcExpiry, testCurrentHeight,
getCircuitKey(10), hodlChan, testPayload, getCircuitKey(10), hodlChan, testPayload,
) )

View File

@@ -132,12 +132,10 @@ var (
) )
var ( var (
testInvoiceAmt = lnwire.MilliSatoshi(100000)
testPayAddrReqInvoice = &invpkg.Invoice{ testPayAddrReqInvoice = &invpkg.Invoice{
Terms: invpkg.ContractTerm{ Terms: invpkg.ContractTerm{
PaymentPreimage: &testInvoicePreimage, PaymentPreimage: &testInvoicePreimage,
Value: testInvoiceAmt, Value: testInvoiceAmount,
Expiry: time.Hour, Expiry: time.Hour,
Features: lnwire.NewFeatureVector( Features: lnwire.NewFeatureVector(
lnwire.NewRawFeatureVector( lnwire.NewRawFeatureVector(
@@ -249,7 +247,7 @@ func getCircuitKey(htlcID uint64) invpkg.CircuitKey {
func newInvoice(t *testing.T, hodl bool) *invpkg.Invoice { func newInvoice(t *testing.T, hodl bool) *invpkg.Invoice {
invoice := &invpkg.Invoice{ invoice := &invpkg.Invoice{
Terms: invpkg.ContractTerm{ Terms: invpkg.ContractTerm{
Value: testInvoiceAmt, Value: testInvoiceAmount,
Expiry: time.Hour, Expiry: time.Hour,
Features: testFeatures.Clone(), Features: testFeatures.Clone(),
}, },