Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .env.mint.example
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,19 @@ MINTING_MAX_AMOUNT=50000
# max melt amount (in sats)
MELTING_MAX_AMOUNT=50000

# Lightning Backend - Lnd, FakeBackend (FOR TESTING ONLY)
# Lightning Backend - Lnd, CLN, FakeBackend (FOR TESTING ONLY)
LIGHTNING_BACKEND="Lnd"

# LND
LND_GRPC_HOST="127.0.0.1:10001"
LND_CERT_PATH="/path/to/tls/cert"
LND_MACAROON_PATH="/path/to/macaroon"

# CLN
CLN_REST_URL="http://127.0.0.1:3030"
CLN_CERT_PATH="/path/to/cert"
CLN_REST_RUNE_PATH="/path/to/rune"

# enable MPP/NUT-15 (disabled by default)
# ENABLE_MPP=TRUE

Expand Down
23 changes: 19 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ jobs:
- name: Fuzz Uint64 subtraction
run: go test -v -fuzz=FuzzUnderflowSubUint64 -fuzztime=60s ./cashu

integration-tests:
mint-integration-tests:
runs-on: ubuntu-latest
strategy:
matrix:
backend: [LND, CLN]
steps:
- uses: actions/checkout@v4

Expand All @@ -42,6 +45,18 @@ jobs:
with:
go-version: 1.23.7

- name: Integration Tests
run: go test -v --tags=integration ./mint
- run: go test -v --tags=integration ./wallet
- name: Mint Integration Tests
run: go test -v --tags=integration ./mint -args -backend ${{ matrix.backend }}

wallet-integration-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.23.7

- name: Wallet Integration Tests
run: go test -v --tags=integration ./wallet
34 changes: 30 additions & 4 deletions cmd/mint/mint.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,8 @@ func configFromEnv() (*mint.Config, error) {
}

var lightningClient lightning.Client
switch os.Getenv("LIGHTNING_BACKEND") {
case "Lnd":
// read values for setting up LND
switch strings.ToUpper(os.Getenv("LIGHTNING_BACKEND")) {
case "LND":
host := os.Getenv("LND_GRPC_HOST")
if host == "" {
return nil, errors.New("LND_GRPC_HOST cannot be empty")
Expand Down Expand Up @@ -170,8 +169,35 @@ func configFromEnv() (*mint.Config, error) {
if err != nil {
return nil, fmt.Errorf("error setting LND client: %v", err)
}
case "FakeBackend":

case "CLN":
restURL := os.Getenv("CLN_REST_URL")
if restURL == "" {
return nil, errors.New("CLN_REST_URL cannot be empty")
}
runePath := os.Getenv("CLN_REST_RUNE_PATH")
if runePath == "" {
return nil, errors.New("CLN_REST_RUNE_PATH cannot be empty")
}

rune, err := os.ReadFile(runePath)
if err != nil {
return nil, fmt.Errorf("error reading macaroon: os.ReadFile %v", err)
}

clnConfig := lightning.CLNConfig{
RestURL: restURL,
Rune: string(rune),
}

lightningClient, err = lightning.SetupCLNClient(clnConfig)
if err != nil {
return nil, fmt.Errorf("error setting up CLN client: %v", err)
}

case "FAKEBACKEND":
lightningClient = &lightning.FakeBackend{}

default:
return nil, errors.New("invalid lightning backend")
}
Expand Down
Loading