Commit Graph

248 Commits

Author SHA1 Message Date
Turtle
40d7ca1912 Refactor add_appointment cli code 2020-01-15 03:35:31 -05:00
Turtle
1188ddda17 Add load_config function 2020-01-15 03:10:21 -05:00
Sergi Delgado Segura
eb71ab8fc4 Adds missing args on docs and adds polling_delta parm to monitor_chain 2020-01-13 15:42:27 +01:00
Sergi Delgado Segura
1a26d7d6a3 Fixes typos based on @orbitalturtle comments 2020-01-13 15:31:54 +01:00
Turtle
c22bf220f0 Move config options used by inspector to the constructor 2020-01-13 02:23:07 -05:00
Turtle
7aa74d5953 Move config options used by watcher and responder to the constructor 2020-01-13 02:23:02 -05:00
Sergi Delgado Segura
5196f5df29 Removes most appointment data from memory
Data used to be stored both in memory and disk (db). This commits modifies the Watcher, Responder and Cleaner so they only keep the needed maps and load information from disk when necessary.
2020-01-09 18:18:26 +01:00
Sergi Delgado Segura
d9cccfb26a Refactors the API to used the new triggered functions 2020-01-09 18:15:43 +01:00
Sergi Delgado Segura
f6af67be87 Refactors db_manager to have a new entry type for the triggered appointmnets. Adds methods to create, load a and remove this new entries 2020-01-09 18:14:19 +01:00
Sergi Delgado Segura
dfc90cd930 Sets ChainMonitor terminate on shutdown and removes unused imports 2020-01-07 16:31:17 +01:00
Sergi Delgado Segura
31b4c2e993 Bug fix and moves update condition to update_state
The tip update was performed in the wrong order, so tips never made it to last_tips
2020-01-07 16:08:43 +01:00
Sergi Delgado Segura
9bb69d1f5a Uses conf parameters instead of hardcoded values for the ChainMonitor and includes docstrings 2020-01-06 13:33:17 +01:00
Sergi Delgado Segura
b2272aa4ea Adds ChainMonitor config parameters 2020-01-06 13:32:25 +01:00
Sergi Delgado Segura
e5514cefce Updates old docs/comments regarding zmq 2020-01-06 12:27:02 +01:00
Sergi Delgado Segura
3889d30e31 Minor refactor
Runs chain_monitor as daemon so it terminates along with the main thread. Reorders attack_responder so it is in the same stanza as attack_watcher
2020-01-03 13:35:52 +01:00
Sergi Delgado Segura
c594018dce Bug fix: Properly initializes Responder 2020-01-03 11:37:26 +01:00
Sergi Delgado Segura
8fab59975f Adds basic ChainMonitor to the system
ChainMonitor is the actor in charge of checking new blocks. It improves from the previous zmq_subscriber by also doing polling and, therefore, making sure that no blocks are missed.

