mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-28 06:32:18 +02:00
multi: pass UpdateAddHtlc
message custom records to invoice modifier
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
"github.com/lightningnetwork/lnd/record"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
@@ -37,98 +38,147 @@ func TestUpdateHTLC(t *testing.T) {
|
||||
{
|
||||
name: "MPP accept",
|
||||
input: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
AMP: nil,
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: nil,
|
||||
},
|
||||
invState: ContractAccepted,
|
||||
setID: nil,
|
||||
output: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
AMP: nil,
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: nil,
|
||||
},
|
||||
expErr: nil,
|
||||
},
|
||||
{
|
||||
name: "MPP accept, copy custom records",
|
||||
input: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: record.CustomSet{
|
||||
0x01: []byte{0x02},
|
||||
0xffff: []byte{0x04, 0x05, 0x06},
|
||||
},
|
||||
WireCustomRecords: lnwire.CustomRecords{
|
||||
0x010101: []byte{0x02, 0x03},
|
||||
0xffffff: []byte{0x44, 0x55, 0x66},
|
||||
},
|
||||
AMP: nil,
|
||||
},
|
||||
invState: ContractAccepted,
|
||||
setID: nil,
|
||||
output: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: record.CustomSet{
|
||||
0x01: []byte{0x02},
|
||||
0xffff: []byte{0x04, 0x05, 0x06},
|
||||
},
|
||||
WireCustomRecords: lnwire.CustomRecords{
|
||||
0x010101: []byte{0x02, 0x03},
|
||||
0xffffff: []byte{0x44, 0x55, 0x66},
|
||||
},
|
||||
AMP: nil,
|
||||
},
|
||||
expErr: nil,
|
||||
},
|
||||
{
|
||||
name: "MPP settle",
|
||||
input: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
AMP: nil,
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: nil,
|
||||
},
|
||||
invState: ContractSettled,
|
||||
setID: nil,
|
||||
output: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateSettled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
AMP: nil,
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateSettled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: nil,
|
||||
},
|
||||
expErr: nil,
|
||||
},
|
||||
{
|
||||
name: "MPP cancel",
|
||||
input: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
AMP: nil,
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: nil,
|
||||
},
|
||||
invState: ContractCanceled,
|
||||
setID: nil,
|
||||
output: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateCanceled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
AMP: nil,
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateCanceled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: nil,
|
||||
},
|
||||
expErr: nil,
|
||||
},
|
||||
{
|
||||
name: "AMP accept missing preimage",
|
||||
input: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: &InvoiceHtlcAMPData{
|
||||
Record: *ampRecord,
|
||||
Hash: hash,
|
||||
@@ -138,14 +188,15 @@ func TestUpdateHTLC(t *testing.T) {
|
||||
invState: ContractAccepted,
|
||||
setID: &setID,
|
||||
output: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: &InvoiceHtlcAMPData{
|
||||
Record: *ampRecord,
|
||||
Hash: hash,
|
||||
@@ -157,14 +208,15 @@ func TestUpdateHTLC(t *testing.T) {
|
||||
{
|
||||
name: "AMP accept invalid preimage",
|
||||
input: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: &InvoiceHtlcAMPData{
|
||||
Record: *ampRecord,
|
||||
Hash: hash,
|
||||
@@ -174,14 +226,15 @@ func TestUpdateHTLC(t *testing.T) {
|
||||
invState: ContractAccepted,
|
||||
setID: &setID,
|
||||
output: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: &InvoiceHtlcAMPData{
|
||||
Record: *ampRecord,
|
||||
Hash: hash,
|
||||
@@ -193,14 +246,15 @@ func TestUpdateHTLC(t *testing.T) {
|
||||
{
|
||||
name: "AMP accept valid preimage",
|
||||
input: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: &InvoiceHtlcAMPData{
|
||||
Record: *ampRecord,
|
||||
Hash: hash,
|
||||
@@ -210,14 +264,15 @@ func TestUpdateHTLC(t *testing.T) {
|
||||
invState: ContractAccepted,
|
||||
setID: &setID,
|
||||
output: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: &InvoiceHtlcAMPData{
|
||||
Record: *ampRecord,
|
||||
Hash: hash,
|
||||
@@ -229,14 +284,15 @@ func TestUpdateHTLC(t *testing.T) {
|
||||
{
|
||||
name: "AMP accept valid preimage different htlc set",
|
||||
input: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: &InvoiceHtlcAMPData{
|
||||
Record: *ampRecord,
|
||||
Hash: hash,
|
||||
@@ -246,14 +302,15 @@ func TestUpdateHTLC(t *testing.T) {
|
||||
invState: ContractAccepted,
|
||||
setID: &diffSetID,
|
||||
output: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: &InvoiceHtlcAMPData{
|
||||
Record: *ampRecord,
|
||||
Hash: hash,
|
||||
@@ -265,14 +322,15 @@ func TestUpdateHTLC(t *testing.T) {
|
||||
{
|
||||
name: "AMP settle missing preimage",
|
||||
input: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: &InvoiceHtlcAMPData{
|
||||
Record: *ampRecord,
|
||||
Hash: hash,
|
||||
@@ -282,14 +340,15 @@ func TestUpdateHTLC(t *testing.T) {
|
||||
invState: ContractSettled,
|
||||
setID: &setID,
|
||||
output: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: &InvoiceHtlcAMPData{
|
||||
Record: *ampRecord,
|
||||
Hash: hash,
|
||||
@@ -301,14 +360,15 @@ func TestUpdateHTLC(t *testing.T) {
|
||||
{
|
||||
name: "AMP settle invalid preimage",
|
||||
input: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: &InvoiceHtlcAMPData{
|
||||
Record: *ampRecord,
|
||||
Hash: hash,
|
||||
@@ -318,14 +378,15 @@ func TestUpdateHTLC(t *testing.T) {
|
||||
invState: ContractSettled,
|
||||
setID: &setID,
|
||||
output: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: &InvoiceHtlcAMPData{
|
||||
Record: *ampRecord,
|
||||
Hash: hash,
|
||||
@@ -337,14 +398,15 @@ func TestUpdateHTLC(t *testing.T) {
|
||||
{
|
||||
name: "AMP settle valid preimage",
|
||||
input: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: &InvoiceHtlcAMPData{
|
||||
Record: *ampRecord,
|
||||
Hash: hash,
|
||||
@@ -354,14 +416,15 @@ func TestUpdateHTLC(t *testing.T) {
|
||||
invState: ContractSettled,
|
||||
setID: &setID,
|
||||
output: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateSettled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateSettled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: &InvoiceHtlcAMPData{
|
||||
Record: *ampRecord,
|
||||
Hash: hash,
|
||||
@@ -377,14 +440,15 @@ func TestUpdateHTLC(t *testing.T) {
|
||||
// remain in the accepted state.
|
||||
name: "AMP settle valid preimage different htlc set",
|
||||
input: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: &InvoiceHtlcAMPData{
|
||||
Record: *ampRecord,
|
||||
Hash: hash,
|
||||
@@ -394,14 +458,15 @@ func TestUpdateHTLC(t *testing.T) {
|
||||
invState: ContractSettled,
|
||||
setID: &diffSetID,
|
||||
output: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: &InvoiceHtlcAMPData{
|
||||
Record: *ampRecord,
|
||||
Hash: hash,
|
||||
@@ -413,14 +478,15 @@ func TestUpdateHTLC(t *testing.T) {
|
||||
{
|
||||
name: "accept invoice htlc already settled",
|
||||
input: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testAlreadyNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateSettled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testAlreadyNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateSettled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: &InvoiceHtlcAMPData{
|
||||
Record: *ampRecord,
|
||||
Hash: hash,
|
||||
@@ -430,14 +496,15 @@ func TestUpdateHTLC(t *testing.T) {
|
||||
invState: ContractAccepted,
|
||||
setID: &setID,
|
||||
output: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testAlreadyNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateSettled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testAlreadyNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateSettled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: &InvoiceHtlcAMPData{
|
||||
Record: *ampRecord,
|
||||
Hash: hash,
|
||||
@@ -449,14 +516,15 @@ func TestUpdateHTLC(t *testing.T) {
|
||||
{
|
||||
name: "cancel invoice htlc already settled",
|
||||
input: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testAlreadyNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateSettled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testAlreadyNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateSettled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: &InvoiceHtlcAMPData{
|
||||
Record: *ampRecord,
|
||||
Hash: hash,
|
||||
@@ -466,14 +534,15 @@ func TestUpdateHTLC(t *testing.T) {
|
||||
invState: ContractCanceled,
|
||||
setID: &setID,
|
||||
output: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testAlreadyNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateSettled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testAlreadyNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateSettled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: &InvoiceHtlcAMPData{
|
||||
Record: *ampRecord,
|
||||
Hash: hash,
|
||||
@@ -485,14 +554,15 @@ func TestUpdateHTLC(t *testing.T) {
|
||||
{
|
||||
name: "settle invoice htlc already settled",
|
||||
input: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testAlreadyNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateSettled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testAlreadyNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateSettled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: &InvoiceHtlcAMPData{
|
||||
Record: *ampRecord,
|
||||
Hash: hash,
|
||||
@@ -502,14 +572,15 @@ func TestUpdateHTLC(t *testing.T) {
|
||||
invState: ContractSettled,
|
||||
setID: &setID,
|
||||
output: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testAlreadyNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateSettled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testAlreadyNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateSettled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: &InvoiceHtlcAMPData{
|
||||
Record: *ampRecord,
|
||||
Hash: hash,
|
||||
@@ -521,14 +592,15 @@ func TestUpdateHTLC(t *testing.T) {
|
||||
{
|
||||
name: "cancel invoice",
|
||||
input: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: time.Time{},
|
||||
Expiry: 40,
|
||||
State: HtlcStateAccepted,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: &InvoiceHtlcAMPData{
|
||||
Record: *ampRecord,
|
||||
Hash: hash,
|
||||
@@ -538,14 +610,15 @@ func TestUpdateHTLC(t *testing.T) {
|
||||
invState: ContractCanceled,
|
||||
setID: &setID,
|
||||
output: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateCanceled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateCanceled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: &InvoiceHtlcAMPData{
|
||||
Record: *ampRecord,
|
||||
Hash: hash,
|
||||
@@ -557,14 +630,15 @@ func TestUpdateHTLC(t *testing.T) {
|
||||
{
|
||||
name: "accept invoice htlc already canceled",
|
||||
input: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testAlreadyNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateCanceled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testAlreadyNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateCanceled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: &InvoiceHtlcAMPData{
|
||||
Record: *ampRecord,
|
||||
Hash: hash,
|
||||
@@ -574,14 +648,15 @@ func TestUpdateHTLC(t *testing.T) {
|
||||
invState: ContractAccepted,
|
||||
setID: &setID,
|
||||
output: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testAlreadyNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateCanceled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testAlreadyNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateCanceled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: &InvoiceHtlcAMPData{
|
||||
Record: *ampRecord,
|
||||
Hash: hash,
|
||||
@@ -593,14 +668,15 @@ func TestUpdateHTLC(t *testing.T) {
|
||||
{
|
||||
name: "cancel invoice htlc already canceled",
|
||||
input: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testAlreadyNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateCanceled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testAlreadyNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateCanceled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: &InvoiceHtlcAMPData{
|
||||
Record: *ampRecord,
|
||||
Hash: hash,
|
||||
@@ -610,14 +686,15 @@ func TestUpdateHTLC(t *testing.T) {
|
||||
invState: ContractCanceled,
|
||||
setID: &setID,
|
||||
output: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testAlreadyNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateCanceled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testAlreadyNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateCanceled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: &InvoiceHtlcAMPData{
|
||||
Record: *ampRecord,
|
||||
Hash: hash,
|
||||
@@ -629,14 +706,15 @@ func TestUpdateHTLC(t *testing.T) {
|
||||
{
|
||||
name: "settle invoice htlc already canceled",
|
||||
input: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testAlreadyNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateCanceled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testAlreadyNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateCanceled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: &InvoiceHtlcAMPData{
|
||||
Record: *ampRecord,
|
||||
Hash: hash,
|
||||
@@ -646,14 +724,15 @@ func TestUpdateHTLC(t *testing.T) {
|
||||
invState: ContractSettled,
|
||||
setID: &setID,
|
||||
output: InvoiceHTLC{
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testAlreadyNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateCanceled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
Amt: 5000,
|
||||
MppTotalAmt: 5000,
|
||||
AcceptHeight: 100,
|
||||
AcceptTime: testNow,
|
||||
ResolveTime: testAlreadyNow,
|
||||
Expiry: 40,
|
||||
State: HtlcStateCanceled,
|
||||
CustomRecords: make(record.CustomSet),
|
||||
WireCustomRecords: make(lnwire.CustomRecords),
|
||||
AMP: &InvoiceHtlcAMPData{
|
||||
Record: *ampRecord,
|
||||
Hash: hash,
|
||||
|
Reference in New Issue
Block a user