Commit graph

201 commits

Author SHA1 Message Date
dzdidi
b3a621a781
Update dependencies
- Add toolchain
- Common:
  - bitcoin v0.32.0;
  - lightning v0.1.0
- TEOS:
  - bitcoin v0.32.0;
  - bitcoincore-rpc v0.19.0;
  - lightning v0.1.0;
  - lightning-net-tokio v0.1.0;
  - lightning-block-sync v0.1.0
- Watchtower-Plugin:
  - bitcoin v0.32.0;
  - cln-plugin v0.3.0
2025-03-25 12:06:21 +01:00
Sergi Delgado Segura
81a659c0f6
Bumps tonic to 0.11 and prost to 0.12, adapts Cargo files accordingly
Bumping tonic required cargo file edition to be bumped to 2021
2024-07-29 16:27:32 -04:00
Sergi Delgado Segura
bb2df6a700
Bumps rcgen to version 0.13.1 and updates tls.rs accordingly
rcgen was using version 0.8 which used a ring version that didn't support
ppc64le arch. Support for it was recently added in ring=0.17.0 and supported by
rcgen in 0.13
2024-07-29 16:27:29 -04:00
Sergi Delgado Segura
d30fc7d121
Fixes clippy issues 2024-07-29 13:12:27 -04:00
Sergi Delgado Segura
37a75ec6e7
Adds rpccookie to bitcoind auth methods
Currently we are authenticating against bitcoind using user/pass. This adds
the option to use a cookie file instead.
2024-03-28 10:09:30 +01:00
Sergi Delgado Segura
52ebbe6e06
Fixes clippy issues in dbm.rs 2024-03-28 09:41:55 +01:00
Sergi Delgado Segura
e6495c31aa
Fixes clippy issues
Clippy is complaining about using `.get(0)` instead of `.fist()` in methods
where we are getting more than just the first item. Suppress those warning.

Also fixes some actual issues.
2024-01-08 14:18:59 -05:00
Omer Yacine
cab6151ccc
Getting rid of in-memory data to avoid unbounded memory growth
Regrading the `Watcher`, fields (appointments, locator_uuid_map) has
been replaced by DB calls when needed.

For `Responder`, the field `trackers` has been replaced by DB calls when
needed, and `tx_tracker_map` wasn't actually needed for the tower to
operate, so was just dropped.

For `GateKeeper`, `registered_users::appointments` which used to hold
the uuids of every appointment the user submitted was removed so that
`registered_users` only holds meta information about users.

Also now the gatekeeper is the entity responsible for deleting appointments from the database. Instead of the watcher/responder asking the gatekeeper for the users to update and carry out the deletion and update itself, now the watcher/responder will hand the gatekeeper the uuids to delete and the gatekeeper will figure out which users it needs to update (refund the freed slots to).

Also now, like in `Watcher::store_triggered_appointment`, if the appointment is invalid or was rejected by the network in block connections, the freed slots will not be refunded to the user.

Also the block connection order starts with the gatekeeper first, this
allows the gatekeeper to delete the outdated users so that the watcher
and the responder doesn't take them into account.
2023-09-01 16:39:54 +03:00
Omer Yacine
fad3ad1c08
dropping last_known_blocks after using it
`last_known_blocks` was taking up ~300migs of memory (for 100 blocks) because it was not dropped in `main`.

Co-authored-by: Sergi Delgado Segura <sergi.delgado.s@gmail.com>
2023-09-01 16:31:54 +03:00
Omer Yacine
8df58f99d1
loading minimal data during bootstrap
By loading the minimal necessary data during bootstrap, we get lower
memory usage and faster bootstrapping.

Co-authored-by: Sergi Delgado Segura <sergi.delgado.s@gmail.com>
2023-09-01 16:31:50 +03:00
optimm
565eda42ba
printing the cli errors to standard error stream
Added a function that prints the error to the standard error stream and exits the process with a status code of 1, this is to seprate the cli errors from regular output
2023-08-09 11:37:55 +05:30
Sergi Delgado Segura
ed78c89613
Fixes clippy issues, updates warp
Fixes some clippy issues with rustc 1.71.0 and updates warp to fix some address
some warnings regarding `buf_redux v0.8.4` and `multipart v0.18.0`
2023-07-24 11:05:27 -04:00
Sergi Delgado Segura
2bf555c07f
Adds --forceupdate to teosd
If a tower hasn't been running for a long time and the backend runs in pruned
mode it could be the case that by the time the tower comes back online, the Last
known block by the tower is not being known by the node anymore. In this situation,
the tower cannot bootstrap normally, given the cache cannot be populated.

This commits adds a new argument to teosd (`--forceupdate`) that can be used to
force a tower to update its last known block to the earliest known block by the backend
under this situation. Notice that doing so may make the tower miss some of its state
transitions (the ones triggered by missed blocks), so this must be done as a last resource.
2023-05-09 09:49:11 -04:00
Sergi Delgado Segura
c0f4ebc82c
Makes teos-cli cannot connect to backend error message more friendly
Let's not just spit a debug error when calling `teos-cli` pointing to an unreachable backend.
2023-05-08 21:53:56 -04:00
Anmol Agrawal
2229251702
Implements ping/pong logic for the tower and CLN plugin
Implements ping/pong logic for the tower and CLN plugin
Modification in test as suggested and some more

Some fixed

