-
Notifications
You must be signed in to change notification settings - Fork 1
/
check_invoice_test.go
75 lines (72 loc) · 1.62 KB
/
check_invoice_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package main
import (
"github.com/getAlby/ln-event-publisher/service"
"testing"
"github.com/lightningnetwork/lnd/lnrpc"
"github.com/stretchr/testify/assert"
)
func TestCheckInvoice(t *testing.T) {
//test non keysend
assert.True(t, service.ShouldPublishInvoice(&lnrpc.Invoice{
State: lnrpc.Invoice_SETTLED,
IsKeysend: false,
Htlcs: []*lnrpc.InvoiceHTLC{
{
ChanId: 0,
HtlcIndex: 0,
AmtMsat: 0,
AcceptHeight: 0,
AcceptTime: 0,
ResolveTime: 0,
ExpiryHeight: 0,
State: 0,
MppTotalAmtMsat: 0,
Amp: &lnrpc.AMP{},
},
},
}))
//test keysend with wallet id tlv
assert.True(t, service.ShouldPublishInvoice(&lnrpc.Invoice{
State: lnrpc.Invoice_SETTLED,
IsKeysend: true,
Htlcs: []*lnrpc.InvoiceHTLC{
{
ChanId: 0,
HtlcIndex: 0,
AmtMsat: 0,
AcceptHeight: 0,
AcceptTime: 0,
ResolveTime: 0,
ExpiryHeight: 0,
State: 0,
CustomRecords: map[uint64][]byte{
696969: {69, 69, 69},
},
MppTotalAmtMsat: 0,
Amp: &lnrpc.AMP{},
},
},
}))
//test keysend without wallet id tlv
assert.False(t, service.ShouldPublishInvoice(&lnrpc.Invoice{
State: lnrpc.Invoice_SETTLED,
IsKeysend: true,
Htlcs: []*lnrpc.InvoiceHTLC{
{
ChanId: 0,
HtlcIndex: 0,
AmtMsat: 0,
AcceptHeight: 0,
AcceptTime: 0,
ResolveTime: 0,
ExpiryHeight: 0,
State: 0,
CustomRecords: map[uint64][]byte{
696970: {69, 69, 70},
},
MppTotalAmtMsat: 0,
Amp: &lnrpc.AMP{},
},
},
}))
}