Commit graph

429 commits

Author SHA1 Message Date
Sergi Delgado Segura
31defe24f7
Patches watchtower-plugin test_get_appointment e2e
test_get_appointment fails when the plugin is asked about a given tracker before the
tower is able to process the appointment to tracker transition. This doesn't happen consistently,
but we've seen the error popping up every now and then.

Simply add a log based waiting to make sure the state transition is performed before asserting.
2023-01-10 13:50:58 +01:00
Sergi Delgado Segura
8c08b5fcd7
Merge pull request #168 from sr-gi/cln-plugin-auto-retry
Adds auto-retry logic to watchtower-plugin
2023-01-10 13:49:26 +01:00
Sergi Delgado Segura
39e817c51b
Fixes clippy related issues 2023-01-10 13:20:27 +01:00
Sergi Delgado Segura
09b65ef513
Fixes bug regarding re-registering
The re-register logic had a bug where the `TowerSummary` that was kept in memory
after re-registering was sweeping the references to both the pending and invalid appointments.

While this data was still in the database, re-registering may have made it look like the data was not there.
2023-01-10 13:20:27 +01:00
Sergi Delgado Segura
cc7acf6201
Adds watchtower-plugin autoretry tests 2023-01-10 13:20:26 +01:00
Sergi Delgado Segura
07caee2dbd
Revamps the cln-pugin to support retrying towers automatically
- Updates `Retrier::run` to return more meaningful errors. `Retrier::run` used to simply return a message,
revamps it to return RetryError variants so we can handle return cases better.

- Adds an additional state to `RetrierStatus`: Idle. Retries that fail due to an accumulation of transient errors will be flagged
as Idle instead of Failed and retried later on (based on `auto_retry_delay`). Notice Retrier data is not kept in memory while a retrier is Idle. Instead, data is cleared and loaded again from the database when the `Retrier` is ready to run again.

- Revamps how revocation data is sent to the `RetryManager`: The RetrierManager used to received locators one by one via unreachable_towers. This is due to them being mainly fed by `on_commitment_revocation`, which generates them one by one. However, both when manually retrying or when bootstrapping from an already populated database, multiple appointments may be pending for the same tower, hence needing to call `unreachable_towers.send` multiple times for the same tower. This itself was not a big deal, given we didn't really needed to differentiate between the cases. We do now though.
In order to implement periodic retries while allowing manual retries we need to be able to signal the state transition to the
`Retrier` without providing any new data:

- If a Retrier is idle and we receive data trough `on_commitment_revocation` we need to append that data to the `Retrier`.
- If a Retrier is iddle and we receive data trough a manual retry, we need to change the state of the `Retrier` without
  adding any new data to it.

In order to implement this we've added an additional map to `WTClient` that reports the state of the active retriers. Retriers are active only if they are running or idle.

