Commit Graph

607 Commits

Author SHA1 Message Date
Turtle
7aa74d5953 Move config options used by watcher and responder to the constructor 2020-01-13 02:23:02 -05:00
Sergi Delgado Segura
db46444348 Adapts the tests to work with data in db instead of memory 2020-01-09 18:20:00 +01: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
34636ab8e0 Unit tests for the db_manager triggered_flag functions 2020-01-09 18:18:12 +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
15f9a9efe1 Removes triggered from to_json
Triggered has been deatached from the appointment having it's own entry into the db, so not part of the appointment data anymore
2020-01-09 18:13:24 +01:00
Sergi Delgado Segura
49657ccbfc Merge pull request #81 from sr-gi/chainmaester
Adds basic logic to detect forks while offline
2020-01-08 09:55:39 +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
40e656dcd3 ChainMonitor unit tests 2020-01-07 16:09:49 +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
f10c3c46eb Updates tests to use ChainMonitor as global fixture 2020-01-07 16:08:10 +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
069e15fdba Updates current tests to work with chain_monitor instead of zmq_sub 2020-01-03 13:36:52 +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
a5e9f1b874 Removes unused imports 2020-01-02 11:23:34 +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
57d5aa4940 Adds missing block processor tests 2019-12-27 11:12:30 +01:00
Sergi Delgado Segura
23078f6c6c Updates circleci with bitcoind_mock 2019-12-23 07:09:04 +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
2b0945f1ba Updates tests with external bitcoind mock 2019-12-23 06:43:54 +01:00
Sergi Delgado Segura
ef92e2bf6f Removes bitcoind_mock from the codebase
It can be now found at https://github.com/sr-gi/bitcoind_mock/
2019-12-22 10:29:28 +01:00
Sergi Delgado Segura
1210061fb3 Merge pull request #78 from sr-gi/verbose-test
Enables stdout for unit tests
2019-12-17 17:24:33 +01:00
Sergi Delgado Segura
fffcb39124 Enables stdout for unit tests
By default pytests does not capture stdout, but it can do with -s. It is nice to have the option to verbose the tests if needed
2019-12-17 17:22:40 +01:00
Sergi Delgado Segura
d4e7e999e1 Sets sim verbose to False for unit tests 2019-12-17 17:21:48 +01:00
Sergi Delgado Segura
b82065120c Adds verbose flag to show/hide block generation on stdout 2019-12-17 17:21:21 +01:00
Sergi Delgado Segura
31fac8de7e Merge pull request #76 from sr-gi/14-passing-params-api
Refactors the API to run using dispatch instead of decorate
2019-12-17 17:10:03 +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
6129ae9b25 Merge pull request #75 from sr-gi/68-appointment-encoding
Defines a proper appointment encoding
2019-12-17 16:28:25 +01:00
Sergi Delgado Segura
680de0b7ac Update unit tests to use serialize 2019-12-17 16:22:23 +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
5c01bec89c Merge pull request #73 from sr-gi/fix-encoding
Removes unnecessary encoding when unhexlifying
2019-12-17 11:37:55 +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
af4544b2c0 Merge pull request #72 from sr-gi/logger
Moves Logger to common and improves logs
2019-12-17 10:04:44 +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
74080bf104 Deletes test file 2019-12-16 13:03:17 +01:00
Sergi Delgado Segura
b363cc2d94 Adds missing tool tests 2019-12-16 12:57:28 +01:00
Sergi Delgado Segura
bc72496db9 Dissables missing logs c_logger 2019-12-16 12:50:44 +01:00
Sergi Delgado Segura
b07b6759ed Adds missing cryptographer tests 2019-12-16 12:50:24 +01:00
Sergi Delgado Segura
d37b6b6de2 Merge branch 'master' into 46-docstrings 2019-12-16 12:02:04 +01:00
Sergi Delgado Segura
399c25044a Merge branch 'simplify' 2019-12-16 11:59:05 +01:00