diff --git a/.gitignore b/.gitignore index f8e5478672..7f4e1caa12 100644 --- a/.gitignore +++ b/.gitignore @@ -27,7 +27,6 @@ _testmain.go /lnd cmd/cmd -**.key **.hex cmd/lncli/lncli diff --git a/test/end_to_end/README.md b/test/end_to_end/README.md new file mode 100644 index 0000000000..12b40eab72 --- /dev/null +++ b/test/end_to_end/README.md @@ -0,0 +1,47 @@ +# Simple environment and integration tests for lnd + +Contains simnet envirnment and end-to-end automated tests. +Note: lnd should be installed! + +## Simnet environment + +Directory contains in `simnet` configured simnet test network suitable for manual usage. +`simnet/btcd` - btcd simnet configuration. To launch btcd go into `simnet/btcd` and launch `start-btcd.sh` . Mining address in one of wallet's addresses. +`simnet/btcwallet` - preconfigured btcwallet. To launch btcwallet go into `simnet/btcwallet` and launch `start-btcwallet.sh` Wallet passphrase is "lol". Wallet already have some coins. +`simnet/btcctl` - preconfigured btcctl client. Use it to control btcd and btcwallet. Go into `simnet/btcctl` and `btcctl.sh `. For example to generate 1 block do `./btcctl.sh generate 1` +`simnet/lnd-node1` - First lnd node. To start it go into `simnet/lnd-node1` and launch `start-lnd.sh`. RPC port: 10009, Peer port 10011 +`simnet/lnd-node2` - Second lnd node. To start it go into `simnet/lnd-node2` and launch `start-lnd.sh`. RPC port: 11009, Peer port 11011 +`simnet/lnd-node3` - Third lnd node. To start it go into `simnet/lnd-node3` and launch `start-lnd.sh`. RPC port: 12009, Peer port 12011 +`simnet/lnd-node4` - Forth lnd node. To start it go into `simnet/lnd-node4` and launch `start-lnd.sh`. RPC port: 13009, Peer port 13011 +`simnet/lnd-node5` - Fifth lnd node. To start it go into `simnet/lnd-node5` and launch `start-lnd.sh`. RPC port: 14009, Peer port 14011 +REMEMBER: Each launch script should be called from specific directory. +By default `lncli` connects to first node. Use `--rpcserver` to specify needed node. For example to connect to 3 node use `--rpcserver localhost:12009` + +Example usage scenario (to see how payment between two nodes work): +1. Launch 5 different terminals +2. Launch btcd, btcwallet, lnd-node1, lnd-node2. In each terminal go into specific directory and launch script. +3. Go into `simnet/btcctl` +4. Generate some address for first node +`lncli newaddress p2wkh` +5. Send some coins to this address from wallet +`./btcctl.sh walletpassphrase lol 1000` +`./btcctl.sh sendtoaddress 10` - send 10 bitcoins to first node +`./btcctl.sh generate 10` - generate 10 blocks +6. Connect first node to second. +Go to terminal with the output of second node. Find there a string like `identity address:
`. Example: `17:21:15 2016-08-23 [INF] LTND: identity address: SXWewg7yvFdp82tGFiNuQx2Ad91pxCrDKP` +`lncli connect
@localhost:11011`. - it will connect 1st node to second. Example: `lncli connect SXWewg7yvFdp82tGFiNuQx2Ad91pxCrDKP@localhost:11011`. Result contains peer_id of second node. +7. Create channel between nodes +`lncli openchannel --peer_id 1 --local_amt 100000000 --num_confs 1` - creates channel between first and second node. Funded solely by first node. Amount 1 BTC +`lncli generate 11` - generate blocks to include funding transaction into blockchain +8. Send payment: +`lncli --rpcserver localhost:11009 getinfo` - get lightning_id of the second node +`lncli sendpayment --dest --amt 100` - send 100 Satoshi +9. To check lightning balance use `lncli listpeers`. It outputs peers with opened with them channels(which also include balance). + +## Automated tests +They should be launched from this directory. For example `go run test.go` +They are useful during development. +They copy test environment in some temp directory and launch some command line operations like create channel, send money, test balance +`test.go` - test one-hop payments. +`test_multihop.go` - test that routing(finding neighborhood nodes) works in small network +Note: launching this files will kill all running lnd, btcd, btcwallet !!! \ No newline at end of file diff --git a/test/end_to_end/simnet/btcctl/btcctl.conf b/test/end_to_end/simnet/btcctl/btcctl.conf new file mode 100644 index 0000000000..07a953b3b1 --- /dev/null +++ b/test/end_to_end/simnet/btcctl/btcctl.conf @@ -0,0 +1,5 @@ +[Application Options] +simnet=1 +rpcuser=myuser +rpcpass=SomeDecentp4ssw0rd +rpccert=./rpc.cert \ No newline at end of file diff --git a/test/end_to_end/simnet/btcctl/btcctl.sh b/test/end_to_end/simnet/btcctl/btcctl.sh new file mode 100755 index 0000000000..e5c5d811a1 --- /dev/null +++ b/test/end_to_end/simnet/btcctl/btcctl.sh @@ -0,0 +1,2 @@ +#!/bin/bash +btcctl --configfile=./btcctl.conf --wallet $* \ No newline at end of file diff --git a/test/end_to_end/simnet/btcctl/rpc.cert b/test/end_to_end/simnet/btcctl/rpc.cert new file mode 100644 index 0000000000..885646bd65 --- /dev/null +++ b/test/end_to_end/simnet/btcctl/rpc.cert @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICaTCCAcugAwIBAgIRAKo0RgbPkR/vowTwVII0GjMwCgYIKoZIzj0EAwQwMzEg +MB4GA1UEChMXYnRjZCBhdXRvZ2VuZXJhdGVkIGNlcnQxDzANBgNVBAMTBmRlYmlh +bjAeFw0xNjAxMjMyMjE2MTZaFw0yNjAxMjEyMjE2MTZaMDMxIDAeBgNVBAoTF2J0 +Y2QgYXV0b2dlbmVyYXRlZCBjZXJ0MQ8wDQYDVQQDEwZkZWJpYW4wgZswEAYHKoZI +zj0CAQYFK4EEACMDgYYABAEN3VN+ztukaFxLrxtNm5R61HeFYoq+w+LZ4N9Dl/Nn +clrTzJaRhVdeHfW/+cxl9oNA8H7/XvlmS1jXaCOz5udz3AHVVoGnsBng3VI3+69U +K/ocW7UGr4NattYJo7GdW1aY/dLcgVshYtuo4n2n++HsAQmxy6qwq5/E5B+Pqeuw +XdIebaN9MHswDgYDVR0PAQH/BAQDAgCkMA8GA1UdEwEB/wQFMAMBAf8wWAYDVR0R +BFEwT4IGZGViaWFugglsb2NhbGhvc3SHBH8AAAGHEAAAAAAAAAAAAAAAAAAAAAGH +BAoAAg+HBKwSAAGHBKwRAAGHEP6AAAAAAAAACgAn//4MXg0wCgYIKoZIzj0EAwQD +gYsAMIGHAkIBeIa+vY7ooxQcTx7XarrMguEylhG88d2AMgyKW09KE8QIxd+4bC0s +yXVGGEb5pz5C72PkVjnjra7Q7HQrAZ1momUCQQIZFFgnwSQKhPeG7nBidrFwjxHe +9dERER04xuVRwDhfZOQzAhDwgWesnS9rUNbuKiMdeI6KAtpMnIZcsmDGIwk5 +-----END CERTIFICATE----- diff --git a/test/end_to_end/simnet/btcd/btcd.conf b/test/end_to_end/simnet/btcd/btcd.conf new file mode 100644 index 0000000000..93deb013f8 --- /dev/null +++ b/test/end_to_end/simnet/btcd/btcd.conf @@ -0,0 +1,12 @@ +[Application Options] +simnet=1 +datadir=./data +logdir=./logs +rpccert=./rpc.cert +rpckey=./rpc.key +notls=0 +rpcuser=myuser +rpcpass=SomeDecentp4ssw0rd +rpclimituser=mylimituser +rpclimitpass=Limitedp4ssw0rd +miningaddr=Sb2B7cZsgFvNyoes15KGkhUq7n4Rp5xVbX \ No newline at end of file diff --git a/test/end_to_end/simnet/btcd/data/simnet/blocks_ffldb/000000000.fdb b/test/end_to_end/simnet/btcd/data/simnet/blocks_ffldb/000000000.fdb new file mode 100644 index 0000000000..6792a86e3d Binary files /dev/null and b/test/end_to_end/simnet/btcd/data/simnet/blocks_ffldb/000000000.fdb differ diff --git a/test/end_to_end/simnet/btcd/data/simnet/blocks_ffldb/metadata/000007.ldb b/test/end_to_end/simnet/btcd/data/simnet/blocks_ffldb/metadata/000007.ldb new file mode 100644 index 0000000000..05d81e2d51 Binary files /dev/null and b/test/end_to_end/simnet/btcd/data/simnet/blocks_ffldb/metadata/000007.ldb differ diff --git a/test/end_to_end/simnet/btcd/data/simnet/blocks_ffldb/metadata/000008.ldb b/test/end_to_end/simnet/btcd/data/simnet/blocks_ffldb/metadata/000008.ldb new file mode 100644 index 0000000000..d2e6a68e6c Binary files /dev/null and b/test/end_to_end/simnet/btcd/data/simnet/blocks_ffldb/metadata/000008.ldb differ diff --git a/test/end_to_end/simnet/btcd/data/simnet/blocks_ffldb/metadata/000013.log b/test/end_to_end/simnet/btcd/data/simnet/blocks_ffldb/metadata/000013.log new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/end_to_end/simnet/btcd/data/simnet/blocks_ffldb/metadata/CURRENT b/test/end_to_end/simnet/btcd/data/simnet/blocks_ffldb/metadata/CURRENT new file mode 100644 index 0000000000..23b73d9100 --- /dev/null +++ b/test/end_to_end/simnet/btcd/data/simnet/blocks_ffldb/metadata/CURRENT @@ -0,0 +1 @@ +MANIFEST-000014 diff --git a/test/end_to_end/simnet/btcd/data/simnet/blocks_ffldb/metadata/LOCK b/test/end_to_end/simnet/btcd/data/simnet/blocks_ffldb/metadata/LOCK new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/end_to_end/simnet/btcd/data/simnet/blocks_ffldb/metadata/LOG b/test/end_to_end/simnet/btcd/data/simnet/blocks_ffldb/metadata/LOG new file mode 100644 index 0000000000..0b00c4acd9 --- /dev/null +++ b/test/end_to_end/simnet/btcd/data/simnet/blocks_ffldb/metadata/LOG @@ -0,0 +1,65 @@ +=============== Aug 11, 2016 (EDT) =============== +03:43:40.300173 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed +03:43:40.300568 db@open opening +03:43:40.300721 version@stat F·[] S·0B[] Sc·[] +03:43:40.307031 db@janitor F·2 G·0 +03:43:40.307064 db@open done T·6.486608ms +03:44:25.511487 memdb@flush N·3 S·93B +03:44:25.521042 memdb@flush created L0@3 N·3 S·260B "\x00\x00\x00..loc,v1":"bid..bid,v3" +03:44:25.521163 version@stat F·[1] S·260B[260B] Sc·[0.25] +03:44:25.527490 memdb@flush committed F·1 T·15.95933ms +03:44:25.527547 journal@remove removed @1 +03:44:25.532049 transaction@flush created L0@4 N·10 S·634B "\x00\x00\x00..ate,v4":"bid..bid,v13" +03:44:25.532109 version@stat F·[2] S·894B[894B] Sc·[0.50] +03:44:25.536308 db@close closing +03:44:25.536394 db@close done T·84.114µs +=============== Aug 11, 2016 (EDT) =============== +03:44:35.839405 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed +03:44:35.839523 version@stat F·[2] S·894B[894B] Sc·[0.50] +03:44:35.839542 db@open opening +03:44:35.839574 journal@recovery F·1 +03:44:35.839679 journal@recovery recovering @2 +03:44:35.842031 version@stat F·[2] S·894B[894B] Sc·[0.50] +03:44:35.842379 db@janitor F·4 G·0 +03:44:35.842437 db@open done T·2.848257ms +03:45:21.130520 table@compaction L0·2 -> L1·0 S·894B Q·13 +03:45:21.150938 table@build created L1@7 N·11 S·664B "\x00\x00\x00..ate,v4":"bid..bid,v13" +03:45:21.150978 version@stat F·[0 1] S·664B[0B 664B] Sc·[0.00 0.00] +03:45:21.164595 table@compaction committed F-1 S-230B Ke·0 D·2 T·34.02253ms +03:45:21.164607 table@remove removed @4 +03:45:21.164752 table@remove removed @3 +03:45:42.843017 transaction@flush created L0@8 N·507 S·35KiB "\x00\x00\x00..ate,v14":"\x00\x00\x00..\xcaM>,v520" +03:45:42.843071 version@stat F·[1 1] S·35KiB[35KiB 664B] Sc·[0.25 0.00] +03:45:42.846772 db@close closing +03:45:42.846832 db@close done T·66.764µs +=============== Aug 11, 2016 (EDT) =============== +04:07:12.076365 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed +04:07:12.076513 version@stat F·[1 1] S·35KiB[35KiB 664B] Sc·[0.25 0.00] +04:07:12.076562 db@open opening +04:07:12.076596 journal@recovery F·1 +04:07:12.076760 journal@recovery recovering @5 +04:07:12.076929 version@stat F·[1 1] S·35KiB[35KiB 664B] Sc·[0.25 0.00] +04:07:12.077182 db@janitor F·4 G·0 +04:07:12.077271 db@open done T·699.613µs +04:07:12.079750 db@close closing +04:07:12.079827 db@close done T·74.124µs +=============== Aug 11, 2016 (EDT) =============== +04:07:13.649527 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed +04:07:13.649676 version@stat F·[1 1] S·35KiB[35KiB 664B] Sc·[0.25 0.00] +04:07:13.649725 db@open opening +04:07:13.649758 journal@recovery F·1 +04:07:13.649994 journal@recovery recovering @9 +04:07:13.651003 version@stat F·[1 1] S·35KiB[35KiB 664B] Sc·[0.25 0.00] +04:07:13.651243 db@janitor F·4 G·0 +04:07:13.651277 db@open done T·1.544943ms +04:07:13.652920 db@close closing +04:07:13.652964 db@close done T·41.708µs +=============== Aug 11, 2016 (EDT) =============== +04:07:26.546683 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed +04:07:26.546795 version@stat F·[1 1] S·35KiB[35KiB 664B] Sc·[0.25 0.00] +04:07:26.546804 db@open opening +04:07:26.546835 journal@recovery F·1 +04:07:26.546919 journal@recovery recovering @11 +04:07:26.549673 version@stat F·[1 1] S·35KiB[35KiB 664B] Sc·[0.25 0.00] +04:07:26.550021 db@janitor F·4 G·0 +04:07:26.550041 db@open done T·3.228957ms diff --git a/test/end_to_end/simnet/btcd/data/simnet/blocks_ffldb/metadata/MANIFEST-000014 b/test/end_to_end/simnet/btcd/data/simnet/blocks_ffldb/metadata/MANIFEST-000014 new file mode 100644 index 0000000000..1dfdab307b Binary files /dev/null and b/test/end_to_end/simnet/btcd/data/simnet/blocks_ffldb/metadata/MANIFEST-000014 differ diff --git a/test/end_to_end/simnet/btcd/data/simnet/peers.json b/test/end_to_end/simnet/btcd/data/simnet/peers.json new file mode 100644 index 0000000000..d2ebe1bc7b --- /dev/null +++ b/test/end_to_end/simnet/btcd/data/simnet/peers.json @@ -0,0 +1 @@ +{"Version":1,"Key":[229,10,27,65,178,117,84,17,167,150,149,16,190,20,211,208,108,64,15,101,40,252,131,218,200,20,86,12,13,182,134,6],"Addresses":[],"NewBuckets":[[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]],"TriedBuckets":[[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]]} diff --git a/test/end_to_end/simnet/btcd/rpc.cert b/test/end_to_end/simnet/btcd/rpc.cert new file mode 100644 index 0000000000..885646bd65 --- /dev/null +++ b/test/end_to_end/simnet/btcd/rpc.cert @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICaTCCAcugAwIBAgIRAKo0RgbPkR/vowTwVII0GjMwCgYIKoZIzj0EAwQwMzEg +MB4GA1UEChMXYnRjZCBhdXRvZ2VuZXJhdGVkIGNlcnQxDzANBgNVBAMTBmRlYmlh +bjAeFw0xNjAxMjMyMjE2MTZaFw0yNjAxMjEyMjE2MTZaMDMxIDAeBgNVBAoTF2J0 +Y2QgYXV0b2dlbmVyYXRlZCBjZXJ0MQ8wDQYDVQQDEwZkZWJpYW4wgZswEAYHKoZI +zj0CAQYFK4EEACMDgYYABAEN3VN+ztukaFxLrxtNm5R61HeFYoq+w+LZ4N9Dl/Nn +clrTzJaRhVdeHfW/+cxl9oNA8H7/XvlmS1jXaCOz5udz3AHVVoGnsBng3VI3+69U +K/ocW7UGr4NattYJo7GdW1aY/dLcgVshYtuo4n2n++HsAQmxy6qwq5/E5B+Pqeuw +XdIebaN9MHswDgYDVR0PAQH/BAQDAgCkMA8GA1UdEwEB/wQFMAMBAf8wWAYDVR0R +BFEwT4IGZGViaWFugglsb2NhbGhvc3SHBH8AAAGHEAAAAAAAAAAAAAAAAAAAAAGH +BAoAAg+HBKwSAAGHBKwRAAGHEP6AAAAAAAAACgAn//4MXg0wCgYIKoZIzj0EAwQD +gYsAMIGHAkIBeIa+vY7ooxQcTx7XarrMguEylhG88d2AMgyKW09KE8QIxd+4bC0s +yXVGGEb5pz5C72PkVjnjra7Q7HQrAZ1momUCQQIZFFgnwSQKhPeG7nBidrFwjxHe +9dERER04xuVRwDhfZOQzAhDwgWesnS9rUNbuKiMdeI6KAtpMnIZcsmDGIwk5 +-----END CERTIFICATE----- diff --git a/test/end_to_end/simnet/btcd/rpc.key b/test/end_to_end/simnet/btcd/rpc.key new file mode 100644 index 0000000000..540dcc546d --- /dev/null +++ b/test/end_to_end/simnet/btcd/rpc.key @@ -0,0 +1,7 @@ +-----BEGIN EC PRIVATE KEY----- +MIHcAgEBBEIBiSmb0heeAHqASMVb448YWi+Pln2jG7WSVuRON9HID2QCVO7cVlIU +q5I7+MLj1i1hRxPTT1zM6DjLhJFAbPPskuygBwYFK4EEACOhgYkDgYYABAEN3VN+ +ztukaFxLrxtNm5R61HeFYoq+w+LZ4N9Dl/NnclrTzJaRhVdeHfW/+cxl9oNA8H7/ +XvlmS1jXaCOz5udz3AHVVoGnsBng3VI3+69UK/ocW7UGr4NattYJo7GdW1aY/dLc +gVshYtuo4n2n++HsAQmxy6qwq5/E5B+PqeuwXdIebQ== +-----END EC PRIVATE KEY----- diff --git a/test/end_to_end/simnet/btcd/start-btcd.sh b/test/end_to_end/simnet/btcd/start-btcd.sh new file mode 100755 index 0000000000..cb95743c62 --- /dev/null +++ b/test/end_to_end/simnet/btcd/start-btcd.sh @@ -0,0 +1,2 @@ +#!/bin/bash +btcd --configfile=./btcd.conf \ No newline at end of file diff --git a/test/end_to_end/simnet/btcwallet/btcwallet.conf b/test/end_to_end/simnet/btcwallet/btcwallet.conf new file mode 100644 index 0000000000..764d4e35df --- /dev/null +++ b/test/end_to_end/simnet/btcwallet/btcwallet.conf @@ -0,0 +1,5 @@ +[Application Options] +simnet=1 +username=myuser +password=SomeDecentp4ssw0rd +appdata=./data \ No newline at end of file diff --git a/test/end_to_end/simnet/btcwallet/data/rpc.cert b/test/end_to_end/simnet/btcwallet/data/rpc.cert new file mode 100644 index 0000000000..885646bd65 --- /dev/null +++ b/test/end_to_end/simnet/btcwallet/data/rpc.cert @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICaTCCAcugAwIBAgIRAKo0RgbPkR/vowTwVII0GjMwCgYIKoZIzj0EAwQwMzEg +MB4GA1UEChMXYnRjZCBhdXRvZ2VuZXJhdGVkIGNlcnQxDzANBgNVBAMTBmRlYmlh +bjAeFw0xNjAxMjMyMjE2MTZaFw0yNjAxMjEyMjE2MTZaMDMxIDAeBgNVBAoTF2J0 +Y2QgYXV0b2dlbmVyYXRlZCBjZXJ0MQ8wDQYDVQQDEwZkZWJpYW4wgZswEAYHKoZI +zj0CAQYFK4EEACMDgYYABAEN3VN+ztukaFxLrxtNm5R61HeFYoq+w+LZ4N9Dl/Nn +clrTzJaRhVdeHfW/+cxl9oNA8H7/XvlmS1jXaCOz5udz3AHVVoGnsBng3VI3+69U +K/ocW7UGr4NattYJo7GdW1aY/dLcgVshYtuo4n2n++HsAQmxy6qwq5/E5B+Pqeuw +XdIebaN9MHswDgYDVR0PAQH/BAQDAgCkMA8GA1UdEwEB/wQFMAMBAf8wWAYDVR0R +BFEwT4IGZGViaWFugglsb2NhbGhvc3SHBH8AAAGHEAAAAAAAAAAAAAAAAAAAAAGH +BAoAAg+HBKwSAAGHBKwRAAGHEP6AAAAAAAAACgAn//4MXg0wCgYIKoZIzj0EAwQD +gYsAMIGHAkIBeIa+vY7ooxQcTx7XarrMguEylhG88d2AMgyKW09KE8QIxd+4bC0s +yXVGGEb5pz5C72PkVjnjra7Q7HQrAZ1momUCQQIZFFgnwSQKhPeG7nBidrFwjxHe +9dERER04xuVRwDhfZOQzAhDwgWesnS9rUNbuKiMdeI6KAtpMnIZcsmDGIwk5 +-----END CERTIFICATE----- diff --git a/test/end_to_end/simnet/btcwallet/data/rpc.key b/test/end_to_end/simnet/btcwallet/data/rpc.key new file mode 100644 index 0000000000..540dcc546d --- /dev/null +++ b/test/end_to_end/simnet/btcwallet/data/rpc.key @@ -0,0 +1,7 @@ +-----BEGIN EC PRIVATE KEY----- +MIHcAgEBBEIBiSmb0heeAHqASMVb448YWi+Pln2jG7WSVuRON9HID2QCVO7cVlIU +q5I7+MLj1i1hRxPTT1zM6DjLhJFAbPPskuygBwYFK4EEACOhgYkDgYYABAEN3VN+ +ztukaFxLrxtNm5R61HeFYoq+w+LZ4N9Dl/NnclrTzJaRhVdeHfW/+cxl9oNA8H7/ +XvlmS1jXaCOz5udz3AHVVoGnsBng3VI3+69UK/ocW7UGr4NattYJo7GdW1aY/dLc +gVshYtuo4n2n++HsAQmxy6qwq5/E5B+PqeuwXdIebQ== +-----END EC PRIVATE KEY----- diff --git a/test/end_to_end/simnet/btcwallet/start-btcwallet.sh b/test/end_to_end/simnet/btcwallet/start-btcwallet.sh new file mode 100755 index 0000000000..d95c5aa610 --- /dev/null +++ b/test/end_to_end/simnet/btcwallet/start-btcwallet.sh @@ -0,0 +1,2 @@ +#!/bin/bash +btcwallet --configfile=btcwallet.conf $* \ No newline at end of file diff --git a/test/end_to_end/simnet/lnd-node1/lnd.conf b/test/end_to_end/simnet/lnd-node1/lnd.conf new file mode 100644 index 0000000000..1abcc08cec --- /dev/null +++ b/test/end_to_end/simnet/lnd-node1/lnd.conf @@ -0,0 +1,10 @@ +[Application Options] +simnet=1 +rpcuser=myuser +rpcpass=SomeDecentp4ssw0rd +rpccert=./rpc.cert +rpckey=./rpc.key +btcdhost=localhost +peerport=10011 +rpcport=10009 +debuglevel=trace \ No newline at end of file diff --git a/test/end_to_end/simnet/lnd-node1/rpc.cert b/test/end_to_end/simnet/lnd-node1/rpc.cert new file mode 100644 index 0000000000..885646bd65 --- /dev/null +++ b/test/end_to_end/simnet/lnd-node1/rpc.cert @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICaTCCAcugAwIBAgIRAKo0RgbPkR/vowTwVII0GjMwCgYIKoZIzj0EAwQwMzEg +MB4GA1UEChMXYnRjZCBhdXRvZ2VuZXJhdGVkIGNlcnQxDzANBgNVBAMTBmRlYmlh +bjAeFw0xNjAxMjMyMjE2MTZaFw0yNjAxMjEyMjE2MTZaMDMxIDAeBgNVBAoTF2J0 +Y2QgYXV0b2dlbmVyYXRlZCBjZXJ0MQ8wDQYDVQQDEwZkZWJpYW4wgZswEAYHKoZI +zj0CAQYFK4EEACMDgYYABAEN3VN+ztukaFxLrxtNm5R61HeFYoq+w+LZ4N9Dl/Nn +clrTzJaRhVdeHfW/+cxl9oNA8H7/XvlmS1jXaCOz5udz3AHVVoGnsBng3VI3+69U +K/ocW7UGr4NattYJo7GdW1aY/dLcgVshYtuo4n2n++HsAQmxy6qwq5/E5B+Pqeuw +XdIebaN9MHswDgYDVR0PAQH/BAQDAgCkMA8GA1UdEwEB/wQFMAMBAf8wWAYDVR0R +BFEwT4IGZGViaWFugglsb2NhbGhvc3SHBH8AAAGHEAAAAAAAAAAAAAAAAAAAAAGH +BAoAAg+HBKwSAAGHBKwRAAGHEP6AAAAAAAAACgAn//4MXg0wCgYIKoZIzj0EAwQD +gYsAMIGHAkIBeIa+vY7ooxQcTx7XarrMguEylhG88d2AMgyKW09KE8QIxd+4bC0s +yXVGGEb5pz5C72PkVjnjra7Q7HQrAZ1momUCQQIZFFgnwSQKhPeG7nBidrFwjxHe +9dERER04xuVRwDhfZOQzAhDwgWesnS9rUNbuKiMdeI6KAtpMnIZcsmDGIwk5 +-----END CERTIFICATE----- diff --git a/test/end_to_end/simnet/lnd-node1/rpc.key b/test/end_to_end/simnet/lnd-node1/rpc.key new file mode 100644 index 0000000000..540dcc546d --- /dev/null +++ b/test/end_to_end/simnet/lnd-node1/rpc.key @@ -0,0 +1,7 @@ +-----BEGIN EC PRIVATE KEY----- +MIHcAgEBBEIBiSmb0heeAHqASMVb448YWi+Pln2jG7WSVuRON9HID2QCVO7cVlIU +q5I7+MLj1i1hRxPTT1zM6DjLhJFAbPPskuygBwYFK4EEACOhgYkDgYYABAEN3VN+ +ztukaFxLrxtNm5R61HeFYoq+w+LZ4N9Dl/NnclrTzJaRhVdeHfW/+cxl9oNA8H7/ +XvlmS1jXaCOz5udz3AHVVoGnsBng3VI3+69UK/ocW7UGr4NattYJo7GdW1aY/dLc +gVshYtuo4n2n++HsAQmxy6qwq5/E5B+PqeuwXdIebQ== +-----END EC PRIVATE KEY----- diff --git a/test/end_to_end/simnet/lnd-node1/start-lnd.sh b/test/end_to_end/simnet/lnd-node1/start-lnd.sh new file mode 100755 index 0000000000..35b24d4eb2 --- /dev/null +++ b/test/end_to_end/simnet/lnd-node1/start-lnd.sh @@ -0,0 +1,2 @@ +#!/bin/bash +lnd --configfile=./lnd.conf --datadir=./data --logdir=./logs \ No newline at end of file diff --git a/test/end_to_end/simnet/lnd-node2/lnd.conf b/test/end_to_end/simnet/lnd-node2/lnd.conf new file mode 100644 index 0000000000..14561ef417 --- /dev/null +++ b/test/end_to_end/simnet/lnd-node2/lnd.conf @@ -0,0 +1,10 @@ +[Application Options] +simnet=1 +rpcuser=myuser +rpcpass=SomeDecentp4ssw0rd +rpccert=./rpc.cert +rpckey=./rpc.key +btcdhost=localhost +peerport=11011 +rpcport=11009 +debuglevel=trace \ No newline at end of file diff --git a/test/end_to_end/simnet/lnd-node2/rpc.cert b/test/end_to_end/simnet/lnd-node2/rpc.cert new file mode 100644 index 0000000000..885646bd65 --- /dev/null +++ b/test/end_to_end/simnet/lnd-node2/rpc.cert @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICaTCCAcugAwIBAgIRAKo0RgbPkR/vowTwVII0GjMwCgYIKoZIzj0EAwQwMzEg +MB4GA1UEChMXYnRjZCBhdXRvZ2VuZXJhdGVkIGNlcnQxDzANBgNVBAMTBmRlYmlh +bjAeFw0xNjAxMjMyMjE2MTZaFw0yNjAxMjEyMjE2MTZaMDMxIDAeBgNVBAoTF2J0 +Y2QgYXV0b2dlbmVyYXRlZCBjZXJ0MQ8wDQYDVQQDEwZkZWJpYW4wgZswEAYHKoZI +zj0CAQYFK4EEACMDgYYABAEN3VN+ztukaFxLrxtNm5R61HeFYoq+w+LZ4N9Dl/Nn +clrTzJaRhVdeHfW/+cxl9oNA8H7/XvlmS1jXaCOz5udz3AHVVoGnsBng3VI3+69U +K/ocW7UGr4NattYJo7GdW1aY/dLcgVshYtuo4n2n++HsAQmxy6qwq5/E5B+Pqeuw +XdIebaN9MHswDgYDVR0PAQH/BAQDAgCkMA8GA1UdEwEB/wQFMAMBAf8wWAYDVR0R +BFEwT4IGZGViaWFugglsb2NhbGhvc3SHBH8AAAGHEAAAAAAAAAAAAAAAAAAAAAGH +BAoAAg+HBKwSAAGHBKwRAAGHEP6AAAAAAAAACgAn//4MXg0wCgYIKoZIzj0EAwQD +gYsAMIGHAkIBeIa+vY7ooxQcTx7XarrMguEylhG88d2AMgyKW09KE8QIxd+4bC0s +yXVGGEb5pz5C72PkVjnjra7Q7HQrAZ1momUCQQIZFFgnwSQKhPeG7nBidrFwjxHe +9dERER04xuVRwDhfZOQzAhDwgWesnS9rUNbuKiMdeI6KAtpMnIZcsmDGIwk5 +-----END CERTIFICATE----- diff --git a/test/end_to_end/simnet/lnd-node2/rpc.key b/test/end_to_end/simnet/lnd-node2/rpc.key new file mode 100644 index 0000000000..540dcc546d --- /dev/null +++ b/test/end_to_end/simnet/lnd-node2/rpc.key @@ -0,0 +1,7 @@ +-----BEGIN EC PRIVATE KEY----- +MIHcAgEBBEIBiSmb0heeAHqASMVb448YWi+Pln2jG7WSVuRON9HID2QCVO7cVlIU +q5I7+MLj1i1hRxPTT1zM6DjLhJFAbPPskuygBwYFK4EEACOhgYkDgYYABAEN3VN+ +ztukaFxLrxtNm5R61HeFYoq+w+LZ4N9Dl/NnclrTzJaRhVdeHfW/+cxl9oNA8H7/ +XvlmS1jXaCOz5udz3AHVVoGnsBng3VI3+69UK/ocW7UGr4NattYJo7GdW1aY/dLc +gVshYtuo4n2n++HsAQmxy6qwq5/E5B+PqeuwXdIebQ== +-----END EC PRIVATE KEY----- diff --git a/test/end_to_end/simnet/lnd-node2/start-lnd.sh b/test/end_to_end/simnet/lnd-node2/start-lnd.sh new file mode 100755 index 0000000000..35b24d4eb2 --- /dev/null +++ b/test/end_to_end/simnet/lnd-node2/start-lnd.sh @@ -0,0 +1,2 @@ +#!/bin/bash +lnd --configfile=./lnd.conf --datadir=./data --logdir=./logs \ No newline at end of file diff --git a/test/end_to_end/simnet/lnd-node3/lnd.conf b/test/end_to_end/simnet/lnd-node3/lnd.conf new file mode 100644 index 0000000000..7ab625d83b --- /dev/null +++ b/test/end_to_end/simnet/lnd-node3/lnd.conf @@ -0,0 +1,10 @@ +[Application Options] +simnet=1 +rpcuser=myuser +rpcpass=SomeDecentp4ssw0rd +rpccert=./rpc.cert +rpckey=./rpc.key +btcdhost=localhost +peerport=12011 +rpcport=12009 +debuglevel=trace \ No newline at end of file diff --git a/test/end_to_end/simnet/lnd-node3/rpc.cert b/test/end_to_end/simnet/lnd-node3/rpc.cert new file mode 100644 index 0000000000..885646bd65 --- /dev/null +++ b/test/end_to_end/simnet/lnd-node3/rpc.cert @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICaTCCAcugAwIBAgIRAKo0RgbPkR/vowTwVII0GjMwCgYIKoZIzj0EAwQwMzEg +MB4GA1UEChMXYnRjZCBhdXRvZ2VuZXJhdGVkIGNlcnQxDzANBgNVBAMTBmRlYmlh +bjAeFw0xNjAxMjMyMjE2MTZaFw0yNjAxMjEyMjE2MTZaMDMxIDAeBgNVBAoTF2J0 +Y2QgYXV0b2dlbmVyYXRlZCBjZXJ0MQ8wDQYDVQQDEwZkZWJpYW4wgZswEAYHKoZI +zj0CAQYFK4EEACMDgYYABAEN3VN+ztukaFxLrxtNm5R61HeFYoq+w+LZ4N9Dl/Nn +clrTzJaRhVdeHfW/+cxl9oNA8H7/XvlmS1jXaCOz5udz3AHVVoGnsBng3VI3+69U +K/ocW7UGr4NattYJo7GdW1aY/dLcgVshYtuo4n2n++HsAQmxy6qwq5/E5B+Pqeuw +XdIebaN9MHswDgYDVR0PAQH/BAQDAgCkMA8GA1UdEwEB/wQFMAMBAf8wWAYDVR0R +BFEwT4IGZGViaWFugglsb2NhbGhvc3SHBH8AAAGHEAAAAAAAAAAAAAAAAAAAAAGH +BAoAAg+HBKwSAAGHBKwRAAGHEP6AAAAAAAAACgAn//4MXg0wCgYIKoZIzj0EAwQD +gYsAMIGHAkIBeIa+vY7ooxQcTx7XarrMguEylhG88d2AMgyKW09KE8QIxd+4bC0s +yXVGGEb5pz5C72PkVjnjra7Q7HQrAZ1momUCQQIZFFgnwSQKhPeG7nBidrFwjxHe +9dERER04xuVRwDhfZOQzAhDwgWesnS9rUNbuKiMdeI6KAtpMnIZcsmDGIwk5 +-----END CERTIFICATE----- diff --git a/test/end_to_end/simnet/lnd-node3/rpc.key b/test/end_to_end/simnet/lnd-node3/rpc.key new file mode 100644 index 0000000000..540dcc546d --- /dev/null +++ b/test/end_to_end/simnet/lnd-node3/rpc.key @@ -0,0 +1,7 @@ +-----BEGIN EC PRIVATE KEY----- +MIHcAgEBBEIBiSmb0heeAHqASMVb448YWi+Pln2jG7WSVuRON9HID2QCVO7cVlIU +q5I7+MLj1i1hRxPTT1zM6DjLhJFAbPPskuygBwYFK4EEACOhgYkDgYYABAEN3VN+ +ztukaFxLrxtNm5R61HeFYoq+w+LZ4N9Dl/NnclrTzJaRhVdeHfW/+cxl9oNA8H7/ +XvlmS1jXaCOz5udz3AHVVoGnsBng3VI3+69UK/ocW7UGr4NattYJo7GdW1aY/dLc +gVshYtuo4n2n++HsAQmxy6qwq5/E5B+PqeuwXdIebQ== +-----END EC PRIVATE KEY----- diff --git a/test/end_to_end/simnet/lnd-node3/start-lnd.sh b/test/end_to_end/simnet/lnd-node3/start-lnd.sh new file mode 100755 index 0000000000..35b24d4eb2 --- /dev/null +++ b/test/end_to_end/simnet/lnd-node3/start-lnd.sh @@ -0,0 +1,2 @@ +#!/bin/bash +lnd --configfile=./lnd.conf --datadir=./data --logdir=./logs \ No newline at end of file diff --git a/test/end_to_end/simnet/lnd-node4/lnd.conf b/test/end_to_end/simnet/lnd-node4/lnd.conf new file mode 100644 index 0000000000..e0b93870ad --- /dev/null +++ b/test/end_to_end/simnet/lnd-node4/lnd.conf @@ -0,0 +1,10 @@ +[Application Options] +simnet=1 +rpcuser=myuser +rpcpass=SomeDecentp4ssw0rd +rpccert=./rpc.cert +rpckey=./rpc.key +btcdhost=localhost +peerport=13011 +rpcport=13009 +debuglevel=trace \ No newline at end of file diff --git a/test/end_to_end/simnet/lnd-node4/rpc.cert b/test/end_to_end/simnet/lnd-node4/rpc.cert new file mode 100644 index 0000000000..885646bd65 --- /dev/null +++ b/test/end_to_end/simnet/lnd-node4/rpc.cert @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICaTCCAcugAwIBAgIRAKo0RgbPkR/vowTwVII0GjMwCgYIKoZIzj0EAwQwMzEg +MB4GA1UEChMXYnRjZCBhdXRvZ2VuZXJhdGVkIGNlcnQxDzANBgNVBAMTBmRlYmlh +bjAeFw0xNjAxMjMyMjE2MTZaFw0yNjAxMjEyMjE2MTZaMDMxIDAeBgNVBAoTF2J0 +Y2QgYXV0b2dlbmVyYXRlZCBjZXJ0MQ8wDQYDVQQDEwZkZWJpYW4wgZswEAYHKoZI +zj0CAQYFK4EEACMDgYYABAEN3VN+ztukaFxLrxtNm5R61HeFYoq+w+LZ4N9Dl/Nn +clrTzJaRhVdeHfW/+cxl9oNA8H7/XvlmS1jXaCOz5udz3AHVVoGnsBng3VI3+69U +K/ocW7UGr4NattYJo7GdW1aY/dLcgVshYtuo4n2n++HsAQmxy6qwq5/E5B+Pqeuw +XdIebaN9MHswDgYDVR0PAQH/BAQDAgCkMA8GA1UdEwEB/wQFMAMBAf8wWAYDVR0R +BFEwT4IGZGViaWFugglsb2NhbGhvc3SHBH8AAAGHEAAAAAAAAAAAAAAAAAAAAAGH +BAoAAg+HBKwSAAGHBKwRAAGHEP6AAAAAAAAACgAn//4MXg0wCgYIKoZIzj0EAwQD +gYsAMIGHAkIBeIa+vY7ooxQcTx7XarrMguEylhG88d2AMgyKW09KE8QIxd+4bC0s +yXVGGEb5pz5C72PkVjnjra7Q7HQrAZ1momUCQQIZFFgnwSQKhPeG7nBidrFwjxHe +9dERER04xuVRwDhfZOQzAhDwgWesnS9rUNbuKiMdeI6KAtpMnIZcsmDGIwk5 +-----END CERTIFICATE----- diff --git a/test/end_to_end/simnet/lnd-node4/rpc.key b/test/end_to_end/simnet/lnd-node4/rpc.key new file mode 100644 index 0000000000..540dcc546d --- /dev/null +++ b/test/end_to_end/simnet/lnd-node4/rpc.key @@ -0,0 +1,7 @@ +-----BEGIN EC PRIVATE KEY----- +MIHcAgEBBEIBiSmb0heeAHqASMVb448YWi+Pln2jG7WSVuRON9HID2QCVO7cVlIU +q5I7+MLj1i1hRxPTT1zM6DjLhJFAbPPskuygBwYFK4EEACOhgYkDgYYABAEN3VN+ +ztukaFxLrxtNm5R61HeFYoq+w+LZ4N9Dl/NnclrTzJaRhVdeHfW/+cxl9oNA8H7/ +XvlmS1jXaCOz5udz3AHVVoGnsBng3VI3+69UK/ocW7UGr4NattYJo7GdW1aY/dLc +gVshYtuo4n2n++HsAQmxy6qwq5/E5B+PqeuwXdIebQ== +-----END EC PRIVATE KEY----- diff --git a/test/end_to_end/simnet/lnd-node4/start-lnd.sh b/test/end_to_end/simnet/lnd-node4/start-lnd.sh new file mode 100755 index 0000000000..35b24d4eb2 --- /dev/null +++ b/test/end_to_end/simnet/lnd-node4/start-lnd.sh @@ -0,0 +1,2 @@ +#!/bin/bash +lnd --configfile=./lnd.conf --datadir=./data --logdir=./logs \ No newline at end of file diff --git a/test/end_to_end/simnet/lnd-node5/lnd.conf b/test/end_to_end/simnet/lnd-node5/lnd.conf new file mode 100644 index 0000000000..25609b4b89 --- /dev/null +++ b/test/end_to_end/simnet/lnd-node5/lnd.conf @@ -0,0 +1,10 @@ +[Application Options] +simnet=1 +rpcuser=myuser +rpcpass=SomeDecentp4ssw0rd +rpccert=./rpc.cert +rpckey=./rpc.key +btcdhost=localhost +peerport=14011 +rpcport=14009 +debuglevel=trace \ No newline at end of file diff --git a/test/end_to_end/simnet/lnd-node5/rpc.cert b/test/end_to_end/simnet/lnd-node5/rpc.cert new file mode 100644 index 0000000000..885646bd65 --- /dev/null +++ b/test/end_to_end/simnet/lnd-node5/rpc.cert @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICaTCCAcugAwIBAgIRAKo0RgbPkR/vowTwVII0GjMwCgYIKoZIzj0EAwQwMzEg +MB4GA1UEChMXYnRjZCBhdXRvZ2VuZXJhdGVkIGNlcnQxDzANBgNVBAMTBmRlYmlh +bjAeFw0xNjAxMjMyMjE2MTZaFw0yNjAxMjEyMjE2MTZaMDMxIDAeBgNVBAoTF2J0 +Y2QgYXV0b2dlbmVyYXRlZCBjZXJ0MQ8wDQYDVQQDEwZkZWJpYW4wgZswEAYHKoZI +zj0CAQYFK4EEACMDgYYABAEN3VN+ztukaFxLrxtNm5R61HeFYoq+w+LZ4N9Dl/Nn +clrTzJaRhVdeHfW/+cxl9oNA8H7/XvlmS1jXaCOz5udz3AHVVoGnsBng3VI3+69U +K/ocW7UGr4NattYJo7GdW1aY/dLcgVshYtuo4n2n++HsAQmxy6qwq5/E5B+Pqeuw +XdIebaN9MHswDgYDVR0PAQH/BAQDAgCkMA8GA1UdEwEB/wQFMAMBAf8wWAYDVR0R +BFEwT4IGZGViaWFugglsb2NhbGhvc3SHBH8AAAGHEAAAAAAAAAAAAAAAAAAAAAGH +BAoAAg+HBKwSAAGHBKwRAAGHEP6AAAAAAAAACgAn//4MXg0wCgYIKoZIzj0EAwQD +gYsAMIGHAkIBeIa+vY7ooxQcTx7XarrMguEylhG88d2AMgyKW09KE8QIxd+4bC0s +yXVGGEb5pz5C72PkVjnjra7Q7HQrAZ1momUCQQIZFFgnwSQKhPeG7nBidrFwjxHe +9dERER04xuVRwDhfZOQzAhDwgWesnS9rUNbuKiMdeI6KAtpMnIZcsmDGIwk5 +-----END CERTIFICATE----- diff --git a/test/end_to_end/simnet/lnd-node5/rpc.key b/test/end_to_end/simnet/lnd-node5/rpc.key new file mode 100644 index 0000000000..540dcc546d --- /dev/null +++ b/test/end_to_end/simnet/lnd-node5/rpc.key @@ -0,0 +1,7 @@ +-----BEGIN EC PRIVATE KEY----- +MIHcAgEBBEIBiSmb0heeAHqASMVb448YWi+Pln2jG7WSVuRON9HID2QCVO7cVlIU +q5I7+MLj1i1hRxPTT1zM6DjLhJFAbPPskuygBwYFK4EEACOhgYkDgYYABAEN3VN+ +ztukaFxLrxtNm5R61HeFYoq+w+LZ4N9Dl/NnclrTzJaRhVdeHfW/+cxl9oNA8H7/ +XvlmS1jXaCOz5udz3AHVVoGnsBng3VI3+69UK/ocW7UGr4NattYJo7GdW1aY/dLc +gVshYtuo4n2n++HsAQmxy6qwq5/E5B+PqeuwXdIebQ== +-----END EC PRIVATE KEY----- diff --git a/test/end_to_end/simnet/lnd-node5/start-lnd.sh b/test/end_to_end/simnet/lnd-node5/start-lnd.sh new file mode 100755 index 0000000000..35b24d4eb2 --- /dev/null +++ b/test/end_to_end/simnet/lnd-node5/start-lnd.sh @@ -0,0 +1,2 @@ +#!/bin/bash +lnd --configfile=./lnd.conf --datadir=./data --logdir=./logs \ No newline at end of file diff --git a/test/end_to_end/test.go b/test/end_to_end/test.go new file mode 100644 index 0000000000..869cef0b9b --- /dev/null +++ b/test/end_to_end/test.go @@ -0,0 +1,746 @@ +package main +import ( + "os" + "io/ioutil" + "log" + "os/exec" + "time" + "bytes" + "errors" + "path/filepath" + "fmt" + "encoding/json" + "strings" + "github.com/roasbeef/btcrpcclient" + "github.com/roasbeef/btcwallet/chain" + "github.com/roasbeef/btcd/chaincfg" + "strconv" + "math" +) + +type LndNodeDesc struct { + WorkDir string + Host string + PeerPort int + RpcPort int + LightningId string + IdentityAddress string +} + +var LndNodesDefault []LndNodeDesc = []LndNodeDesc{ + { + WorkDir: "lnd-node1", + Host: "127.0.0.1", + PeerPort: 10011, + RpcPort: 10009, + }, + { + WorkDir: "lnd-node2", + Host: "127.0.0.1", + PeerPort: 11011, + RpcPort: 11009, + }, + { + WorkDir: "lnd-node3", + Host: "127.0.0.1", + PeerPort: 12011, + RpcPort: 12009, + }, +} + +func (node *LndNodeDesc) ConnectionAddress() string{ + return fmt.Sprintf("%v@%v:%v", node.IdentityAddress, node.Host, node.PeerPort) +} + +func (node *LndNodeDesc) RpcAddress() string{ + return fmt.Sprintf("%v:%v", node.Host, node.RpcPort) +} + +var TimeoutError = errors.New("Timeout error") + +func ExecWithTimeout(name string, timeout time.Duration, dir string, args...string)(stdOut, stdErr string, err error){ + cmd := exec.Command(name, args...) + cmd.Dir = dir + buffStdOut, buffStdErr := new(bytes.Buffer), new(bytes.Buffer) + cmd.Stdout, cmd.Stderr = buffStdOut, buffStdErr + err = cmd.Start() + if err != nil{ + return + } + done := make(chan error, 1) + go func(){ + done <- cmd.Wait() + }() + select{ + case err=<-done: + case <-time.After(timeout): + err = TimeoutError + // TODO: What to do if call to kill fails? + cmd.Process.Kill() + } + stdOut = buffStdOut.String() + stdErr = buffStdErr.String() + return +} + +type SimNet struct { + // Dir where initial files lives. Do not include trailing slash + SeedDir string + // Temporary dir where simulation is done + WorkDir string + // Dir with BTCD. + btcdDir string + btcdCmd *exec.Cmd + btcdClient *chain.RPCClient + lndDirs []string + lndCmds []*exec.Cmd + lndNodesDesc []LndNodeDesc + btcwalletDir string + btcwalletCmd *exec.Cmd + btcctlDir string +} + +func NewSimNet(lndNodesDesc []LndNodeDesc) *SimNet{ + if lndNodesDesc == nil{ + lndNodesDesc = LndNodesDefault + } + return &SimNet{ + SeedDir: "./simnet", + lndDirs: make([]string, len(lndNodesDesc)), + lndCmds: make([]*exec.Cmd, len(lndNodesDesc)), + lndNodesDesc: lndNodesDesc, + } +} + +// Create simnet directory and copy simulation files +func (sim *SimNet) InitTemp(){ + var err error + sim.WorkDir, err = ioutil.TempDir("", "simnet") + if err == nil{ + log.Print("Temp dir created ", sim.WorkDir) + } else { + log.Fatalf("Can't create temp dir: %v", err) + } + // Go does not include code for copying directories. So usage of external program is the simplest way + _, _, err = ExecWithTimeout( + "cp", + 1*time.Second, "", + "-a", + sim.SeedDir + "/.", + sim.WorkDir, + ) + if err != nil{ + log.Fatalf("Can't copy simnet dir %v", err) + } + sim.btcdDir = filepath.Join(sim.WorkDir, "btcd") + sim.btcwalletDir = filepath.Join(sim.WorkDir, "btcwallet") + sim.btcctlDir = filepath.Join(sim.WorkDir, "btcctl") + for i:=0; i=len(sim.lndNodesDesc)){ + log.Fatalf("Incorrect node i %v, should be from 0 to %v including", i, len(sim.lndNodesDesc)-1) + } + cmd := exec.Command("bash", filepath.Join(sim.lndDirs[i], "start-lnd.sh")) + cmd.Dir = sim.lndDirs[i] + sim.lndCmds[i] = cmd + sim.lndCmds[i].Stdout = new(bytes.Buffer) + sim.lndCmds[i].Stderr = new(bytes.Buffer) + err := cmd.Start() + if err != nil{ + log.Fatalf("Can't start lnd in %v: %v", sim.lndDirs[i], err) + } else { + log.Printf("LND started in %v", sim.lndCmds[i].Dir) + } +} + +// Stop LND node. i should be from 0 to len(sim.lndNodesDesc)-1 +func (sim *SimNet) StopLND(i int){ + if (i<0) || (i>len(sim.lndNodesDesc)-1){ + log.Fatalf("Incorrect node i %v, should be from 0 to %v including", i, len(sim.lndNodesDesc)-1) + } + err := sim.lndCmds[i].Process.Kill() + if err != nil { + log.Fatalf("Can't stop LND: %v", err) + } else { + log.Printf("LND stopped in %v", sim.lndDirs[i]) + } +} + +// Start all lnd nodes and get their identity addresses +func (sim *SimNet) StartAllLnd(){ + for i:=0; i eps { + log.Printf("Onchain balance of node %v is %v which is different from expected balance %v with maximal commision %v", i, balance, expectedBTCBalances[i], eps) + balanceError = true + } + } + if balanceError{ + log.Fatalf("Incorrect Bitcoin balance on chain for some nodes after closing chanel") + } + + sim.StopWallet() + sim.StopBTCD() + sim.RemoveTemp() + log.Print("SUCCESS") +} diff --git a/test/end_to_end/test_multihop.go b/test/end_to_end/test_multihop.go new file mode 100644 index 0000000000..5c346f96bc --- /dev/null +++ b/test/end_to_end/test_multihop.go @@ -0,0 +1,770 @@ +package main +import ( + "os" + "io/ioutil" + "log" + "os/exec" + "time" + "bytes" + "errors" + "path/filepath" + "fmt" + "encoding/json" + "github.com/roasbeef/btcrpcclient" + "github.com/roasbeef/btcwallet/chain" + "github.com/roasbeef/btcd/chaincfg" + "github.com/roasbeef/btcutil" +) + +type LndNodeDesc struct { + WorkDir string + Host string + PeerPort int + RpcPort int + LightningId string + IdentityAddress string +} + +// TODO: Add automatic generation of configuration files and descriptions +var LndNodesDefault []LndNodeDesc = []LndNodeDesc{ + { + WorkDir: "lnd-node1", + Host: "127.0.0.1", + PeerPort: 10011, + RpcPort: 10009, + }, + { + WorkDir: "lnd-node2", + Host: "127.0.0.1", + PeerPort: 11011, + RpcPort: 11009, + }, + { + WorkDir: "lnd-node3", + Host: "127.0.0.1", + PeerPort: 12011, + RpcPort: 12009, + }, + { + WorkDir: "lnd-node4", + Host: "127.0.0.1", + PeerPort: 13011, + RpcPort: 13009, + }, + { + WorkDir: "lnd-node5", + Host: "127.0.0.1", + PeerPort: 14011, + RpcPort: 14009, + }, +} + +func (node *LndNodeDesc) ConnectionAddress() string{ + return fmt.Sprintf("%v@%v:%v", node.IdentityAddress, node.Host, node.PeerPort) +} + +func (node *LndNodeDesc) RpcAddress() string{ + return fmt.Sprintf("%v:%v", node.Host, node.RpcPort) +} + +var TimeoutError = errors.New("Timeout error") + +func ExecWithTimeout(name string, timeout time.Duration, dir string, args...string)(stdOut, stdErr string, err error){ + cmd := exec.Command(name, args...) + cmd.Dir = dir + buffStdOut, buffStdErr := new(bytes.Buffer), new(bytes.Buffer) + cmd.Stdout, cmd.Stderr = buffStdOut, buffStdErr + err = cmd.Start() + if err != nil{ + return + } + done := make(chan error, 1) + go func(){ + done <- cmd.Wait() + }() + select{ + case err=<-done: + case <-time.After(timeout): + err = TimeoutError + // TODO: What to do if call to kill fails? + cmd.Process.Kill() + } + stdOut = buffStdOut.String() + stdErr = buffStdErr.String() + return +} + +type SimNet struct { + // Dir where initial files lives. Do not include trailing slash + SeedDir string + // Temporary dir where simulation is done + WorkDir string + // Dir with BTCD. + btcdDir string + btcdCmd *exec.Cmd + btcdClient *chain.RPCClient + lndDirs []string + lndCmds []*exec.Cmd + lndNodesDesc []LndNodeDesc + btcwalletDir string + btcwalletCmd *exec.Cmd + btcctlDir string +} + +func NewSimNet(lndNodesDesc []LndNodeDesc) *SimNet{ + if lndNodesDesc == nil{ + lndNodesDesc = LndNodesDefault + } + return &SimNet{ + SeedDir: "./simnet", + lndDirs: make([]string, len(lndNodesDesc)), + lndCmds: make([]*exec.Cmd, len(lndNodesDesc)), + lndNodesDesc: lndNodesDesc, + } +} + +// Create simnet directory and copy simulation files +func (sim *SimNet) InitTemp(){ + var err error + sim.WorkDir, err = ioutil.TempDir("", "simnet") + if err == nil{ + log.Print("Temp dir created ", sim.WorkDir) + } else { + log.Fatalf("Can't create temp dir: %v", err) + } + // Go does not include code for copying directories. So usage of external program is the simplest way + _, _, err = ExecWithTimeout( + "cp", + 1*time.Second, "", + "-a", + sim.SeedDir + "/.", + sim.WorkDir, + ) + if err != nil{ + log.Fatalf("Can't copy simnet dir %v", err) + } + sim.btcdDir = filepath.Join(sim.WorkDir, "btcd") + sim.btcwalletDir = filepath.Join(sim.WorkDir, "btcwallet") + sim.btcctlDir = filepath.Join(sim.WorkDir, "btcctl") + for i:=0; i=len(sim.lndNodesDesc)){ + log.Fatalf("Incorrect node i %v, should be from 0 to %v including", i, len(sim.lndNodesDesc)-1) + } + cmd := exec.Command("bash", filepath.Join(sim.lndDirs[i], "start-lnd.sh")) + cmd.Dir = sim.lndDirs[i] + sim.lndCmds[i] = cmd + sim.lndCmds[i].Stdout = new(bytes.Buffer) + sim.lndCmds[i].Stderr = new(bytes.Buffer) + err := cmd.Start() + if err != nil{ + log.Fatalf("Can't start lnd in %v: %v", sim.lndDirs[i], err) + } else { + log.Printf("LND started in %v", sim.lndCmds[i].Dir) + } +} + +// Stop LND node. i should be from 0 to len(sim.lndNodesDesc)-1 +func (sim *SimNet) StopLND(i int){ + if (i<0) || (i>len(sim.lndNodesDesc)-1){ + log.Fatalf("Incorrect node i %v, should be from 0 to %v including", i, len(sim.lndNodesDesc)-1) + } + err := sim.lndCmds[i].Process.Kill() + if err != nil { + log.Fatalf("Can't stop LND: %v", err) + } else { + log.Printf("LND stopped in %v", sim.lndDirs[i]) + } +} + +// Start all lnd nodes and get their identity addresses +func (sim *SimNet) StartAllLnd(){ + for i:=0; i