- Also reworks `WTClient::set_tower_status` to update the status only if the new one does not match the old one.
This is simply to reduce the boiler plate of having to perform this check in other pats of the plugin codebase.
2023-01-10 13:20:26 +01:00
Sergi Delgado Segura
909a0dac5b
Merge pull request #171 from weareseba/bugfix/btcnetwork
using mainnet rather than bitcoin in the output of the help command
2023-01-10 13:19:55 +01:00
Richard Ulrich
4a7a2e0228
using mainnet rather than bitcoin in the output of the help command 2023-01-09 12:35:23 +01:00
Sergi Delgado Segura
1faf361a7f
Merge pull request #134 from sr-gi/cln-json-params
Adds named arguments to CoreLN plugin
2022-12-14 13:15:23 -06:00
Sergi Delgado Segura
d0a476d4af
Adds named arguments to CoreLN plugin 2022-12-14 11:59:19 -06:00
Sergi Delgado Segura
ae91cd5ecb
Merge pull request #164 from sr-gi/69-auto-renew-v2
Implements auto-register for the watchtower-client
2022-12-13 09:34:37 -06:00
Sergi Delgado Segura
e816d9e152
Adds a helper fn to get tower_status from WTClient
This helps reducing some of the WTClient is queried only to get the tower status
2022-12-12 10:30:59 -06:00
Sergi Delgado Segura
a6ef6946ab
Implements auto-register for the watchtower-plugin 2022-12-12 10:30:56 -06:00
Sergi Delgado Segura
d811760db7
Merge pull request #135 from sr-gi/cln-strs
Minor improvements regarding Strings in cln-plugin
2022-12-11 11:47:27 -06:00
Sergi Delgado Segura
b5f9a1e037
into() -> to_owned() for Strings
`to_owned` is more explicit.
2022-12-11 11:15:50 -06:00
Sergi Delgado Segura
f7153c4933
Replaces net_addr params from String to &str 2022-12-11 11:15:50 -06:00
Sergi Delgado Segura
cfca86fdba
Merge pull request #107 from JonathanPlasse/refactor-select-star
Refactor to avoid using `SELECT *`
2022-12-11 10:42:48 -06:00
Jonathan Plasse
f7d144c6f3
Refactor to avoid using SELECT * 2022-12-11 16:19:16 +01:00
Sergi Delgado Segura
af6cc8d584
Merge pull request #110 from JonathanPlasse/replace-base_url-by-address
Replace server.address() by server.base_url()
2022-12-10 11:22:31 -06:00
Jonathan Plasse
1e295e1661
Replace server.address() by server.base_url()
Signed-off-by: Jonathan Plasse <13716151+JonathanPlasse@users.noreply.github.com>
2022-12-10 16:27:27 +01:00
Sergi Delgado Segura
dc02abd6ed
Merge pull request #167 from sr-gi/e2e-test-no-sleep
Replaces sleep based waiting for log entry lookups
2022-12-10 09:34:27 -05:00
Sergi Delgado Segura
14176bd31d
Fixes #156
`TeosD` outputDir was being set to the same directory use by the test suite.
That cause it to be logging in the same log file, potentially colluding for
read/write operations. Setting the outputDir to it's own location fixed the issue.
2022-12-09 17:18:36 -06:00
Sergi Delgado Segura
5177446629
Replaces sleep based waiting for log entry lookups
Replaces time.sleep in the `watchtower-plugin` tests to wait for certain things to happen
on the backend by wait_for_logs, which should be less error prone

Also does some reformating and removes unnecessary imports
2022-12-09 16:23:02 -06:00
Sergi Delgado Segura
6f8ac04482
Merge pull request #166 from sr-gi/failed-register-status
Avoids setting the state of unregistered towers
2022-12-09 17:22:18 -05:00
Sergi Delgado Segura
da3daddba8
Avoids setting the state of unregistered towers 2022-12-08 05:57:31 -05:00
Sergi Delgado Segura
831454d505
Merge pull request #161 from sr-gi/fix-159
Removes redundant sanity check for Retrier::start
2022-12-01 12:20:34 +01:00
Sergi Delgado Segura
246511d0bc
Removes redundant sanity check for Retrier::start 2022-11-30 10:31:33 +01:00
Sergi Delgado Segura
c14c7364fd
Merge pull request #151 from sr-gi/gettowerinfo_addresses
Adds addresses field to `gettowerinfo`
2022-11-25 15:47:38 +01:00
Sergi Delgado Segura
0c1b4c17b4
Adds addresses to gettowerinfo 2022-11-25 14:25:53 +01:00
Sergi Delgado Segura
441a37155d
Revamps tor.rs so the onion address can be queried 2022-11-25 14:25:48 +01:00
Sergi Delgado Segura
44daa84cbc
Merge pull request #157 from sr-gi/tmp-patch-156
Adds a fixed sleep so `TeosD` has time to bootstrap in the `watchtower-plugin` tests
2022-11-25 13:52:17 +01:00
Sergi Delgado Segura
f63738e038
Adds a fixed sleep so TeosD has time to bootstrap in the watchtower-plugin tests
This is a hotfix and should be properly fix
2022-11-24 17:19:09 +01:00
Sergi Delgado Segura
5241741e76
Merge pull request #153 from sr-gi/cln-plugin-0.1.1
Minimal changes to make the plugin compatible with cln-plugin 0.1.1
2022-11-23 18:24:33 +01:00
Sergi Delgado Segura
6c6d423054
Minimal changes to make the plugin compatible with cln-plugin 0.1.1 2022-11-22 18:26:01 +01:00
Sergi Delgado Segura
409eea8da6
Merge pull request #150 from mariocynicys/docs-lockin-installs
use --locked with cargo install
2022-11-12 15:48:52 -03:00
Omer Yacine
d212aae0da
use --locked with cargo install
Using --locked with cargo install(s) will instruct cargo to use the lock file in the repo (Cargo.lock).
So all the users' builds will be identical to builds in the master branch.

