Skip to content

Commit 43df8e2

Browse files
committed
scripting: fix LND RPC authentication using lndclient wrappers
This commit fixes LND RPC authentication by switching from raw gRPC clients to lndclient wrappers that provide proper macaroon authentication. Changes: - Update LNDClients to use lndclient.LightningClient and lndclient.RouterClient instead of raw gRPC clients - Add getRawLightningClient() and getRawRouterClient() helpers that use RawClientWithMacAuth() for authenticated raw client access - Update all 21 LND builtin methods to use the new pattern - Add InMemoryStore implementation for testing - Wire up LND clients in terminal.go after LND connects - Fix integration test function signatures All 7 scripts integration tests now pass: - scripts_basic_crud - scripts_validation - scripts_execution - scripts_kv_store - scripts_lnd_access - scripts_builtins - scripts_kv_builtins
1 parent 7b9c241 commit 43df8e2

File tree

7 files changed

+292
-104
lines changed

7 files changed

+292
-104
lines changed

itest/litd_scripts_test.go

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ import (
1515
)
1616

1717
// testScriptBasicCRUD tests basic script create, read, update, delete operations.
18-
func testScriptBasicCRUD(t *harnessTest, net *NetworkHarness) {
19-
ctx := context.Background()
18+
func testScriptBasicCRUD(ctx context.Context, net *NetworkHarness,
19+
t *harnessTest) {
20+
2021
ctxt, cancel := context.WithTimeout(ctx, defaultTimeout)
2122
defer cancel()
2223

@@ -98,8 +99,9 @@ def main():
9899
}
99100

100101
// testScriptValidation tests script syntax validation.
101-
func testScriptValidation(t *harnessTest, net *NetworkHarness) {
102-
ctx := context.Background()
102+
func testScriptValidation(ctx context.Context, net *NetworkHarness,
103+
t *harnessTest) {
104+
103105
ctxt, cancel := context.WithTimeout(ctx, defaultTimeout)
104106
defer cancel()
105107

@@ -148,8 +150,9 @@ def helper():
148150
}
149151

150152
// testScriptExecution tests basic script execution.
151-
func testScriptExecution(t *harnessTest, net *NetworkHarness) {
152-
ctx := context.Background()
153+
func testScriptExecution(ctx context.Context, net *NetworkHarness,
154+
t *harnessTest) {
155+
153156
ctxt, cancel := context.WithTimeout(ctx, defaultTimeout)
154157
defer cancel()
155158

@@ -220,8 +223,9 @@ def main(x=10, y=20):
220223
}
221224

222225
// testScriptKVStore tests the script KV store operations.
223-
func testScriptKVStore(t *harnessTest, net *NetworkHarness) {
224-
ctx := context.Background()
226+
func testScriptKVStore(ctx context.Context, net *NetworkHarness,
227+
t *harnessTest) {
228+
225229
ctxt, cancel := context.WithTimeout(ctx, defaultTimeout)
226230
defer cancel()
227231

@@ -298,8 +302,9 @@ func testScriptKVStore(t *harnessTest, net *NetworkHarness) {
298302
}
299303

300304
// testScriptWithLNDAccess tests scripts that access LND RPCs.
301-
func testScriptWithLNDAccess(t *harnessTest, net *NetworkHarness) {
302-
ctx := context.Background()
305+
func testScriptWithLNDAccess(ctx context.Context, net *NetworkHarness,
306+
t *harnessTest) {
307+
303308
ctxt, cancel := context.WithTimeout(ctx, defaultTimeout)
304309
defer cancel()
305310

@@ -350,8 +355,9 @@ def main():
350355
}
351356

352357
// testScriptBuiltins tests the built-in functions.
353-
func testScriptBuiltins(t *harnessTest, net *NetworkHarness) {
354-
ctx := context.Background()
358+
func testScriptBuiltins(ctx context.Context, net *NetworkHarness,
359+
t *harnessTest) {
360+
355361
ctxt, cancel := context.WithTimeout(ctx, defaultTimeout)
356362
defer cancel()
357363

@@ -411,8 +417,9 @@ def main():
411417
}
412418

413419
// testScriptWithKVBuiltins tests scripts using built-in KV functions.
414-
func testScriptWithKVBuiltins(t *harnessTest, net *NetworkHarness) {
415-
ctx := context.Background()
420+
func testScriptWithKVBuiltins(ctx context.Context, net *NetworkHarness,
421+
t *harnessTest) {
422+
416423
ctxt, cancel := context.WithTimeout(ctx, defaultTimeout)
417424
defer cancel()
418425

0 commit comments

Comments
 (0)