Implement a safety check mechanism on object_database, based on the safety_check_policy abstract interface. Create two standard implementations of the safety_check_policy interface, one (null_safety_check) which allows all modifications unconditionally, and the other (database_lock_safety_check) which allows modifications only when unlocked. Integrate these safety checks into chain::database and plugins, so that the consensus databases are locked at all times except during core consensus code pathways. Also ensures that databases are re-locked when calling code outside of consensus pathways from consensus pathways. To make this work, it was necessary to move two objects from the consensus object spaces to a new API object space. The operation_history_object and account_transaction_history_object were moved to the API object space, as they are not actually used by consensus and are maintained by a plugin (which can no longer modify the consensus object spaces, due to the safety checks). Finally, add a mechanism to application and chain::database, which allows the chain to start in "unit testing mode" and allows unchecked actions upon the database within delimited scopes. This was necessary because many tests edit the database directly to set up the environment for their respective tests. This mode is activated by database_fixture so tests can utilize it conveniently, but it is architecturally difficult to enable this mode in production, i.e. from a plugin. |
||
|---|---|---|
| .. | ||
| app | ||
| benchmarks | ||
| betting | ||
| cli | ||
| common | ||
| elasticsearch | ||
| generate_empty_blocks | ||
| intense | ||
| peerplays_sidechain | ||
| performance | ||
| random | ||
| tests | ||
| tournament | ||
| CMakeLists.txt | ||
| random.sh | ||
| tournaments.sh | ||