Documentation and tests are still required. Partially covers #31
2020-01-02 16:15:27 +01:00
Sergi Delgado Segura
747f4bb888 Simplifies get_missed_blocks
get_missed_blocks is always called after calling find_last_common_ancestor, so the later was called twice returning the same value as the input. It does not seem to be any reason for it atm.
2020-01-02 12:05:07 +01:00
Sergi Delgado Segura
3ff10ea1bf Makes all BLockProcessor methods static 2020-01-02 11:21:01 +01:00
Sergi Delgado Segura
5ce5936fc0 Fixes bootstrap from backed up data 2019-12-27 12:22:07 +01:00
Sergi Delgado Segura
ea681850a8 Adds some ChainMaester functionallity to the BlockProcessor
The ChainMaester functionallity has been split into the new bitcoind mock and the blockprocessor (there's ChainMaester no more 😢)
2019-12-23 06:45:24 +01:00
Sergi Delgado Segura
531523c534 Refactors the API to run using dispatch instead of decorate
The API was never made an object since I couldn't find a way or working around the Flask decorators.

By using dispatch we can get around the issues in #14 and will be able to create better mocks for the API
2019-12-17 17:04:57 +01:00
Sergi Delgado Segura
5c585a7a02 Refactors code to use appointment from common based on f4a1e34e2f4d75226c7e313b83ff5ae06c8c89ca 2019-12-17 16:22:23 +01:00
Sergi Delgado Segura
a69f1ba28b Moves appointment to common and creates serialize
Appointment serialization used to be part of the cryptographer (signature_format) but it makes more sense to be an appointment method. Therefore cli also need Appointment

Also fixes comments based on reviews
2019-12-17 16:21:54 +01:00
Sergi Delgado Segura
46a7fa824f Removes unnecessary encoding when unhexlifying
binascii.unhexlify(x) is equal to binascii.unhexlify(x.encode())
2019-12-17 11:35:28 +01:00
Sergi Delgado Segura
1184b4648a Fixes logs and removes redundant tailing dots 2019-12-16 19:45:30 +01:00
Sergi Delgado Segura
a9df67d787 Properly fromats console logs 2019-12-16 19:44:50 +01:00
Sergi Delgado Segura
77b191dde2 Moves Logger to common 2019-12-16 14:15:30 +01:00
Sergi Delgado Segura
bc250bd814 Gives some default values to sample_conf 2019-12-16 11:06:11 +01:00
Sergi Delgado Segura
0574898bae Adds circule-ci config + updates requirements 2019-12-16 10:57:16 +01:00
Sergi Delgado Segura
2f67ecfa6e Changes sk_path to sk_der in Watcher
The Watcher used to receive a secret key file path ion the __init__ to load a secret key for signing. That made testing the Watcher hard, since the file needed to be present. Changing it so the main (pisad) loads the file from disk and passes the data the Watcher on init.
2019-12-16 10:54:13 +01:00
Sergi Delgado Segura
63488cb69e Fixes wrong identation in Watcher 2019-12-13 19:44:19 +01:00
Sergi Delgado Segura
e2ca226b11 Last formatting details troughout the codebase 2019-12-13 18:13:29 +01:00
Sergi Delgado Segura
008a71da3a Renames matches to breaches to be consistent with the Responder. Also adds docstrings 2019-12-13 18:13:29 +01:00
Sergi Delgado Segura
d881706eb3 Refactors the codebase to match the new naming from 793d563b8c053136dd5f936b0ef0cd88af215b06 and 3046eae38ee3f34857c96e6b9d43e645f7d2de2d 2019-12-13 18:13:29 +01:00
Sergi Delgado Segura
7c1986dfc8 Renames ZMQHandler to ZMQSubscriber 2019-12-13 18:13:29 +01:00
Sergi Delgado Segura
91ca9e539f Adds Responder docstrings fixes get_txs_to_rebroadcast and renames some methods
get_txs_to_rebroadcast was beinf triggered based on received transactions indstead of stored txs. Fixing that.

Some of the names in the Responder were poorly picked (not descriptibe enough). Tries to fix that.

``Job`` class has been renames to ``TransactionTracker``.

``add_response`` has been renamed to ``handle_breach`` and ``create_job`` to ``add_tracker``.

All the variables that has `job` on it have already been updated.
2019-12-13 18:12:04 +01:00
Sergi Delgado Segura
b53627aa6d tools docstrings 2019-12-11 14:22:18 +01:00
Sergi Delgado Segura
2eafb644c3 Adds Logger docstrings 2019-12-11 14:22:09 +01:00
Sergi Delgado Segura
df5dcbdfe9 Renames dispute_delta to to_self_delay and justice tx to penalty tx
Uses the naming convention followed by LN implementations and BOLTs
2019-12-11 12:45:05 +01:00
Sergi Delgado Segura
6a7cd4d3aa Adds Inspector docstrings. Replaces dispute_delta by to_self_delay 2019-12-11 12:41:08 +01:00
Sergi Delgado Segura
c17c3af32a DBManager docstrings 2019-12-10 20:10:22 +01:00
Sergi Delgado Segura
2cdd78b8e6 Simplifies the Cleaner and adds docstrings
We were passing some unnecessary parameters to the Cleaner (locator) that could be derived from other data (uuid and appointments). Also standarises the order of the  parameters to match the rest of the methods
2019-12-10 13:31:42 +01:00
Sergi Delgado Segura
b0bf653ba4 Carrier docstrings 2019-12-10 12:28:01 +01:00
Sergi Delgado Segura
f287bdf073 Fixes returns 2019-12-10 12:02:25 +01:00
Sergi Delgado Segura
899b60c083 Adds Builder docstrings 2019-12-10 11:33:01 +01:00
Sergi Delgado Segura
a6a38ff33c BlockProcessor docstrings 2019-12-10 11:10:10 +01:00
Sergi Delgado Segura
6e196b25bd Capitalization of returns first char 2019-12-10 10:44:52 +01:00
Sergi Delgado Segura
05dad7d38b Further improvements, including references 2019-12-09 20:08:05 +01:00
Sergi Delgado Segura
6a5a23a1d6 Fixes format for line breaks 2019-12-09 19:23:57 +01:00