Commit Graph

327 Commits

Author SHA1 Message Date
Salvatore Ingala
2a5dd48950 PEP8 linting 2019-10-10 09:58:27 +07:00
Salvatore Ingala
ed0cb4f632 Changed log format to JSON; fixed missing return value in get_potential_matches 2019-10-10 09:58:27 +07:00
Salvatore Ingala
1b229cb441 Added *.pyc and .cache/ to .gitignore 2019-10-10 09:57:04 +07:00
Sergi Delgado Segura
db635ef688 Add missing comment 2019-10-09 19:00:08 +01:00
Sergi Delgado Segura
8b62ff9e56 Update some comments/todos/discuss 2019-10-09 17:38:15 +01:00
Sergi Delgado Segura
1de226374d Minot simulator updates 2019-10-09 17:34:44 +01:00
Sergi Delgado Segura
b69ffdc0aa Adds some BlockProcessor unit tests.
The three last methods are missing, since they seem not to belong there (check #36)
2019-10-09 17:34:32 +01:00
Sergi Delgado Segura
c67e41d185 Includes getbestblockhash so it can simulate db loads 2019-10-09 15:58:54 +01:00
Sergi Delgado Segura
e0d0818f6b Removes unused code 2019-10-09 15:32:56 +01:00
Sergi Delgado Segura
ab72c71039 Adds appointment unit test 2019-10-09 15:19:33 +01:00
Sergi Delgado Segura
ecadbc62ef Adds _eq_ method to EncryptedBlob 2019-10-09 15:19:03 +01:00
Sergi Delgado Segura
f59c621cc0 Defines bitcoind fixture session-wise 2019-10-09 14:05:15 +01:00
Sergi Delgado Segura
e7530a53dc Fixes unconsistent test
test_get_all_appointments_responder was failing unconsistently. It was due to how the api fixture was set up.

Fix:
	- Sets up bitcoind and api fixtures to run session-wise (so they are not re-initialized for every test
	- Updates tests accordingly (e.g. reduces the number of MULTIPLE_REQUESTS so it does not cap)
	- Keeps track of all sent appointments so the test_request functionds don't need to create additional ones
2019-10-09 14:01:43 +01:00
Sergi Delgado Segura
fa5f587134 Updates tests to be pytests friedly
pytests already runs all the test_ functions, so there's no need to call them
2019-10-08 18:57:29 +01:00
Sergi Delgado Segura
9a18f759f9 Adds run_bitcoind fixture 2019-10-08 18:56:45 +01:00
Sergi Delgado Segura
e81ccd39a1 Adds API unit tests and modifies bitcoin_sim to be fixture compatible
- Adds unit tests for API
- Updates API to let BlockProcessor deal with block block related JSON-RPC
- Fixes BlockProcessor get_potential_matches return
- Makes bitcoin_sim runnable via function (instead of a main runnable script) to work with pytests fixture
- <3 Fixture
2019-10-08 18:55:27 +01:00
Sergi Delgado Segura
ab1ad33e32 Adds Blob unittests and Blob sanity checks 2019-10-07 17:22:19 +01:00
Sergi Delgado Segura
8403f871ca Adds EncryptedBlob unittests 2019-10-07 16:56:55 +01:00
Sergi Delgado Segura
10656c5955 Updates Blob Exception
Blob was raising general Exceptions when a ValueError should be a better match
2019-10-07 16:48:06 +01:00
Sergi Delgado Segura
88532f7345 Changes derypt key input type and return
The input types for Blob.encrypt and EncryptedBlob.decrypt were not consistent. The former was in hex whereas the later was in bytes. Format the later in hex for consistency.
2019-10-07 16:47:54 +01:00
Sergi Delgado Segura
76f0b1934a Client-side clean up 2019-10-07 15:59:52 +01:00
Sergi Delgado Segura
d2a07d6519 More clean up 2019-10-07 15:36:58 +01:00
Sergi Delgado Segura
4be506412e Adds Inspector unittests. Fixes some related bugs. 2019-10-07 15:19:34 +01:00
Sergi Delgado Segura
067efcca73 Clean unused imports and more cleanup 2019-10-07 11:58:28 +01:00
Sergi Delgado Segura
23efd48796 Fixes logging bug introduced in 93e23e7
When cleaning up code in commit 93e23e7 a condition was removed that makes the inspector log empty data.
2019-10-07 11:47:21 +01:00
Sergi Delgado Segura
5ae210d893 Updates os.urandom to python3
All string generated with urandom(x) were using binascii + os.urandom + encode. In python3 os.urandom has a hex method.
2019-10-07 11:39:10 +01:00
Sergi Delgado Segura
beac88a2c5 Refactors test structure 2019-10-04 17:29:13 +01:00
Sergi Delgado Segura
1e18630ce2 Adds Cleaner tests. Fixes Cleaner, Watcher and Responder
There is no need to return the dictionaries modified by the client since they are "passed-by-reference" in Python.
2019-10-04 17:23:45 +01:00
Sergi Delgado Segura
37c24dfb37 Merge branch 'cleanup' into testing 2019-10-04 15:38:28 +01:00
Sergi Delgado Segura
4704462502 Increases responder modularity
The responder had way too complex functions. Separate them into smaller / more specific ones to increse modularity and code reuse.
2019-10-04 13:52:51 +01:00
Sergi Delgado Segura
3ed9ccd466 Adds additional functionality that will be needed when deploying data persistence 2019-10-04 13:50:43 +01:00
Sergi Delgado Segura
9a37b211a0 Adds Carrier to take care of sending/getting transactions 2019-10-04 13:49:48 +01:00
Sergi Delgado Segura
3e0cca14d7 Clean up + higher modular design 2019-10-03 11:49:49 +01:00
Sergi Delgado Segura
5ba6fcb9ef Improves modularity of the code
Adds cleaner and block processor to increase the modularity and reuse of the code
2019-10-03 11:49:24 +01:00
Sergi Delgado Segura
e9832e4408 More clean up 2019-10-03 11:47:07 +01:00
Sergi Delgado Segura
93e23e769f Code clean up
Deletes debug/logging pair. Defines logging and bitcoin_cli as system-wide variables
2019-10-02 17:03:43 +01:00
Sergi Delgado Segura
9bb3b38b3f Clears old commented code 2019-08-27 11:21:08 +02:00
Sergi Delgado Segura
8bd7ff8fcc Merge pull request #29 from sr-gi/25-change-appointment-structure
Improves internal data structures
2019-08-27 10:43:45 +02:00
Sergi Delgado Segura
1c9e6d474d Improves tests 2019-08-26 16:28:49 +02:00
Sergi Delgado Segura
ea037da530 small fixes 2019-08-26 16:28:05 +02:00
Sergi Delgado Segura
ebac9b003e Updates api to match the net internal data structures 2019-08-26 16:26:53 +02:00
Sergi Delgado Segura
ae2cf26195 Improves internal data structures and reorgs the code for readability 2019-08-26 16:26:29 +02:00
Sergi Delgado Segura
fbedc6d635 Merge branch '25-change-appointment-structure' of github.com:sr-gi/pisa_btc into 25-change-appointment-structure 2019-08-20 11:54:18 +01:00
Sergi Delgado Segura
400e524c36 Changes appointment structure
Updates the former appointment structure from `dicts` containing `lists` accessed by `index` to `dicts` containing `dicts` identified by `uuid4`. Needs testing.
2019-08-20 11:54:04 +01:00
Sergi Delgado Segura
0f214a30c9 Merge pull request #28 from sr-gi/27-zmq-bitcoinrpc-simulators
Created a tinny bitcoind simulator with zmq pub capabilities
2019-08-20 11:50:39 +01:00
Sergi Delgado Segura
157456f164 Improves simulator and adds basic appointment test
The getblock rpc call was missing the block and previousblock hashes.
2019-08-19 18:18:10 +01:00
Sergi Delgado Segura
51bafa323a Improves the simulator and adds some tests
The simulator now return the proper error messages when incorrect data is pased on RPC calls. Functionality for forks is missing.
2019-08-16 17:01:16 +01:00
Sergi Delgado Segura
3ac2d446a3 Defines a better bitcoind_simulator. Basic functionallity is already implemented 2019-08-15 19:13:55 +01:00
Sergi Delgado Segura
314e271754 Adds basic functionality for both zmq_pub and bitcoin_rpc simulators 2019-08-14 13:51:48 +01:00
Sergi Delgado Segura
3dfa7e2978 Changes appointment structure
Updates the former appointment structure from `dicts` containing `lists` accessed by `index` to `dicts` containing `dicts` identified by `uuid4`. Needs testing.
2019-08-13 17:40:45 +01:00