Commit graph

18 commits

Author SHA1 Message Date
Sergi Delgado Segura
7093882f47
Properly patches sendrawtransaction so it does not crash
Currently, when mocking sendrawtransaction so it does nothing, the client will raise an exception
given the picked lambda does not accept any params (and sendrawtransaction has some). Patches it
so this does not happen.

This patch is pretty minimal, given the behavior wrt CLN does not change, but it feels better not to
except here.
2023-07-18 14:08:00 -04:00
Sergi Delgado Segura
d50ce639bf
Improves tor flag logic in watchtower-plugin
The `watchtower-plugin` was specifying a custom tor flag to signal whether Tor may be used by the client. This was due to `cln-plugin (v0.1.1-)` not allowing plugins to access the CoreLN configuration options and, therefore, our plugin was unable to fetch the `proxy` / `always-use-proxy` options.

This fetches the aforementioned options and revamps the logic to comply with the `always-use-proxy` requirements, that is, if the flag is set all communications must be performed using Tor. Also, it replaces some of the currently used `String`s for more meaningful types to store network data (such as `AddressType`, `NetAddress`, or `ProxyInfo`).

This drops our custom `watchtower-proxy` config option
2023-01-20 08:37:03 -05:00
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
cc7acf6201
Adds watchtower-plugin autoretry tests 2023-01-10 13:20:26 +01: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
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
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
a20065567f
Changes rpc commands naming from snake case to lower case 2022-11-08 14:13:27 +01:00
Sergi Delgado Segura
b6e223a4ed
Bumps version to 0.1.2
Makes it so the .rs files pull the version info from the Cargo files so it is always consistent
2022-09-20 12:41:59 +00:00
meryacine
f6a60a9655 Rework the retrier
This is an attempt to rework the retrier logic to simplify how it works
and make it less error prone. This is done by making the retry manager
object responsible for both:
1- adding new retriers and extending current ones
2- removing retriers when they finish their work

This way, we don't need a mutex to gaurd the retriers hashmap & we are
sure there is no adding/extending retriers and removing them happending
at the same time, because only the retry manager does it and not
single retriers (i.e. retriers can't remove themselves from the retriers
hashmap).

The retry manager logic goes as follows:
1- drain the unreachable towers channel till it's empty, and store the pending appointments (locators to be exact) in the pending appointments set for each retrier.
2- remove any finished retrier (ones that succeeded and have no more pending appointments) and failed retriers (ones that failed to send their appointments).
3- start all the non-running retriers left after removing failed and finished retrieres.

Retriers will signal thier status so that the retry manager could
determine which retriers to keep, which to remove, and which to re-start.

We also set tower as unreachable when destroying the tower's retrier
and not after completing backoff. This makes it so that the tower is
unreachable until its retrier is destroyed, thus manual tower retry
by the user will fail with an error till the tower's retrier is destroyed.

If we were to set the unreachable tower status after the backoff, then manual
user retries might get discarded completely without an error because retrier
set the tower state to unreachable too early thus allowing the user to
perform manual retries, but if the user does manual retry, it won't get
carried out, since the retry manager will remove that retrier anyway as
it failed to deliver its pending appointments.
2022-09-16 23:44:43 +02:00
Sergi Delgado Segura
c5f9c3a8c4 Fix #84 and revamps the retrier 2022-09-16 23:44:21 +02:00
Sergi Delgado Segura
21c82dcc87 Fixes E2E test test_watchtower
`watchtower-plugin::tests::test::test_watchtower` was not properly checking that
an appointment could not be found after resolving. This was due to an off-by-one error
that made the resolution not actually happening.
2022-09-02 08:48:13 +03:00
Sergi Delgado Segura
7e7dc973f5 Fixes Tracker serialization for get_all_appointments
close #64
2022-08-16 12:08:27 +02:00
Sergi Delgado Segura
4a73548065 Adds a timeout to Python tests that may wait forever
Some E2E test for the CLN plugin have conditional waits that may wait forever
if the code has a bug. Set a timeout for an early fail so we don't have to waste
CI time.
2022-07-12 09:52:26 +02:00
Sergi Delgado Segura
b0e169a549 Minor fixes re: tests and logs
- Adds a log to signal the tower is ready
- Updates the message to wait for in tests
- Removes unnecessary logs in tls
- Sets tests to run in SLOW MACHINE mode, given tests tend to fail in CI
apparently due to that
2022-07-11 16:28:32 +02:00
Sergi Delgado Segura
6fd6ebb0b9 Renames watchtower-plugin binary to watchtower-client
CLN logs plugin entries as:

plugin-<plugin-name> so by calling the binary `watchtower-plugin` the log
lines read plugin-watchtower-plugin, which is quite redundant. plugin-watchtower-client
seems more adequate.
2022-07-07 15:10:25 +02:00
Sergi Delgado Segura
ba4f8641c4 Adds watchtower-plugin E2E tests 2022-07-07 15:08:12 +02:00