Commit Graph

140 Commits

Author SHA1 Message Date
Sergi Delgado Segura
b4197aa5bb Replaces hardcoded 16/32 for LOCATOR lengths 2019-12-05 11:26:58 +01:00
Sergi Delgado Segura
bd08b151df Replaces locator with common/constants value 2019-12-05 11:03:36 +01:00
Sergi Delgado Segura
ac912aea69 Removes unused errors, redefines the ones after those 2019-12-05 11:02:46 +01:00
Sergi Delgado Segura
babb746dbd Create common package
Moves cryptographer to common. Also adds constants and defines the leghtn of the locator to avoid hardcoding it in almost every file
2019-12-05 11:02:17 +01:00
Sergi Delgado Segura
f0150ce585 Removes hash/cipher configuration and changes AESGCM128 for CHACHA20POLY1305
Updates tests accordingly
2019-12-04 17:46:07 +01:00
Sergi Delgado Segura
c679d59451 Merge branch '59-uncovered-tests' 2019-12-04 14:41:24 +01:00
Sergi Delgado Segura
5e9211d562 Some parameters were mixed up when boostraping from DB 2019-12-04 13:27:29 +01:00
Sergi Delgado Segura
c663fab788 Return non found if the locator does not fit the proper format 2019-12-04 13:27:06 +01:00
Turtle
7713a3cd47 Server validates appointment signature upon reception 2019-11-26 23:21:07 -05:00
Sergi Delgado Segura
d2b7216a96 Addresses requested changes 2019-11-22 14:48:38 +00:00
Sergi Delgado Segura
2183c57f53 Updates handle_reorgs and deletes check_tx_in_chain
Updates handle_reorg to work with the current version of the Responder (the old code was outdated and broken).

`check_tx_in_chain` was only used by `handle_reorgs`, and made not much sense at this point. The method need to check if the transaction is in mempool or blockchain, so it seems to make more sense bulding on top of `get_transaction`.
2019-11-20 15:41:50 +00:00
Sergi Delgado Segura
05961f1632 Moves tx_in_chain to Carrier
Also integrates it properly so it uses self.get_transaction() instead of bitcoin_cli straightaway. Error messages have also been merged / modified
2019-11-20 13:01:27 +00:00
Sergi Delgado Segura
3a1bf0cc8a Updates API to use DB on get methods 2019-11-14 17:38:26 +00:00
Sergi Delgado Segura
f65e2af675 Deletes missed print 2019-11-14 15:03:03 +00:00
Sergi Delgado Segura
c54d10f92c Fixes Responder
There were a couple of wrong things going on in the `Responder`:

- `check_confirmations` included in 8a10979db0 was not doing a good job keeping track of the missed confirmations, probably due to a overlooked refactor.

- There was an edge case when adding txs to `unconfirmed_txs` on `create_job` that may lead to a transaction being confirmed and unconfirmed at the same time from the `Responder's` pow. It could be triggered by adding two jobs with the same justice_txid.
2019-11-11 17:50:28 +00:00
Sergi Delgado Segura
f81cb04b74 Fixes get_distance_to_tip 2019-11-11 14:03:18 +00:00
Sergi Delgado Segura
3c6f13ef00 Rename delete_completed_appointments and rearange arguments 2019-11-11 13:27:57 +00:00
Sergi Delgado Segura
4233c9d5cc Refactor get_matches and filter_valid_matches to not be static 2019-11-08 18:21:42 +00:00
Sergi Delgado Segura
da61ea9b8e Makes sure that blobs to be decrypred are even-length 2019-11-08 18:20:05 +00:00
Sergi Delgado Segura
8a10979db0 Refactors Responder and BlockProcessor
Brings check_confirmations back to the Responder
2019-11-08 16:25:40 +00:00
Sergi Delgado Segura
20faa04c4c Refactord Watcher and BlockProcessor. Closes #36.
Brings back check_potential_matches and check_matches to the Watcher.

The methods have now been renamed to check_matches (old check_potential_matches) and filter_valid_matches (old check_matches) to provide a better description of their purpose.