Signed-off-by: Anmol Agrawal <anmol2002.aa1@gmail.com>
2023-05-02 07:49:24 +05:30
anipaul2
ca577c558b
Improve log messages for data directory and configuration details
This commit enhances the logging output to provide clearer information
about the data directory and configuration file details. By providing
this information, it improves the user experience and make it easier for
users to find and understand the relevant paths and settings.
2023-05-02 01:36:19 +05:30
Sergi Delgado Segura
801ef5d808
Removes unnecessary into_iter from Responder tests
The conversion was triggering https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
2023-03-13 12:54:02 +01:00
Sergi Delgado Segura
939d87c0f0
Makes http::serve take a SocketAddr instead of a String
`PublicTowerServicesClient::connect` needs `dest` to be `std::convert::TryInto<tonic::transport::Endpoint>`
hence why we were passing a `String`. However, we'll be better of passing something that's `Copy`, like
`SocketAddr` and converting to `String` here.
2023-02-24 22:37:55 +01:00
Sergi Delgado Segura
f628b358db
Replaces Result<T, E> for Option<T> in DBM load methods
The `DBM` methods related to loading data return `Result<T, E>` where `E` is always `dbm::Error::NotFound`.

It may makes more sense make them return `Option<T>`.
2023-02-20 11:26:38 +01:00
Sergi Delgado Segura
4bcfbf7c5d
Formats strings to use inline params when possible 2023-02-06 22:56:09 +01:00
Omer Yacine
75db9c6519
fixup: record the correct port for the Tor interface 2023-02-06 18:18:40 +02:00
Sergi Delgado Segura
403044298f
Updates teosd.service, adds tor link 2023-02-06 16:15:09 +01:00
Sergi Delgado Segura
5cf9029fe9
Bumps teos version to 0.2 in preparation for code release 2023-01-23 17:45:20 -05:00
Sergi Delgado Segura
72b1805c1b
Adds logs to RPC requests and improves the ones for the http interface
Also updates the severity from the http logs from info to debug
2023-01-23 17:44:29 -05:00
Sergi Delgado Segura
44df8bb6f3
Defines Endpoint enum to avoid using hardcoded strings as endpoints
Useful for both the tower API and the clients
2023-01-20 08:55:22 -05:00
Sergi Delgado Segura
39e817c51b
Fixes clippy related issues 2023-01-10 13:20:27 +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
Jonathan Plasse
f7d144c6f3
Refactor to avoid using SELECT * 2022-12-11 16:19:16 +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
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
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
a20065567f
Changes rpc commands naming from snake case to lower case 2022-11-08 14:13:27 +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
8e44159dd6
Fixes an uncaught clippy issue prior to rust 1.65.0 2022-11-04 19:09:38 +01:00
Sergi Delgado Segura
22dc24c561
Removes debug from teos-cli
teos-cli is not using logging, so the debug flag was useless.
2022-11-03 12:10:38 +01:00
Sergi Delgado Segura
0ca6f80149
Splits log levels into local and third party libs
The log level was setup equally between local code and third party libs, making
really verbose libs log a lot of unnecessary data when setting loglevel to debug
for instance.

This splits the loglevel config option into two: `debug` and `depsdebug`. The latter
covers third party libs.
2022-11-03 12:10:38 +01:00
Sergi Delgado Segura
b1b1d83659
Removes chunked-transfer from deps
chunked-transfer was used in an old version of the test suite for a custom HTTP server.
The test server was removed in bbd3857c70, hence the dependency was
never used from that point on.
2022-09-21 10:45:04 +00: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
6461e7e72b
teosd: Normalize bitcoin chain network naming 2022-09-20 12:42:46 +02:00
meryacine
b0f294a17b
teosd: Sanity check that bitcoind is running on the specified network 2022-09-20 08:29:26 +02:00
Sergi Delgado Segura
fec3790494 Fixes #119
Wraps `CloseHandle` inside `BitcoindStopper` and implements `Drop` for the latter so the server does not need to be manually stopped
2022-09-17 14:33:28 +02:00
meryacine
388c643109
tests: Fix with_height may produce invalid blocks
`with_height` test method might produce invalid blocks because, after #79, we can't create empty blocks any more, and some random txs might result in a not enough proof of work as in #56
2022-09-17 14:18:32 +02:00
Sergi Delgado Segura
b2dc2e908b Simplifies bind_with_graceful_shutdown for http api
`bind_with_graceful_shutdown` requires the shutdown signal to implement `std::future::Future`.
Turns out `triggered::Listener` already does, so there is no need to wrap this in an async block.
2022-08-30 13:45:39 +02:00
Sergi Delgado Segura
013df67402 Adds a ready signal for the http API
In normal conditions, if the http API cannot bootstrap (due to the gRPC
server being temporary unavailable) it will just retry until it connects.

However, this is done asynchronously, meaning that it could be the case that
the tower is reported as ready when it is actually not. This can be hit during
E2E testing if the tower is restarted too quickly, resulting in a test failure:

https://github.com/sr-gi/rust-teos/runs/8074272734?check_suite_focus=true#step:9:5543
https://github.com/sr-gi/rust-teos/runs/8074272734?check_suite_focus=true#step:9:6970
2022-08-30 13:45:39 +02:00
Sergi Delgado Segura
a1aea5dcec Avoid having to hit the db if there is no data to delete 2022-08-30 13:30:48 +02:00
Sergi Delgado Segura
47ba8b0cb9 Makes Tor task panics more user friendly 2022-08-26 15:10:20 +02:00
Sergi Delgado Segura
e70561d39e Updates register for re-register
Makes it so if a user registers more than once the expiry is not based on the current
height but on the old expiry.
2022-08-24 15:50:36 +02:00
Sergi Delgado Segura
3b7842a0f4 Properly capitalizes Tor
See https://support.torproject.org/about/why-is-it-called-tor/
2022-08-22 11:37:32 +02:00