mirror of
https://github.com/ACINQ/eclair.git
synced 2025-03-27 02:37:06 +01:00
update TESTING.md
This commit is contained in:
parent
f0c447a189
commit
2ad3dcde82
1 changed files with 51 additions and 11 deletions
62
TESTING.md
62
TESTING.md
|
@ -1,7 +1,8 @@
|
|||
# Testing eclair and lightningd
|
||||
|
||||
## Configure bitcoind to run in regtest mode
|
||||
edit ~/.bitcoin/bitcoin.conf and add:
|
||||
Important: you need a segwit version of bitcoin core for this test (see https://github.com/sipa/bitcoin/tree/segwit-master).
|
||||
Make sure that bitcoin-cli is on the path and edit ~/.bitcoin/bitcoin.conf and add:
|
||||
```shell
|
||||
server=1
|
||||
regtest=1
|
||||
|
@ -9,17 +10,37 @@ rpcuser=***
|
|||
rpcpassword=***
|
||||
```
|
||||
|
||||
make sure that bitcoin-cli is on the path
|
||||
To check that segwit is enabled run:
|
||||
```shell
|
||||
bitcoin-cli getblockchaininfo
|
||||
```
|
||||
and check bip9_softforks:
|
||||
|
||||
```
|
||||
...
|
||||
"bip9_softforks": {
|
||||
"csv": {
|
||||
"status": "active",
|
||||
"startTime": 0,
|
||||
"timeout": 999999999999
|
||||
},
|
||||
"witness": {
|
||||
"status": "active",
|
||||
"startTime": 0,
|
||||
"timeout": 999999999999
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Start bitcoind
|
||||
Mine a few blocks:
|
||||
Mine enough blocks to activate segwit blocks:
|
||||
```shell
|
||||
bitcoin-cli generate 101
|
||||
bitcoin-cli generate 500
|
||||
```
|
||||
##
|
||||
Start lightningd (here we’ll use port 50000)
|
||||
Start lightningd (here we’ll use port 46000)
|
||||
```shell
|
||||
lightningd --port 50000
|
||||
lightningd --port 46000
|
||||
```
|
||||
##
|
||||
Start eclair:
|
||||
|
@ -31,7 +52,7 @@ mvn exec:java -Dexec.mainClass=fr.acinq.eclair.Boot
|
|||
```shell
|
||||
curl -X POST -H "Content-Type: application/json" -d '{
|
||||
"method": "connect",
|
||||
"params" : [ "localhost", 50000, 1000000 ]
|
||||
"params" : [ "localhost", 46000, 3000000 ]
|
||||
}' http://localhost:8080
|
||||
```
|
||||
Since eclair is funder, it will create and publish the anchor tx
|
||||
|
@ -40,7 +61,19 @@ Mine a few blocks to confirm the anchor tx:
|
|||
```shell
|
||||
bitcoin-cli generate 10
|
||||
```
|
||||
eclair and lightningd are now both in NORMAL state (high priority for eclair, low priority for lightningd)
|
||||
eclair and lightningd are now both in NORMAL state.
|
||||
You can check this by running:
|
||||
```shell
|
||||
lightning-cli getpeers
|
||||
```
|
||||
or
|
||||
```shell
|
||||
curl -X POST -H "Content-Type: application/json" -d '{
|
||||
"method": "list",
|
||||
"params" : [ ]
|
||||
}' http://localhost:8080
|
||||
```
|
||||
|
||||
|
||||
## Tell eclair to send a htlc
|
||||
We’ll use the following values for R and H:
|
||||
|
@ -53,19 +86,26 @@ You’ll need a unix timestamp that is not too far into the future. Now + 100000
|
|||
```shell
|
||||
curl -X POST -H "Content-Type: application/json" -d "{
|
||||
\"method\": \"addhtlc\",
|
||||
\"params\" : [ \"1\", 100000, \"8cf3e5f40cf025a984d8e00b307bbab2b520c91b2bde6fa86958f8f4e7d8a609\", $((`date +%s` + 100000)) ]
|
||||
\"params\" : [ 70000000, \"8cf3e5f40cf025a984d8e00b307bbab2b520c91b2bde6fa86958f8f4e7d8a609\", $((`date +%s` + 100000)), \"021acf75c92318d3723098294d2a6a4b08d9abba2ebb5f2df2b4a8e9153e96a5f4\" ]
|
||||
}" http://localhost:8080
|
||||
```
|
||||
|
||||
## Tell eclair to commit its changes
|
||||
```shell
|
||||
curl -X POST -H "Content-Type: application/json" -d "{
|
||||
\"method\": \"sign\",
|
||||
\"params\" : [ \"d3f056a084e266ad06ea1ca28a1e080ca07c6b61fac7ce116e48a5c31d688eee\" ]
|
||||
}" http://localhost:8080
|
||||
```
|
||||
## Tell lightningd to fulfill the HTLC:
|
||||
```shell
|
||||
./lightning-cli fulfillhtlc 0277863c1e40a2d4934ccf18e6679ea949d36bb0d1333fb098e99180df60d0195a 0102030405060708010203040506070801020304050607080102030405060708
|
||||
./lightning-cli fulfillhtlc 03befb4f8ad1d87d4c41acbb316791fe157f305caf2123c848f448975aaf85c1bb 0102030405060708010203040506070801020304050607080102030405060708
|
||||
```
|
||||
Check balances on both eclair and lightningd
|
||||
|
||||
## Close the channel
|
||||
```shell
|
||||
./lightning-cli close 0277863c1e40a2d4934ccf18e6679ea949d36bb0d1333fb098e99180df60d0195a
|
||||
./lightning-cli close 03befb4f8ad1d87d4c41acbb316791fe157f305caf2123c848f448975aaf85c1bb
|
||||
```
|
||||
Mine a few blocks to bury the closing tx
|
||||
```shell
|
||||
|
|
Loading…
Add table
Reference in a new issue