Commit Graph

289 Commits

Author SHA1 Message Date
Sergi Delgado Segura
a49e587d7c watcher - adds RWLocks for the LocatorCache
Threads should aboit reading the cache when it is being updated/fixed. The latter is specially relevant since during a reorg most of the cache may change.
2020-06-15 11:25:26 +02:00
Sergi Delgado Segura
df326465a7 watcher - Updates the LocatorCache so it is self handled
With the current approach the cache deals with deletion and provides getters and setters so consumers do not directly access the internals
2020-06-10 17:44:50 +02:00
Sergi Delgado Segura
2facd61f6c teos - addresses minor comments from #149 2020-06-09 16:59:01 +02:00
Sergi Delgado Segura
08c794590c teos - additional docs 2020-06-03 17:39:27 +02:00
Sergi Delgado Segura
6ea3e8e3ff watcher - simplifies locator_cache and check_breach
locator_cache.blocks was storing a dictionary with both the locator and txid pair, when only the locators were actually necessary. Reworks the code a bit to only use locators.
check_breach was returning some values that could be worked out from the unaltered inputs.

Also fixes some comments and docs.
2020-06-03 17:23:29 +02:00
Sergi Delgado Segura
37d1bd9b12 testing - fixes e2e test utxo management
e2e tests where reusing utxos for transactions that where not confirmed, meaning than some times we were actually sending the same appointment over and over.
2020-06-02 20:05:13 +02:00
Sergi Delgado Segura
e1aab63940 tests - unit tests LocatorCache reorg protection 2020-05-22 19:57:48 +02:00
Sergi Delgado Segura
2a52006c03 tests - Removes Wartcher from LocatorCache tests 2020-05-22 19:56:16 +02:00
Sergi Delgado Segura
77d1ea21c8 teos - BLOCK_CACHE_SIZE -> LOCATOR_CACHE_SIZE 2020-05-22 19:56:11 +02:00
Sergi Delgado Segura
c05f96b738 tests - Adds e2e tests to cover the cache 2020-05-22 18:25:08 +02:00
Sergi Delgado Segura
386642ff42 Adds checks of add_appointment returning current block 2020-05-22 14:18:37 +02:00
Sergi Delgado Segura
708f2e1f3b teos - Changes the behavior for updates of already triggered appointments
If an update for an already triggered appointment is received, it will be drop no matter if the locator is in the cache or not. This tries to prevent inconsistencies between the Watcher and the Responder, specially in the case of a reorg when data may have to flow backwards.
2020-05-21 19:37:33 +02:00
Sergi Delgado Segura
3228eeac6b tests - Adds LocatorCache unittests and updates existing ones to match 2020-05-21 17:06:20 +02:00
Sergi Delgado Segura
88c19d5a0d teos - moves errors to common so it can be used by clients 2020-04-29 13:03:39 +02:00
Sergi Delgado Segura
75ca281cc4 api - updates errors and separates error from message in api errors responses 2020-04-27 19:51:38 +02:00
Sergi Delgado Segura
4c1f95ca77 e2e - updates e2e tests 2020-04-22 14:56:25 +02:00
Sergi Delgado Segura
f810607348 responder - wipes completed/expired data from the gatekeeper 2020-04-22 14:55:43 +02:00
Sergi Delgado Segura
e7141b295e watcher - wipes completed/expired appointments from the Gatekeeper 2020-04-22 14:55:10 +02:00
Sergi Delgado Segura
f66e4785f2 cleaner - adds delete_gatekeeper_appointments
delete_gatekeeper_appointments takes care of deleting data from the Gatekeeper once it has expired / it has been completed
2020-04-22 14:53:58 +02:00
Sergi Delgado Segura
69e9c12258 gatekeeper reformats update_available_slots to add_update_appointment
- add_update_appointment handles the slot count and also keeps a copy of the appointment uuid and slots taken.
- gatekeeper.appointments is turned to a dict uuid:slots so appointment updates can be computed with no further data
- deleting appointment will also allow to update the slot count with no further data from both the Watcher and the Responder
2020-04-22 14:50:13 +02:00
Sergi Delgado Segura
eb6d292d3c extended_appointment - deletes appointment size 2020-04-22 14:48:00 +02:00
Sergi Delgado Segura
5f7a909804 user_pk/client_pk -> user_id and cli/client -> user (when it does not reffer to the software) 2020-04-21 19:05:20 +02:00
Sergi Delgado Segura
7e800ade4a Fixes E2E tests 2020-04-20 18:09:08 +02:00
Sergi Delgado Segura
a1b0236c0a Adds new Responder tests 2020-04-20 17:59:56 +02:00
Sergi Delgado Segura
797cb9786e Adds new gatekeeper tests 2020-04-20 17:59:47 +02:00
Sergi Delgado Segura
eea12a695e Improves API returns for 404 and extends tests to cover it 2020-04-20 17:58:40 +02:00
Sergi Delgado Segura
eb8ffb4916 Adaps unit tests. Speeds up tests by removing unnecesary sleeps 2020-04-20 17:58:40 +02:00
Sergi Delgado Segura
8e3caadc5c Adds ExtendedAppointent unit tests and simplifies Appointment's 2020-04-20 17:58:40 +02:00
Sergi Delgado Segura
5c35ff1249 Fixes tests 2020-04-20 17:30:17 +02:00
Sergi Delgado Segura
a427b12799 Updates cli unit tests 2020-04-20 17:30:17 +02:00
Sergi Delgado Segura
08701f0fee Refactors Cryptographer to remove logs and avoid multi return types
Cryptographer now uses exceptions to report errors and does not use the log anymore
2020-04-20 17:30:16 +02:00
Sergi Delgado Segura
71507d4c32 Gets rid of blob classes. Close #66 2020-04-20 17:30:16 +02:00
Sergi Delgado Segura
ed8ff228d8 First commands with basic structure.
- Moves DBManager to common.
2020-04-20 17:30:15 +02:00
Sergi Delgado Segura
e4cd453860 Fixes test_appointment_malformed_penalty 2020-04-20 17:21:58 +02:00
Sergi Delgado Segura
bed21e9625 Adds API HOST and PORT as configurable parameters.
Uses API_BIND/API_PORT for the server and API_CONNECT/API_PORT for the user, for consistency.
2020-04-20 17:01:55 +02:00
Sergi Delgado Segura
2be433d589 Refactors cli to avoid multi-type returns (normal return + None). Adds exceptions for errors. 2020-04-20 17:00:49 +02:00
Sergi Delgado Segura
4a65b2524b Refactors cli to avoid multi-type returns (normal return + None). Adds exceptions for errors. 2020-04-20 16:06:38 +02:00
Sergi Delgado Segura
5f7eb9df10 Minor fixes 2020-04-20 13:58:09 +02:00
Turtle
ad078cf3af Test get_all_appointments e2e 2020-04-17 15:29:01 -04:00
Turtle
b6b95a9821 Add get_all_appointments cli command 2020-04-17 15:17:11 -04:00
Sergi Delgado Segura
dcb221ea36 Adds missing cli register test 2020-04-03 20:57:01 +02:00
Sergi Delgado Segura
10e856ae74 Fixes typos according to the review 2020-04-03 16:38:46 +02:00
Sergi Delgado Segura
fe73ee7298 Fixes comments, docstrings and some renamings 2020-04-02 15:20:09 +02:00
Sergi Delgado Segura
099ec5d1ce PEP8 fixes 2020-04-02 10:02:50 +02:00
Sergi Delgado Segura
7abb4ada00 Updates AppoitmentDBM unit tests and adds UserDBM's 2020-04-01 21:30:34 +02:00
Sergi Delgado Segura
f31f356a1a Adapts tests to use userDB and registered_users content as dict 2020-04-01 18:27:27 +02:00
Sergi Delgado Segura
4a3f4bc522 Addapts tests to match 7031b552f7. Improves DBManager tests. 2020-04-01 17:19:41 +02:00
Sergi Delgado Segura
0e392d1f2a Cryptographer.sigrec_decode assumed signatures where properly encoded.
- Fixes a bug in sigrec_decode where the decoding function assumend that the first by was formatted as 31 + SigRec. Non properly encoded signatures made the function to crash due to an overflow (int_to_bytes(x) for negative x)
2020-04-01 17:04:33 +02:00
Sergi Delgado Segura
2d67fe8638 rpc_passwd -> rpc_password. The former can be confusing since the bitcoind parameter is rpcpassword. Avoiding that. 2020-04-01 11:14:20 +02:00
Sergi Delgado Segura
0364dba5ca Fixes e2e tests to match the user authentication apporach
Last two tests are patched, user data must be stored between restarts
2020-03-31 16:56:52 +02:00