Signed-off-by: Omer Yacine <mariocynicys@gmail.com>
2022-11-12 20:32:10 +02:00
Sergi Delgado Segura
832dd71ae5
Merge pull request #145 from sr-gi/tor-default-port
Changes the onion hidden service port to match the clearnet API port
2022-11-12 12:09:55 -03:00
Sergi Delgado Segura
c4b5fd1eb1
Changes the onion hidden service port to match the clearnet API port
Turns out both the clearnet API and the Tor hidden service can be run on the same
port.
2022-11-12 11:52:27 -03:00
Sergi Delgado Segura
eef55adb0c
Merge pull request #146 from sr-gi/fix-end-proxy-redirection
Fixes tor proxy redirection
2022-11-12 11:51:36 -03:00
Sergi Delgado Segura
ecaba32e3e
Fixes tor proxy redirection
Traffic routed trough Tor was being redirected to localhost indistinguishably of whether
the public http API was being offered there or not. This made the tower unavailable
(trough Tor) when it was being offered both in clearnet and Tor.
2022-11-12 11:33:16 -03:00
Sergi Delgado Segura
efda0ad7ca
Merge pull request #149 from sr-gi/track-cargo-lock
Tracks Cargo.lock
2022-11-12 11:31:06 -03:00
Sergi Delgado Segura
12f8b48f57
Tracks Cargo.lock
Rationale: https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
2022-11-12 10:37:00 -03:00
Sergi Delgado Segura
6f107361ab
Merge pull request #144 from sr-gi/rpc_commands_lower_case
Changes rpc commands naming from snake case to lower case
2022-11-10 09:58:41 -03:00
Sergi Delgado Segura
a20065567f
Changes rpc commands naming from snake case to lower case 2022-11-08 14:13:27 +01:00
Sergi Delgado Segura
eb40ac0141
Merge pull request #132 from sr-gi/130-txindex
Implements an internal txindex so we don't have to run bitcoind with `txindex=1`
2022-11-07 12:30:19 +01:00
Sergi Delgado Segura
221358d6d4
Updates docs regarding txindex 2022-11-07 11:57:50 +01:00
Sergi Delgado Segura
1788b4d722
Adds TxIndex to Responder 2022-11-07 11:57:44 +01:00
Sergi Delgado Segura
770b6e6db7
Generalizes LocatorCache into a TxIndex
In order to fix #130 we need to implement our own txindex. Turns out this is almost identical
to our `LocatorCache`, so we can generalize it and use it for both purposes.
2022-11-07 11:57:38 +01:00
Sergi Delgado Segura
e7ad7a4ef7
Merge pull request #141 from sr-gi/update-actions
Updates actions
2022-11-04 19:23:56 +01:00
Sergi Delgado Segura
8e44159dd6
Fixes an uncaught clippy issue prior to rust 1.65.0 2022-11-04 19:09:38 +01:00