mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
Update LND, Aperture, and Taproot Assets to revisions using the btcd v2 modules, and update lndclient to v0.21.0-3. Migrate Loop chain, transaction, and address types to their corresponding v2 packages. The lndclient release includes the migration from: https://github.com/lightninglabs/lndclient/pull/280 Taproot Assets is temporarily replaced with its btcd v2 revision because the v0.8 release branch has not adopted the new modules. This raises the minimum Go version to 1.26 and changes exported address types.
51 lines
1.2 KiB
Go
51 lines
1.2 KiB
Go
package loopd
|
|
|
|
import (
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/btcsuite/btcd/btcutil/v2"
|
|
"github.com/lightninglabs/loop/assets"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
// TestValidateTapdMacaroonPath tests that validation updates the default tapd
|
|
// macaroon path for the configured network without changing an explicit path.
|
|
func TestValidateTapdMacaroonPath(t *testing.T) {
|
|
customPath := filepath.Join(t.TempDir(), "custom.macaroon")
|
|
defaultConfig := assets.DefaultTapdConfig()
|
|
regtestConfig := assets.DefaultTapdConfigForNetwork(
|
|
btcutil.AppDataDir("tapd", false), "regtest",
|
|
)
|
|
|
|
tests := []struct {
|
|
name string
|
|
macaroonPath string
|
|
expectedPath string
|
|
}{
|
|
{
|
|
name: "default path",
|
|
macaroonPath: defaultConfig.MacaroonPath,
|
|
expectedPath: regtestConfig.MacaroonPath,
|
|
},
|
|
{
|
|
name: "explicit path",
|
|
macaroonPath: customPath,
|
|
expectedPath: customPath,
|
|
},
|
|
}
|
|
|
|
for _, test := range tests {
|
|
t.Run(test.name, func(t *testing.T) {
|
|
cfg := DefaultConfig()
|
|
cfg.Network = "regtest"
|
|
cfg.LoopDir = t.TempDir()
|
|
cfg.Tapd.MacaroonPath = test.macaroonPath
|
|
|
|
require.NoError(t, Validate(&cfg))
|
|
require.Equal(
|
|
t, test.expectedPath, cfg.Tapd.MacaroonPath,
|
|
)
|
|
})
|
|
}
|
|
}
|