decode_raw_transaction has been added to BlockProcessor
2019-11-08 16:25:35 +00:00
Sergi Delgado Segura
c08013abd0 Creates Cryptographer. Separates decryptiomn from encrypted_blob 2019-11-08 16:24:31 +00:00
Sergi Delgado Segura
8b2f0efa2f Moves appointment deletion + db update to the cleaner 2019-11-07 19:16:05 +00:00
Sergi Delgado Segura
2b1640ea86 Simplifies Inspector using Appointment.from_json() constructor 2019-11-07 16:56:30 +00:00
Sergi Delgado Segura
20f296c9d4 Reformats code to match code guidelines 2019-11-07 15:47:35 +00:00
Sergi Delgado Segura
e6e577c99e Updates Watcher to use serialize instead of to_json 2019-11-07 15:08:05 +00:00
Sergi Delgado Segura
30159399f0 Adds serialize method
After adding the triggered flag we can not just use to_json to serialize since the two data blobs won't match. This also sets ground towards having a generalized serialization function.
2019-11-07 15:08:05 +00:00
Sergi Delgado Segura
99bda73eff Applies fixes after PR review 2019-11-07 15:07:58 +00:00
Sergi Delgado Segura
76059d569e Adds db section to sample_conf 2019-11-06 17:34:18 +00:00
Sergi Delgado Segura
31afb1373a Integrates the locator map dumping to the Watcher and Cleaner 2019-11-06 17:08:42 +00:00
Sergi Delgado Segura
810f6ec525 Adds methods to store the locator map in the db
In order to use the db for system monitoring we need a way of mapping the locator the the uuids the appointments/jobs are identified in the db. First steps towards #15
2019-11-06 17:08:05 +00:00
Sergi Delgado Segura
4bdadc1836 Loads only non-triggered appointments for the watcher 2019-11-05 19:13:16 +00:00
Sergi Delgado Segura
01c9f8f16c Adds triggered flag to appointment 2019-11-05 19:12:33 +00:00
Sergi Delgado Segura
6644ad5bd1 Random whitespaces removed 2019-11-02 21:18:39 -07:00
Sergi Delgado Segura
276c0ae0b3 Fixes Appointment.from_dict() 2019-11-02 21:16:19 -07:00
Sergi Delgado Segura
ddb3f26d88 Improves build from data persistance
Fetches the missed block data to the watcher and responder queues so they can recover
2019-10-30 12:24:02 -07:00
Sergi Delgado Segura
ccafc1999c Adds a method to get all blocks from the tip to a target 2019-10-30 12:22:57 -07:00
Sergi Delgado Segura
e95961ae6a Adds a method to initialize queues from missed blocks 2019-10-30 12:22:13 -07:00
Sergi Delgado Segura
8ad3ae5f1d Initializes block_queue on init
Building from backed up data may require initializing the block queues of both the watcher and responder with the blocks they've missed.
2019-10-30 12:20:42 -07:00
Sergi Delgado Segura
ddcbc6a6de Fixes log level 2019-10-29 15:20:32 -07:00
Sergi Delgado Segura
bc7c7dc26f Fixes based on DBManager unit tests 2019-10-29 14:52:27 -07:00
Sergi Delgado Segura
d10de4a81d Closed DB on shutdown
Related to #11
2019-10-28 14:49:53 -07:00
Sergi Delgado Segura
15a66751b2 Additional bug-fixing 2019-10-28 14:49:53 -07:00
Sergi Delgado Segura
f61474216c Fixes and tests updates
Updates tests so they run with the db_manager and fixes some bugs introduced in d7d42c9.
2019-10-28 14:49:40 -07:00
Sergi Delgado Segura
ee1f024c51 Basic restore from backed up data
Tests need to be updated to match with some of the new component design
2019-10-28 14:44:31 -07:00
Sergi Delgado Segura
43b749f417 Create the Builder
The Builder's puerpose is to build data structures from the data obtained from the DB for both the Watcher and the Responder
2019-10-28 14:40:44 -07:00
Sergi Delgado Segura
cf61e6e265 Reports the block hash to the responder on adding response
The responder can use the block hash to figure out whether or not he is on sync
2019-10-28 14:40:44 -07:00
Sergi Delgado Segura
5bf96a10c5 Adds method to compute distance from given block to chain tip 2019-10-28 14:40:44 -07:00
Sergi Delgado Segura
162de92026 Adds class method to create from dict and on_sync method 2019-10-28 14:40:42 -07:00
Sergi Delgado Segura
db87fab9ee Fixes prefix encoding 2019-10-28 14:38:56 -07:00