From 92dcb9007090a23916e9a514ab16e7fa67065d47 Mon Sep 17 00:00:00 2001 From: foefl Date: Tue, 16 Dec 2025 16:30:11 +0100 Subject: [PATCH] prepare initialisation of blockchain --- pdm.lock | 18 +- pyproject.toml | 1 + src/dopt_pollublock_blockchain/blockchain.cpp | 1681 +++++++++-------- src/dopt_pollublock_blockchain/blockchain.pyx | 5 +- src/dopt_pollublock_blockchain/constants.py | 5 + src/dopt_pollublock_blockchain/db.py | 22 + 6 files changed, 918 insertions(+), 814 deletions(-) create mode 100644 src/dopt_pollublock_blockchain/constants.py diff --git a/pdm.lock b/pdm.lock index a54319e..2f0d961 100644 --- a/pdm.lock +++ b/pdm.lock @@ -5,7 +5,7 @@ groups = ["default", "data", "dev", "lint", "nb", "tests"] strategy = ["inherit_metadata"] lock_version = "4.5.0" -content_hash = "sha256:a28bc9f6ac4aaed3d77e740ba7da7c420623e4edfba18854357238e4f95e759f" +content_hash = "sha256:35fffc1c0ac0b0ad9c178fb759b2ea6f6db4c118739a667064025b9734c24eb0" [[metadata.targets]] requires_python = ">=3.11" @@ -433,7 +433,7 @@ name = "colorama" version = "0.4.6" requires_python = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" summary = "Cross-platform colored terminal text." -groups = ["dev", "nb", "tests"] +groups = ["data", "dev", "nb", "tests"] marker = "sys_platform == \"win32\" or platform_system == \"Windows\"" files = [ {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, @@ -2832,6 +2832,20 @@ files = [ {file = "tornado-6.5.2.tar.gz", hash = "sha256:ab53c8f9a0fa351e2c0741284e06c7a45da86afb544133201c5cc8578eb076a0"}, ] +[[package]] +name = "tqdm" +version = "4.67.1" +requires_python = ">=3.7" +summary = "Fast, Extensible Progress Meter" +groups = ["data"] +dependencies = [ + "colorama; platform_system == \"Windows\"", +] +files = [ + {file = "tqdm-4.67.1-py3-none-any.whl", hash = "sha256:26445eca388f82e72884e0d580d5464cd801a3ea01e63e5601bdff9ba6a48de2"}, + {file = "tqdm-4.67.1.tar.gz", hash = "sha256:f8aef9c52c08c13a65f30ea34f4e5aac3fd1a34959879d7e59e63027286627f2"}, +] + [[package]] name = "traitlets" version = "5.14.3" diff --git a/pyproject.toml b/pyproject.toml index 3dd0050..3edc7a4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -156,4 +156,5 @@ data = [ "polars>=1.36.1", "pyarrow>=22.0.0", "pandas>=2.3.3", + "tqdm>=4.67.1", ] diff --git a/src/dopt_pollublock_blockchain/blockchain.cpp b/src/dopt_pollublock_blockchain/blockchain.cpp index 612306e..620a291 100644 --- a/src/dopt_pollublock_blockchain/blockchain.cpp +++ b/src/dopt_pollublock_blockchain/blockchain.cpp @@ -1624,7 +1624,7 @@ struct __pyx_opt_args_26dopt_pollublock_blockchain_10blockchain_7PyBlock_from_pt int owner; }; -/* "dopt_pollublock_blockchain/blockchain.pyx":292 +/* "dopt_pollublock_blockchain/blockchain.pyx":291 * * * cdef int mine_block(Block *block, unsigned int difficulty, uint64_t *nonce_solution, unsigned int max_nonce=0xFFFFFFFF) nogil: # <<<<<<<<<<<<<< @@ -1651,7 +1651,7 @@ struct __pyx_obj_26dopt_pollublock_blockchain_10blockchain_PyBlock { }; -/* "dopt_pollublock_blockchain/blockchain.pyx":323 +/* "dopt_pollublock_blockchain/blockchain.pyx":322 * * * cdef class Blockchain: # <<<<<<<<<<<<<< @@ -1687,7 +1687,7 @@ struct __pyx_vtabstruct_26dopt_pollublock_blockchain_10blockchain_PyBlock { static struct __pyx_vtabstruct_26dopt_pollublock_blockchain_10blockchain_PyBlock *__pyx_vtabptr_26dopt_pollublock_blockchain_10blockchain_PyBlock; -/* "dopt_pollublock_blockchain/blockchain.pyx":323 +/* "dopt_pollublock_blockchain/blockchain.pyx":322 * * * cdef class Blockchain: # <<<<<<<<<<<<<< @@ -2829,7 +2829,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_14create_genesis_block(struct __pyx_obj_26dopt_pollublock_blockchain_10blockchain_Blockchain *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_16new_block(struct __pyx_obj_26dopt_pollublock_blockchain_10blockchain_Blockchain *__pyx_v_self, PyObject *__pyx_v_data); /* proto */ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_18validate(struct __pyx_obj_26dopt_pollublock_blockchain_10blockchain_Blockchain *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_20get_saving_entries(struct __pyx_obj_26dopt_pollublock_blockchain_10blockchain_Blockchain *__pyx_v_self, PyObject *__pyx_v_max_idx); /* proto */ +static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_20get_saving_entries(struct __pyx_obj_26dopt_pollublock_blockchain_10blockchain_Blockchain *__pyx_v_self, PyObject *__pyx_v_min_idx); /* proto */ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_22save(struct __pyx_obj_26dopt_pollublock_blockchain_10blockchain_Blockchain *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_24close_db_connections(struct __pyx_obj_26dopt_pollublock_blockchain_10blockchain_Blockchain *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_26load(struct __pyx_obj_26dopt_pollublock_blockchain_10blockchain_Blockchain *__pyx_v_self, PyObject *__pyx_v_batch_size); /* proto */ @@ -2868,7 +2868,7 @@ typedef struct { __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values; PyObject *__pyx_tuple[1]; PyObject *__pyx_codeobj_tab[17]; - PyObject *__pyx_string_tab[188]; + PyObject *__pyx_string_tab[189]; PyObject *__pyx_number_tab[1]; /* #### Code section: module_state_contents ### */ /* CommonTypesMetaclass.module_state_decls */ @@ -3012,92 +3012,93 @@ static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_stati #define __pyx_n_u_fromtimestamp __pyx_string_tab[99] #define __pyx_n_u_func __pyx_string_tab[100] #define __pyx_n_u_func_2 __pyx_string_tab[101] -#define __pyx_n_u_genesis_prev_hash __pyx_string_tab[102] -#define __pyx_n_u_get_block __pyx_string_tab[103] -#define __pyx_n_u_get_saving_entries __pyx_string_tab[104] -#define __pyx_n_u_getstate __pyx_string_tab[105] -#define __pyx_n_u_hash __pyx_string_tab[106] -#define __pyx_n_u_hex __pyx_string_tab[107] -#define __pyx_n_u_idx __pyx_string_tab[108] -#define __pyx_n_u_index __pyx_string_tab[109] -#define __pyx_n_u_insert __pyx_string_tab[110] -#define __pyx_n_u_is_coroutine __pyx_string_tab[111] -#define __pyx_n_u_it __pyx_string_tab[112] -#define __pyx_n_u_items __pyx_string_tab[113] -#define __pyx_n_u_load __pyx_string_tab[114] -#define __pyx_n_u_main __pyx_string_tab[115] -#define __pyx_n_u_max __pyx_string_tab[116] -#define __pyx_n_u_max_idx __pyx_string_tab[117] -#define __pyx_n_u_max_idx_2 __pyx_string_tab[118] -#define __pyx_n_u_max_num __pyx_string_tab[119] -#define __pyx_n_u_max_nummber __pyx_string_tab[120] -#define __pyx_n_u_max_value __pyx_string_tab[121] -#define __pyx_n_u_metadata_blockchain __pyx_string_tab[122] -#define __pyx_n_u_module __pyx_string_tab[123] -#define __pyx_n_u_name __pyx_string_tab[124] -#define __pyx_n_u_new_block __pyx_string_tab[125] -#define __pyx_n_u_new_idx __pyx_string_tab[126] -#define __pyx_n_u_nonce __pyx_string_tab[127] -#define __pyx_n_u_num __pyx_string_tab[128] -#define __pyx_n_u_order_by __pyx_string_tab[129] -#define __pyx_n_u_parent __pyx_string_tab[130] -#define __pyx_n_u_partitions __pyx_string_tab[131] -#define __pyx_n_u_pathlib __pyx_string_tab[132] -#define __pyx_n_u_perform_hash __pyx_string_tab[133] -#define __pyx_n_u_pop __pyx_string_tab[134] -#define __pyx_n_u_prev_block __pyx_string_tab[135] -#define __pyx_n_u_prev_hash __pyx_string_tab[136] -#define __pyx_n_u_previous_hash __pyx_string_tab[137] -#define __pyx_n_u_print __pyx_string_tab[138] -#define __pyx_n_u_print_blocks __pyx_string_tab[139] -#define __pyx_n_u_print_key_value_pair __pyx_string_tab[140] -#define __pyx_n_u_py_block __pyx_string_tab[141] -#define __pyx_n_u_py_bytes __pyx_string_tab[142] -#define __pyx_n_u_py_bytes_rehashed __pyx_string_tab[143] -#define __pyx_n_u_pyx_state __pyx_string_tab[144] -#define __pyx_n_u_pyx_vtable __pyx_string_tab[145] -#define __pyx_n_u_qualname __pyx_string_tab[146] -#define __pyx_n_u_reduce __pyx_string_tab[147] -#define __pyx_n_u_reduce_cython __pyx_string_tab[148] -#define __pyx_n_u_reduce_ex __pyx_string_tab[149] -#define __pyx_n_u_repr __pyx_string_tab[150] -#define __pyx_n_u_res __pyx_string_tab[151] -#define __pyx_n_u_resolve __pyx_string_tab[152] -#define __pyx_n_u_result __pyx_string_tab[153] -#define __pyx_n_u_save __pyx_string_tab[154] -#define __pyx_n_u_scalar __pyx_string_tab[155] -#define __pyx_n_u_select __pyx_string_tab[156] -#define __pyx_n_u_self __pyx_string_tab[157] -#define __pyx_n_u_serialize_dict __pyx_string_tab[158] -#define __pyx_n_u_serialize_res __pyx_string_tab[159] -#define __pyx_n_u_serialize_size __pyx_string_tab[160] -#define __pyx_n_u_set_name __pyx_string_tab[161] -#define __pyx_n_u_setdefault __pyx_string_tab[162] -#define __pyx_n_u_setstate __pyx_string_tab[163] -#define __pyx_n_u_setstate_cython __pyx_string_tab[164] -#define __pyx_n_u_sql __pyx_string_tab[165] -#define __pyx_n_u_sqlalchemy __pyx_string_tab[166] -#define __pyx_n_u_stmt __pyx_string_tab[167] -#define __pyx_n_u_test __pyx_string_tab[168] -#define __pyx_n_u_timestamp __pyx_string_tab[169] -#define __pyx_n_u_validate __pyx_string_tab[170] -#define __pyx_n_u_values __pyx_string_tab[171] -#define __pyx_kp_b_ __pyx_string_tab[172] -#define __pyx_kp_b_00000000000000000000000000000000 __pyx_string_tab[173] -#define __pyx_kp_b_iso88591_A_1D_wc_xuAV2_b_q_t1 __pyx_string_tab[174] -#define __pyx_kp_b_iso88591_A_1_D_q_G1_D_q_D_4q_4q_q __pyx_string_tab[175] -#define __pyx_kp_b_iso88591_A_4q_a_YgQa_t_Qa_IQ_Q_gQa_t_Qa_4 __pyx_string_tab[176] -#define __pyx_kp_b_iso88591_A_4q_aq_q_XQc_89ARwb_dRS_IS_1A_K __pyx_string_tab[177] -#define __pyx_kp_b_iso88591_A_4r_3d_D_AQ_D_AQ_6_A_AQ_iq_Q __pyx_string_tab[178] -#define __pyx_kp_b_iso88591_A_4t1_aq_4z_1A_4z_T_Qd_Ja_hb_IQ __pyx_string_tab[179] -#define __pyx_kp_b_iso88591_A_HHA __pyx_string_tab[180] -#define __pyx_kp_b_iso88591_A_Qd_1A __pyx_string_tab[181] -#define __pyx_kp_b_iso88591_A_T_F_c_D_4q_c_L_1_iq __pyx_string_tab[182] -#define __pyx_kp_b_iso88591_A_a_1_83a_AQ_G5_WARuA_D_q_1_iq_1 __pyx_string_tab[183] -#define __pyx_kp_b_iso88591_A_a_83a_q_G5_WARuA_t3a_D_q_1_q_A __pyx_string_tab[184] -#define __pyx_kp_b_iso88591_A_a_G5_WARuA_D_q_1_uHAU_waq_1G1A __pyx_string_tab[185] -#define __pyx_kp_b_iso88591_A_s_U_ar_q_T_gQ_4q_vQ_xq_7_2Zq __pyx_string_tab[186] -#define __pyx_kp_b_iso88591_Q __pyx_string_tab[187] +#define __pyx_n_u_genesis_done __pyx_string_tab[102] +#define __pyx_n_u_genesis_prev_hash __pyx_string_tab[103] +#define __pyx_n_u_get_block __pyx_string_tab[104] +#define __pyx_n_u_get_saving_entries __pyx_string_tab[105] +#define __pyx_n_u_getstate __pyx_string_tab[106] +#define __pyx_n_u_hash __pyx_string_tab[107] +#define __pyx_n_u_hex __pyx_string_tab[108] +#define __pyx_n_u_idx __pyx_string_tab[109] +#define __pyx_n_u_index __pyx_string_tab[110] +#define __pyx_n_u_insert __pyx_string_tab[111] +#define __pyx_n_u_is_coroutine __pyx_string_tab[112] +#define __pyx_n_u_it __pyx_string_tab[113] +#define __pyx_n_u_items __pyx_string_tab[114] +#define __pyx_n_u_load __pyx_string_tab[115] +#define __pyx_n_u_main __pyx_string_tab[116] +#define __pyx_n_u_max __pyx_string_tab[117] +#define __pyx_n_u_max_num __pyx_string_tab[118] +#define __pyx_n_u_max_nummber __pyx_string_tab[119] +#define __pyx_n_u_max_value __pyx_string_tab[120] +#define __pyx_n_u_metadata_blockchain __pyx_string_tab[121] +#define __pyx_n_u_min_idx __pyx_string_tab[122] +#define __pyx_n_u_min_idx_2 __pyx_string_tab[123] +#define __pyx_n_u_module __pyx_string_tab[124] +#define __pyx_n_u_name __pyx_string_tab[125] +#define __pyx_n_u_new_block __pyx_string_tab[126] +#define __pyx_n_u_new_idx __pyx_string_tab[127] +#define __pyx_n_u_nonce __pyx_string_tab[128] +#define __pyx_n_u_num __pyx_string_tab[129] +#define __pyx_n_u_order_by __pyx_string_tab[130] +#define __pyx_n_u_parent __pyx_string_tab[131] +#define __pyx_n_u_partitions __pyx_string_tab[132] +#define __pyx_n_u_pathlib __pyx_string_tab[133] +#define __pyx_n_u_perform_hash __pyx_string_tab[134] +#define __pyx_n_u_pop __pyx_string_tab[135] +#define __pyx_n_u_prev_block __pyx_string_tab[136] +#define __pyx_n_u_prev_hash __pyx_string_tab[137] +#define __pyx_n_u_previous_hash __pyx_string_tab[138] +#define __pyx_n_u_print __pyx_string_tab[139] +#define __pyx_n_u_print_blocks __pyx_string_tab[140] +#define __pyx_n_u_print_key_value_pair __pyx_string_tab[141] +#define __pyx_n_u_py_block __pyx_string_tab[142] +#define __pyx_n_u_py_bytes __pyx_string_tab[143] +#define __pyx_n_u_py_bytes_rehashed __pyx_string_tab[144] +#define __pyx_n_u_pyx_state __pyx_string_tab[145] +#define __pyx_n_u_pyx_vtable __pyx_string_tab[146] +#define __pyx_n_u_qualname __pyx_string_tab[147] +#define __pyx_n_u_reduce __pyx_string_tab[148] +#define __pyx_n_u_reduce_cython __pyx_string_tab[149] +#define __pyx_n_u_reduce_ex __pyx_string_tab[150] +#define __pyx_n_u_repr __pyx_string_tab[151] +#define __pyx_n_u_res __pyx_string_tab[152] +#define __pyx_n_u_resolve __pyx_string_tab[153] +#define __pyx_n_u_result __pyx_string_tab[154] +#define __pyx_n_u_save __pyx_string_tab[155] +#define __pyx_n_u_scalar __pyx_string_tab[156] +#define __pyx_n_u_select __pyx_string_tab[157] +#define __pyx_n_u_self __pyx_string_tab[158] +#define __pyx_n_u_serialize_dict __pyx_string_tab[159] +#define __pyx_n_u_serialize_res __pyx_string_tab[160] +#define __pyx_n_u_serialize_size __pyx_string_tab[161] +#define __pyx_n_u_set_name __pyx_string_tab[162] +#define __pyx_n_u_setdefault __pyx_string_tab[163] +#define __pyx_n_u_setstate __pyx_string_tab[164] +#define __pyx_n_u_setstate_cython __pyx_string_tab[165] +#define __pyx_n_u_sql __pyx_string_tab[166] +#define __pyx_n_u_sqlalchemy __pyx_string_tab[167] +#define __pyx_n_u_stmt __pyx_string_tab[168] +#define __pyx_n_u_test __pyx_string_tab[169] +#define __pyx_n_u_timestamp __pyx_string_tab[170] +#define __pyx_n_u_validate __pyx_string_tab[171] +#define __pyx_n_u_values __pyx_string_tab[172] +#define __pyx_kp_b_ __pyx_string_tab[173] +#define __pyx_kp_b_00000000000000000000000000000000 __pyx_string_tab[174] +#define __pyx_kp_b_iso88591_A_1D_wc_xuAV2_b_q_t1 __pyx_string_tab[175] +#define __pyx_kp_b_iso88591_A_1_D_q_G1_D_q_D_4q_4q_q __pyx_string_tab[176] +#define __pyx_kp_b_iso88591_A_4q_a_YgQa_t_Qa_IQ_Q_gQa_t_Qa_4 __pyx_string_tab[177] +#define __pyx_kp_b_iso88591_A_4q_aq_q_XQc_89ARwb_dRS_IS_1A_K __pyx_string_tab[178] +#define __pyx_kp_b_iso88591_A_4r_3d_D_AQ_D_AQ_6_A_AQ_iq_Q __pyx_string_tab[179] +#define __pyx_kp_b_iso88591_A_4t1_aq_4z_1A_4z_T_Qd_Ja_hb_IQ __pyx_string_tab[180] +#define __pyx_kp_b_iso88591_A_HHA __pyx_string_tab[181] +#define __pyx_kp_b_iso88591_A_Qd_1A __pyx_string_tab[182] +#define __pyx_kp_b_iso88591_A_T_F_c_D_4q_c_L_1_iq __pyx_string_tab[183] +#define __pyx_kp_b_iso88591_A_a_1_83a_AQ_G5_WARuA_D_q_1_iq_1 __pyx_string_tab[184] +#define __pyx_kp_b_iso88591_A_a_83a_q_G5_WARuA_t3a_D_q_1_q_A __pyx_string_tab[185] +#define __pyx_kp_b_iso88591_A_a_G5_WARuA_D_q_1_uHAU_waq_1G1A __pyx_string_tab[186] +#define __pyx_kp_b_iso88591_A_s_U_ar_q_T_gQ_4q_vQ_xq_7_2Zq __pyx_string_tab[187] +#define __pyx_kp_b_iso88591_Q __pyx_string_tab[188] #define __pyx_int_0 __pyx_number_tab[0] /* #### Code section: module_state_clear ### */ #if CYTHON_USE_MODULE_STATE @@ -3119,7 +3120,7 @@ static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_type_26dopt_pollublock_blockchain_10blockchain_Blockchain); for (int i=0; i<1; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); } for (int i=0; i<17; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } - for (int i=0; i<188; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } + for (int i=0; i<189; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } for (int i=0; i<1; ++i) { Py_CLEAR(clear_module_state->__pyx_number_tab[i]); } /* #### Code section: module_state_clear_contents ### */ /* CommonTypesMetaclass.module_state_clear */ @@ -3149,7 +3150,7 @@ static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void Py_VISIT(traverse_module_state->__pyx_type_26dopt_pollublock_blockchain_10blockchain_Blockchain); for (int i=0; i<1; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); } for (int i=0; i<17; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } - for (int i=0; i<188; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } + for (int i=0; i<189; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } for (int i=0; i<1; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_number_tab[i]); } /* #### Code section: module_state_traverse_contents ### */ /* CommonTypesMetaclass.module_state_traverse */ @@ -5834,7 +5835,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_7PyBlock_14p * digest = perform_hash_c(self.BlockC, &digest_size) * if digest is NULL: # <<<<<<<<<<<<<< * raise MemoryError() - * # TODO out: hash assignment in blockchain + * self.BlockC.hash = bytes(digest[:digest_size]).hex().encode("UTF-8") */ __pyx_t_2 = (__pyx_v_digest == NULL); if (unlikely(__pyx_t_2)) { @@ -5843,8 +5844,8 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_7PyBlock_14p * digest = perform_hash_c(self.BlockC, &digest_size) * if digest is NULL: * raise MemoryError() # <<<<<<<<<<<<<< - * # TODO out: hash assignment in blockchain * self.BlockC.hash = bytes(digest[:digest_size]).hex().encode("UTF-8") + * finally: */ PyErr_NoMemory(); __PYX_ERR(0, 201, __pyx_L4_error) @@ -5853,19 +5854,19 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_7PyBlock_14p * digest = perform_hash_c(self.BlockC, &digest_size) * if digest is NULL: # <<<<<<<<<<<<<< * raise MemoryError() - * # TODO out: hash assignment in blockchain + * self.BlockC.hash = bytes(digest[:digest_size]).hex().encode("UTF-8") */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":203 + /* "dopt_pollublock_blockchain/blockchain.pyx":202 + * if digest is NULL: * raise MemoryError() - * # TODO out: hash assignment in blockchain * self.BlockC.hash = bytes(digest[:digest_size]).hex().encode("UTF-8") # <<<<<<<<<<<<<< * finally: * free(digest) */ __pyx_t_6 = NULL; - __pyx_t_7 = __Pyx_PyBytes_FromStringAndSize(((char const *)__pyx_v_digest) + 0, __pyx_v_digest_size - 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 203, __pyx_L4_error) + __pyx_t_7 = __Pyx_PyBytes_FromStringAndSize(((char const *)__pyx_v_digest) + 0, __pyx_v_digest_size - 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 202, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = 1; { @@ -5873,7 +5874,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_7PyBlock_14p __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(&PyBytes_Type), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 203, __pyx_L4_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 202, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_5); } __pyx_t_4 = __pyx_t_5; @@ -5884,22 +5885,22 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_7PyBlock_14p __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_hex, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 203, __pyx_L4_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); } - __pyx_t_5 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 203, __pyx_L4_error) + __pyx_t_5 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 202, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_5); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 203, __pyx_L4_error) + __pyx_t_9 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_5); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 202, __pyx_L4_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_self->BlockC->hash = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_9); } - /* "dopt_pollublock_blockchain/blockchain.pyx":205 + /* "dopt_pollublock_blockchain/blockchain.pyx":204 * self.BlockC.hash = bytes(digest[:digest_size]).hex().encode("UTF-8") * finally: * free(digest) # <<<<<<<<<<<<<< - * # TODO rework + * * return self.hash */ /*finally:*/ { @@ -5944,15 +5945,15 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_7PyBlock_14p __pyx_L5:; } - /* "dopt_pollublock_blockchain/blockchain.pyx":207 + /* "dopt_pollublock_blockchain/blockchain.pyx":206 * free(digest) - * # TODO rework + * * return self.hash # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_hash); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 207, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_hash); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_r = __pyx_t_5; __pyx_t_5 = 0; @@ -6185,7 +6186,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_7PyBlock_18_ return __pyx_r; } -/* "dopt_pollublock_blockchain/blockchain.pyx":210 +/* "dopt_pollublock_blockchain/blockchain.pyx":209 * * * cdef unsigned char* bytes_serialize_c(Block *block, size_t *size) nogil: # <<<<<<<<<<<<<< @@ -6204,7 +6205,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_bytes_se int __pyx_clineno = 0; PyGILState_STATE __pyx_gilstate_save; - /* "dopt_pollublock_blockchain/blockchain.pyx":214 + /* "dopt_pollublock_blockchain/blockchain.pyx":213 * size_t total_len * unsigned char* buf * size_t pos = 0 # <<<<<<<<<<<<<< @@ -6213,7 +6214,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_bytes_se */ __pyx_v_pos = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":217 + /* "dopt_pollublock_blockchain/blockchain.pyx":216 * * # index (8), timestamp (8), nonce (8), data, prev_hash * size[0] = ( # <<<<<<<<<<<<<< @@ -6222,7 +6223,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_bytes_se */ (__pyx_v_size[0]) = ((((size_t)0x18) + __pyx_v_block->data.size()) + __pyx_v_block->prev_hash.size()); - /* "dopt_pollublock_blockchain/blockchain.pyx":222 + /* "dopt_pollublock_blockchain/blockchain.pyx":221 * block.prev_hash.size() * ) * buf = malloc(size[0] * sizeof(unsigned char)) # <<<<<<<<<<<<<< @@ -6231,7 +6232,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_bytes_se */ __pyx_v_buf = ((unsigned char *)malloc(((__pyx_v_size[0]) * (sizeof(unsigned char))))); - /* "dopt_pollublock_blockchain/blockchain.pyx":224 + /* "dopt_pollublock_blockchain/blockchain.pyx":223 * buf = malloc(size[0] * sizeof(unsigned char)) * * if buf is NULL: # <<<<<<<<<<<<<< @@ -6241,7 +6242,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_bytes_se __pyx_t_1 = (__pyx_v_buf == NULL); if (__pyx_t_1) { - /* "dopt_pollublock_blockchain/blockchain.pyx":225 + /* "dopt_pollublock_blockchain/blockchain.pyx":224 * * if buf is NULL: * return NULL # <<<<<<<<<<<<<< @@ -6251,7 +6252,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_bytes_se __pyx_r = NULL; goto __pyx_L0; - /* "dopt_pollublock_blockchain/blockchain.pyx":224 + /* "dopt_pollublock_blockchain/blockchain.pyx":223 * buf = malloc(size[0] * sizeof(unsigned char)) * * if buf is NULL: # <<<<<<<<<<<<<< @@ -6260,16 +6261,16 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_bytes_se */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":227 + /* "dopt_pollublock_blockchain/blockchain.pyx":226 * return NULL * * serialize_uint64(buf + pos, block.index) # <<<<<<<<<<<<<< * pos += 8 * serialize_uint64(buf + pos, block.timestamp) */ - __pyx_t_2 = __pyx_f_26dopt_pollublock_blockchain_10blockchain_serialize_uint64((__pyx_v_buf + __pyx_v_pos), __pyx_v_block->index); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 227, __pyx_L1_error) + __pyx_t_2 = __pyx_f_26dopt_pollublock_blockchain_10blockchain_serialize_uint64((__pyx_v_buf + __pyx_v_pos), __pyx_v_block->index); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 226, __pyx_L1_error) - /* "dopt_pollublock_blockchain/blockchain.pyx":228 + /* "dopt_pollublock_blockchain/blockchain.pyx":227 * * serialize_uint64(buf + pos, block.index) * pos += 8 # <<<<<<<<<<<<<< @@ -6278,16 +6279,16 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_bytes_se */ __pyx_v_pos = (__pyx_v_pos + 8); - /* "dopt_pollublock_blockchain/blockchain.pyx":229 + /* "dopt_pollublock_blockchain/blockchain.pyx":228 * serialize_uint64(buf + pos, block.index) * pos += 8 * serialize_uint64(buf + pos, block.timestamp) # <<<<<<<<<<<<<< * pos += 8 * serialize_uint64(buf + pos, block.nonce) */ - __pyx_t_2 = __pyx_f_26dopt_pollublock_blockchain_10blockchain_serialize_uint64((__pyx_v_buf + __pyx_v_pos), __pyx_v_block->timestamp); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 229, __pyx_L1_error) + __pyx_t_2 = __pyx_f_26dopt_pollublock_blockchain_10blockchain_serialize_uint64((__pyx_v_buf + __pyx_v_pos), __pyx_v_block->timestamp); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 228, __pyx_L1_error) - /* "dopt_pollublock_blockchain/blockchain.pyx":230 + /* "dopt_pollublock_blockchain/blockchain.pyx":229 * pos += 8 * serialize_uint64(buf + pos, block.timestamp) * pos += 8 # <<<<<<<<<<<<<< @@ -6296,16 +6297,16 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_bytes_se */ __pyx_v_pos = (__pyx_v_pos + 8); - /* "dopt_pollublock_blockchain/blockchain.pyx":231 + /* "dopt_pollublock_blockchain/blockchain.pyx":230 * serialize_uint64(buf + pos, block.timestamp) * pos += 8 * serialize_uint64(buf + pos, block.nonce) # <<<<<<<<<<<<<< * pos += 8 * # Copy data */ - __pyx_t_2 = __pyx_f_26dopt_pollublock_blockchain_10blockchain_serialize_uint64((__pyx_v_buf + __pyx_v_pos), __pyx_v_block->nonce); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 231, __pyx_L1_error) + __pyx_t_2 = __pyx_f_26dopt_pollublock_blockchain_10blockchain_serialize_uint64((__pyx_v_buf + __pyx_v_pos), __pyx_v_block->nonce); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 230, __pyx_L1_error) - /* "dopt_pollublock_blockchain/blockchain.pyx":232 + /* "dopt_pollublock_blockchain/blockchain.pyx":231 * pos += 8 * serialize_uint64(buf + pos, block.nonce) * pos += 8 # <<<<<<<<<<<<<< @@ -6314,7 +6315,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_bytes_se */ __pyx_v_pos = (__pyx_v_pos + 8); - /* "dopt_pollublock_blockchain/blockchain.pyx":234 + /* "dopt_pollublock_blockchain/blockchain.pyx":233 * pos += 8 * # Copy data * memcpy( # <<<<<<<<<<<<<< @@ -6323,7 +6324,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_bytes_se */ (void)(memcpy((__pyx_v_buf + __pyx_v_pos), __pyx_v_block->data.c_str(), __pyx_v_block->data.size())); - /* "dopt_pollublock_blockchain/blockchain.pyx":239 + /* "dopt_pollublock_blockchain/blockchain.pyx":238 * block.data.size(), * ) * pos += block.data.size() # <<<<<<<<<<<<<< @@ -6332,7 +6333,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_bytes_se */ __pyx_v_pos = (__pyx_v_pos + __pyx_v_block->data.size()); - /* "dopt_pollublock_blockchain/blockchain.pyx":241 + /* "dopt_pollublock_blockchain/blockchain.pyx":240 * pos += block.data.size() * # Copy prev_hash * memcpy( # <<<<<<<<<<<<<< @@ -6341,7 +6342,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_bytes_se */ (void)(memcpy((__pyx_v_buf + __pyx_v_pos), __pyx_v_block->prev_hash.c_str(), __pyx_v_block->prev_hash.size())); - /* "dopt_pollublock_blockchain/blockchain.pyx":246 + /* "dopt_pollublock_blockchain/blockchain.pyx":245 * block.prev_hash.size(), * ) * pos += block.prev_hash.size() # <<<<<<<<<<<<<< @@ -6350,7 +6351,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_bytes_se */ __pyx_v_pos = (__pyx_v_pos + __pyx_v_block->prev_hash.size()); - /* "dopt_pollublock_blockchain/blockchain.pyx":248 + /* "dopt_pollublock_blockchain/blockchain.pyx":247 * pos += block.prev_hash.size() * * return buf # <<<<<<<<<<<<<< @@ -6360,7 +6361,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_bytes_se __pyx_r = __pyx_v_buf; goto __pyx_L0; - /* "dopt_pollublock_blockchain/blockchain.pyx":210 + /* "dopt_pollublock_blockchain/blockchain.pyx":209 * * * cdef unsigned char* bytes_serialize_c(Block *block, size_t *size) nogil: # <<<<<<<<<<<<<< @@ -6378,7 +6379,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_bytes_se return __pyx_r; } -/* "dopt_pollublock_blockchain/blockchain.pyx":250 +/* "dopt_pollublock_blockchain/blockchain.pyx":249 * return buf * * cdef unsigned char* SHA256_digest(const void *data, size_t data_size, size_t *digest_size) nogil: # <<<<<<<<<<<<<< @@ -6395,7 +6396,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_SHA256_d unsigned char *__pyx_r; int __pyx_t_1; - /* "dopt_pollublock_blockchain/blockchain.pyx":251 + /* "dopt_pollublock_blockchain/blockchain.pyx":250 * * cdef unsigned char* SHA256_digest(const void *data, size_t data_size, size_t *digest_size) nogil: * cdef ossl.EVP_MD_CTX *ctx = ossl.EVP_MD_CTX_new() # <<<<<<<<<<<<<< @@ -6404,7 +6405,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_SHA256_d */ __pyx_v_ctx = EVP_MD_CTX_new(); - /* "dopt_pollublock_blockchain/blockchain.pyx":252 + /* "dopt_pollublock_blockchain/blockchain.pyx":251 * cdef unsigned char* SHA256_digest(const void *data, size_t data_size, size_t *digest_size) nogil: * cdef ossl.EVP_MD_CTX *ctx = ossl.EVP_MD_CTX_new() * if ctx is NULL: # <<<<<<<<<<<<<< @@ -6414,7 +6415,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_SHA256_d __pyx_t_1 = (__pyx_v_ctx == NULL); if (__pyx_t_1) { - /* "dopt_pollublock_blockchain/blockchain.pyx":253 + /* "dopt_pollublock_blockchain/blockchain.pyx":252 * cdef ossl.EVP_MD_CTX *ctx = ossl.EVP_MD_CTX_new() * if ctx is NULL: * return NULL # <<<<<<<<<<<<<< @@ -6424,7 +6425,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_SHA256_d __pyx_r = NULL; goto __pyx_L0; - /* "dopt_pollublock_blockchain/blockchain.pyx":252 + /* "dopt_pollublock_blockchain/blockchain.pyx":251 * cdef unsigned char* SHA256_digest(const void *data, size_t data_size, size_t *digest_size) nogil: * cdef ossl.EVP_MD_CTX *ctx = ossl.EVP_MD_CTX_new() * if ctx is NULL: # <<<<<<<<<<<<<< @@ -6433,7 +6434,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_SHA256_d */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":254 + /* "dopt_pollublock_blockchain/blockchain.pyx":253 * if ctx is NULL: * return NULL * cdef const ossl.EVP_MD *algo = ossl.EVP_sha256() # <<<<<<<<<<<<<< @@ -6442,7 +6443,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_SHA256_d */ __pyx_v_algo = EVP_sha256(); - /* "dopt_pollublock_blockchain/blockchain.pyx":255 + /* "dopt_pollublock_blockchain/blockchain.pyx":254 * return NULL * cdef const ossl.EVP_MD *algo = ossl.EVP_sha256() * if algo is NULL: # <<<<<<<<<<<<<< @@ -6452,7 +6453,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_SHA256_d __pyx_t_1 = (__pyx_v_algo == NULL); if (__pyx_t_1) { - /* "dopt_pollublock_blockchain/blockchain.pyx":256 + /* "dopt_pollublock_blockchain/blockchain.pyx":255 * cdef const ossl.EVP_MD *algo = ossl.EVP_sha256() * if algo is NULL: * return NULL # <<<<<<<<<<<<<< @@ -6462,7 +6463,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_SHA256_d __pyx_r = NULL; goto __pyx_L0; - /* "dopt_pollublock_blockchain/blockchain.pyx":255 + /* "dopt_pollublock_blockchain/blockchain.pyx":254 * return NULL * cdef const ossl.EVP_MD *algo = ossl.EVP_sha256() * if algo is NULL: # <<<<<<<<<<<<<< @@ -6471,7 +6472,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_SHA256_d */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":263 + /* "dopt_pollublock_blockchain/blockchain.pyx":262 * unsigned int digest_len * * dig_buff_len = ossl.EVP_MD_size(algo) # <<<<<<<<<<<<<< @@ -6480,7 +6481,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_SHA256_d */ __pyx_v_dig_buff_len = ((size_t)EVP_MD_size(__pyx_v_algo)); - /* "dopt_pollublock_blockchain/blockchain.pyx":264 + /* "dopt_pollublock_blockchain/blockchain.pyx":263 * * dig_buff_len = ossl.EVP_MD_size(algo) * digest_size[0] = dig_buff_len # <<<<<<<<<<<<<< @@ -6489,7 +6490,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_SHA256_d */ (__pyx_v_digest_size[0]) = __pyx_v_dig_buff_len; - /* "dopt_pollublock_blockchain/blockchain.pyx":265 + /* "dopt_pollublock_blockchain/blockchain.pyx":264 * dig_buff_len = ossl.EVP_MD_size(algo) * digest_size[0] = dig_buff_len * digest = malloc(dig_buff_len * sizeof(unsigned char)) # <<<<<<<<<<<<<< @@ -6498,7 +6499,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_SHA256_d */ __pyx_v_digest = ((unsigned char *)malloc((__pyx_v_dig_buff_len * (sizeof(unsigned char))))); - /* "dopt_pollublock_blockchain/blockchain.pyx":266 + /* "dopt_pollublock_blockchain/blockchain.pyx":265 * digest_size[0] = dig_buff_len * digest = malloc(dig_buff_len * sizeof(unsigned char)) * ossl.EVP_DigestInit_ex(ctx, algo, NULL) # <<<<<<<<<<<<<< @@ -6507,7 +6508,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_SHA256_d */ (void)(EVP_DigestInit_ex(__pyx_v_ctx, __pyx_v_algo, NULL)); - /* "dopt_pollublock_blockchain/blockchain.pyx":267 + /* "dopt_pollublock_blockchain/blockchain.pyx":266 * digest = malloc(dig_buff_len * sizeof(unsigned char)) * ossl.EVP_DigestInit_ex(ctx, algo, NULL) * ossl.EVP_DigestUpdate(ctx, data, data_size) # <<<<<<<<<<<<<< @@ -6516,7 +6517,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_SHA256_d */ (void)(EVP_DigestUpdate(__pyx_v_ctx, __pyx_v_data, __pyx_v_data_size)); - /* "dopt_pollublock_blockchain/blockchain.pyx":268 + /* "dopt_pollublock_blockchain/blockchain.pyx":267 * ossl.EVP_DigestInit_ex(ctx, algo, NULL) * ossl.EVP_DigestUpdate(ctx, data, data_size) * ossl.EVP_DigestFinal_ex(ctx, digest, &digest_len) # <<<<<<<<<<<<<< @@ -6525,7 +6526,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_SHA256_d */ (void)(EVP_DigestFinal_ex(__pyx_v_ctx, __pyx_v_digest, (&__pyx_v_digest_len))); - /* "dopt_pollublock_blockchain/blockchain.pyx":270 + /* "dopt_pollublock_blockchain/blockchain.pyx":269 * ossl.EVP_DigestFinal_ex(ctx, digest, &digest_len) * * ossl.EVP_MD_CTX_free(ctx) # <<<<<<<<<<<<<< @@ -6534,7 +6535,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_SHA256_d */ EVP_MD_CTX_free(__pyx_v_ctx); - /* "dopt_pollublock_blockchain/blockchain.pyx":272 + /* "dopt_pollublock_blockchain/blockchain.pyx":271 * ossl.EVP_MD_CTX_free(ctx) * * return digest # <<<<<<<<<<<<<< @@ -6544,7 +6545,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_SHA256_d __pyx_r = __pyx_v_digest; goto __pyx_L0; - /* "dopt_pollublock_blockchain/blockchain.pyx":250 + /* "dopt_pollublock_blockchain/blockchain.pyx":249 * return buf * * cdef unsigned char* SHA256_digest(const void *data, size_t data_size, size_t *digest_size) nogil: # <<<<<<<<<<<<<< @@ -6557,7 +6558,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_SHA256_d return __pyx_r; } -/* "dopt_pollublock_blockchain/blockchain.pyx":275 +/* "dopt_pollublock_blockchain/blockchain.pyx":274 * * * cdef unsigned char* perform_hash_c(Block *block, size_t *digest_size) nogil: # <<<<<<<<<<<<<< @@ -6577,17 +6578,17 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_perform_ int __pyx_clineno = 0; PyGILState_STATE __pyx_gilstate_save; - /* "dopt_pollublock_blockchain/blockchain.pyx":281 + /* "dopt_pollublock_blockchain/blockchain.pyx":280 * unsigned char *digest * * serialize_res = bytes_serialize_c(block, &serialize_size) # <<<<<<<<<<<<<< * if serialize_res is NULL: * return NULL */ - __pyx_t_1 = __pyx_f_26dopt_pollublock_blockchain_10blockchain_bytes_serialize_c(__pyx_v_block, (&__pyx_v_serialize_size)); if (unlikely(__pyx_t_1 == ((void *)NULL) && __Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 281, __pyx_L1_error) + __pyx_t_1 = __pyx_f_26dopt_pollublock_blockchain_10blockchain_bytes_serialize_c(__pyx_v_block, (&__pyx_v_serialize_size)); if (unlikely(__pyx_t_1 == ((void *)NULL) && __Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 280, __pyx_L1_error) __pyx_v_serialize_res = __pyx_t_1; - /* "dopt_pollublock_blockchain/blockchain.pyx":282 + /* "dopt_pollublock_blockchain/blockchain.pyx":281 * * serialize_res = bytes_serialize_c(block, &serialize_size) * if serialize_res is NULL: # <<<<<<<<<<<<<< @@ -6597,7 +6598,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_perform_ __pyx_t_2 = (__pyx_v_serialize_res == NULL); if (__pyx_t_2) { - /* "dopt_pollublock_blockchain/blockchain.pyx":283 + /* "dopt_pollublock_blockchain/blockchain.pyx":282 * serialize_res = bytes_serialize_c(block, &serialize_size) * if serialize_res is NULL: * return NULL # <<<<<<<<<<<<<< @@ -6607,7 +6608,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_perform_ __pyx_r = NULL; goto __pyx_L0; - /* "dopt_pollublock_blockchain/blockchain.pyx":282 + /* "dopt_pollublock_blockchain/blockchain.pyx":281 * * serialize_res = bytes_serialize_c(block, &serialize_size) * if serialize_res is NULL: # <<<<<<<<<<<<<< @@ -6616,17 +6617,17 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_perform_ */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":284 + /* "dopt_pollublock_blockchain/blockchain.pyx":283 * if serialize_res is NULL: * return NULL * digest = SHA256_digest(serialize_res, serialize_size, digest_size) # <<<<<<<<<<<<<< * free(serialize_res) * if digest is NULL: */ - __pyx_t_1 = __pyx_f_26dopt_pollublock_blockchain_10blockchain_SHA256_digest(__pyx_v_serialize_res, __pyx_v_serialize_size, __pyx_v_digest_size); if (unlikely(__pyx_t_1 == ((void *)NULL) && __Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 284, __pyx_L1_error) + __pyx_t_1 = __pyx_f_26dopt_pollublock_blockchain_10blockchain_SHA256_digest(__pyx_v_serialize_res, __pyx_v_serialize_size, __pyx_v_digest_size); if (unlikely(__pyx_t_1 == ((void *)NULL) && __Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 283, __pyx_L1_error) __pyx_v_digest = __pyx_t_1; - /* "dopt_pollublock_blockchain/blockchain.pyx":285 + /* "dopt_pollublock_blockchain/blockchain.pyx":284 * return NULL * digest = SHA256_digest(serialize_res, serialize_size, digest_size) * free(serialize_res) # <<<<<<<<<<<<<< @@ -6635,7 +6636,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_perform_ */ free(__pyx_v_serialize_res); - /* "dopt_pollublock_blockchain/blockchain.pyx":286 + /* "dopt_pollublock_blockchain/blockchain.pyx":285 * digest = SHA256_digest(serialize_res, serialize_size, digest_size) * free(serialize_res) * if digest is NULL: # <<<<<<<<<<<<<< @@ -6645,7 +6646,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_perform_ __pyx_t_2 = (__pyx_v_digest == NULL); if (__pyx_t_2) { - /* "dopt_pollublock_blockchain/blockchain.pyx":287 + /* "dopt_pollublock_blockchain/blockchain.pyx":286 * free(serialize_res) * if digest is NULL: * return NULL # <<<<<<<<<<<<<< @@ -6655,7 +6656,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_perform_ __pyx_r = NULL; goto __pyx_L0; - /* "dopt_pollublock_blockchain/blockchain.pyx":286 + /* "dopt_pollublock_blockchain/blockchain.pyx":285 * digest = SHA256_digest(serialize_res, serialize_size, digest_size) * free(serialize_res) * if digest is NULL: # <<<<<<<<<<<<<< @@ -6664,7 +6665,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_perform_ */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":289 + /* "dopt_pollublock_blockchain/blockchain.pyx":288 * return NULL * * return digest # <<<<<<<<<<<<<< @@ -6674,7 +6675,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_perform_ __pyx_r = __pyx_v_digest; goto __pyx_L0; - /* "dopt_pollublock_blockchain/blockchain.pyx":275 + /* "dopt_pollublock_blockchain/blockchain.pyx":274 * * * cdef unsigned char* perform_hash_c(Block *block, size_t *digest_size) nogil: # <<<<<<<<<<<<<< @@ -6692,7 +6693,7 @@ static unsigned char *__pyx_f_26dopt_pollublock_blockchain_10blockchain_perform_ return __pyx_r; } -/* "dopt_pollublock_blockchain/blockchain.pyx":292 +/* "dopt_pollublock_blockchain/blockchain.pyx":291 * * * cdef int mine_block(Block *block, unsigned int difficulty, uint64_t *nonce_solution, unsigned int max_nonce=0xFFFFFFFF) nogil: # <<<<<<<<<<<<<< @@ -6725,7 +6726,7 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_mine_block(::Block } } - /* "dopt_pollublock_blockchain/blockchain.pyx":298 + /* "dopt_pollublock_blockchain/blockchain.pyx":297 * unsigned char *digest * size_t digest_size * bint nonce_found = False # <<<<<<<<<<<<<< @@ -6734,17 +6735,17 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_mine_block(::Block */ __pyx_v_nonce_found = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":301 + /* "dopt_pollublock_blockchain/blockchain.pyx":300 * int nonce * * serial_buf = bytes_serialize_c(block, &serialize_size) # <<<<<<<<<<<<<< * * with nogil: */ - __pyx_t_1 = __pyx_f_26dopt_pollublock_blockchain_10blockchain_bytes_serialize_c(__pyx_v_block, (&__pyx_v_serialize_size)); if (unlikely(__pyx_t_1 == ((void *)NULL) && __Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 301, __pyx_L1_error) + __pyx_t_1 = __pyx_f_26dopt_pollublock_blockchain_10blockchain_bytes_serialize_c(__pyx_v_block, (&__pyx_v_serialize_size)); if (unlikely(__pyx_t_1 == ((void *)NULL) && __Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 300, __pyx_L1_error) __pyx_v_serial_buf = __pyx_t_1; - /* "dopt_pollublock_blockchain/blockchain.pyx":303 + /* "dopt_pollublock_blockchain/blockchain.pyx":302 * serial_buf = bytes_serialize_c(block, &serialize_size) * * with nogil: # <<<<<<<<<<<<<< @@ -6757,7 +6758,7 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_mine_block(::Block __Pyx_FastGIL_Remember(); /*try:*/ { - /* "dopt_pollublock_blockchain/blockchain.pyx":304 + /* "dopt_pollublock_blockchain/blockchain.pyx":303 * * with nogil: * for nonce in range(max_nonce): # <<<<<<<<<<<<<< @@ -6769,36 +6770,36 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_mine_block(::Block for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_nonce = __pyx_t_4; - /* "dopt_pollublock_blockchain/blockchain.pyx":305 + /* "dopt_pollublock_blockchain/blockchain.pyx":304 * with nogil: * for nonce in range(max_nonce): * serialize_uint64(serial_buf + NONCE_OFFSET, nonce) # <<<<<<<<<<<<<< * digest = SHA256_digest(serial_buf, serialize_size, &digest_size) * */ - __pyx_t_5 = __pyx_f_26dopt_pollublock_blockchain_10blockchain_serialize_uint64((__pyx_v_serial_buf + __pyx_v_26dopt_pollublock_blockchain_10blockchain_NONCE_OFFSET), ((uint64_t)__pyx_v_nonce)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 305, __pyx_L4_error) + __pyx_t_5 = __pyx_f_26dopt_pollublock_blockchain_10blockchain_serialize_uint64((__pyx_v_serial_buf + __pyx_v_26dopt_pollublock_blockchain_10blockchain_NONCE_OFFSET), ((uint64_t)__pyx_v_nonce)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 304, __pyx_L4_error) - /* "dopt_pollublock_blockchain/blockchain.pyx":306 + /* "dopt_pollublock_blockchain/blockchain.pyx":305 * for nonce in range(max_nonce): * serialize_uint64(serial_buf + NONCE_OFFSET, nonce) * digest = SHA256_digest(serial_buf, serialize_size, &digest_size) # <<<<<<<<<<<<<< * * if has_leading_zero_bits(digest, difficulty): */ - __pyx_t_1 = __pyx_f_26dopt_pollublock_blockchain_10blockchain_SHA256_digest(__pyx_v_serial_buf, __pyx_v_serialize_size, (&__pyx_v_digest_size)); if (unlikely(__pyx_t_1 == ((void *)NULL) && __Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 306, __pyx_L4_error) + __pyx_t_1 = __pyx_f_26dopt_pollublock_blockchain_10blockchain_SHA256_digest(__pyx_v_serial_buf, __pyx_v_serialize_size, (&__pyx_v_digest_size)); if (unlikely(__pyx_t_1 == ((void *)NULL) && __Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 305, __pyx_L4_error) __pyx_v_digest = __pyx_t_1; - /* "dopt_pollublock_blockchain/blockchain.pyx":308 + /* "dopt_pollublock_blockchain/blockchain.pyx":307 * digest = SHA256_digest(serial_buf, serialize_size, &digest_size) * * if has_leading_zero_bits(digest, difficulty): # <<<<<<<<<<<<<< * nonce_found = True * nonce_solution[0] = nonce */ - __pyx_t_6 = __pyx_f_26dopt_pollublock_blockchain_10blockchain_has_leading_zero_bits(__pyx_v_digest, __pyx_v_difficulty); if (unlikely(__pyx_t_6 == ((int)-1) && __Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 308, __pyx_L4_error) + __pyx_t_6 = __pyx_f_26dopt_pollublock_blockchain_10blockchain_has_leading_zero_bits(__pyx_v_digest, __pyx_v_difficulty); if (unlikely(__pyx_t_6 == ((int)-1) && __Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 307, __pyx_L4_error) if (__pyx_t_6) { - /* "dopt_pollublock_blockchain/blockchain.pyx":309 + /* "dopt_pollublock_blockchain/blockchain.pyx":308 * * if has_leading_zero_bits(digest, difficulty): * nonce_found = True # <<<<<<<<<<<<<< @@ -6807,7 +6808,7 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_mine_block(::Block */ __pyx_v_nonce_found = 1; - /* "dopt_pollublock_blockchain/blockchain.pyx":310 + /* "dopt_pollublock_blockchain/blockchain.pyx":309 * if has_leading_zero_bits(digest, difficulty): * nonce_found = True * nonce_solution[0] = nonce # <<<<<<<<<<<<<< @@ -6816,7 +6817,7 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_mine_block(::Block */ (__pyx_v_nonce_solution[0]) = __pyx_v_nonce; - /* "dopt_pollublock_blockchain/blockchain.pyx":311 + /* "dopt_pollublock_blockchain/blockchain.pyx":310 * nonce_found = True * nonce_solution[0] = nonce * break # <<<<<<<<<<<<<< @@ -6825,7 +6826,7 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_mine_block(::Block */ goto __pyx_L7_break; - /* "dopt_pollublock_blockchain/blockchain.pyx":308 + /* "dopt_pollublock_blockchain/blockchain.pyx":307 * digest = SHA256_digest(serial_buf, serialize_size, &digest_size) * * if has_leading_zero_bits(digest, difficulty): # <<<<<<<<<<<<<< @@ -6834,7 +6835,7 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_mine_block(::Block */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":313 + /* "dopt_pollublock_blockchain/blockchain.pyx":312 * break * * free(digest) # <<<<<<<<<<<<<< @@ -6846,7 +6847,7 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_mine_block(::Block __pyx_L7_break:; } - /* "dopt_pollublock_blockchain/blockchain.pyx":303 + /* "dopt_pollublock_blockchain/blockchain.pyx":302 * serial_buf = bytes_serialize_c(block, &serialize_size) * * with nogil: # <<<<<<<<<<<<<< @@ -6868,7 +6869,7 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_mine_block(::Block } } - /* "dopt_pollublock_blockchain/blockchain.pyx":315 + /* "dopt_pollublock_blockchain/blockchain.pyx":314 * free(digest) * * free(serial_buf) # <<<<<<<<<<<<<< @@ -6877,7 +6878,7 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_mine_block(::Block */ free(__pyx_v_serial_buf); - /* "dopt_pollublock_blockchain/blockchain.pyx":317 + /* "dopt_pollublock_blockchain/blockchain.pyx":316 * free(serial_buf) * * if not nonce_found: # <<<<<<<<<<<<<< @@ -6887,7 +6888,7 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_mine_block(::Block __pyx_t_6 = (!__pyx_v_nonce_found); if (__pyx_t_6) { - /* "dopt_pollublock_blockchain/blockchain.pyx":318 + /* "dopt_pollublock_blockchain/blockchain.pyx":317 * * if not nonce_found: * return 1 # <<<<<<<<<<<<<< @@ -6897,7 +6898,7 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_mine_block(::Block __pyx_r = 1; goto __pyx_L0; - /* "dopt_pollublock_blockchain/blockchain.pyx":317 + /* "dopt_pollublock_blockchain/blockchain.pyx":316 * free(serial_buf) * * if not nonce_found: # <<<<<<<<<<<<<< @@ -6906,7 +6907,7 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_mine_block(::Block */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":320 + /* "dopt_pollublock_blockchain/blockchain.pyx":319 * return 1 * * return 0 # <<<<<<<<<<<<<< @@ -6916,7 +6917,7 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_mine_block(::Block __pyx_r = 0; goto __pyx_L0; - /* "dopt_pollublock_blockchain/blockchain.pyx":292 + /* "dopt_pollublock_blockchain/blockchain.pyx":291 * * * cdef int mine_block(Block *block, unsigned int difficulty, uint64_t *nonce_solution, unsigned int max_nonce=0xFFFFFFFF) nogil: # <<<<<<<<<<<<<< @@ -6934,7 +6935,7 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_mine_block(::Block return __pyx_r; } -/* "dopt_pollublock_blockchain/blockchain.pyx":334 +/* "dopt_pollublock_blockchain/blockchain.pyx":333 * readonly object _engine * * def __cinit__(self, *args, **kwargs): # <<<<<<<<<<<<<< @@ -6988,7 +6989,7 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain___cin int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "dopt_pollublock_blockchain/blockchain.pyx":335 + /* "dopt_pollublock_blockchain/blockchain.pyx":334 * * def __cinit__(self, *args, **kwargs): * self._difficulty = 26 # <<<<<<<<<<<<<< @@ -6997,7 +6998,7 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain___cin */ __pyx_v_self->_difficulty = 26; - /* "dopt_pollublock_blockchain/blockchain.pyx":336 + /* "dopt_pollublock_blockchain/blockchain.pyx":335 * def __cinit__(self, *args, **kwargs): * self._difficulty = 26 * self._index = 0 # <<<<<<<<<<<<<< @@ -7006,7 +7007,7 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain___cin */ __pyx_v_self->_index = ((uint64_t)0); - /* "dopt_pollublock_blockchain/blockchain.pyx":337 + /* "dopt_pollublock_blockchain/blockchain.pyx":336 * self._difficulty = 26 * self._index = 0 * self._genesis_done = False # <<<<<<<<<<<<<< @@ -7015,7 +7016,7 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain___cin */ __pyx_v_self->_genesis_done = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":338 + /* "dopt_pollublock_blockchain/blockchain.pyx":337 * self._index = 0 * self._genesis_done = False * self._loaded = False # <<<<<<<<<<<<<< @@ -7024,7 +7025,7 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain___cin */ __pyx_v_self->_loaded = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":339 + /* "dopt_pollublock_blockchain/blockchain.pyx":338 * self._genesis_done = False * self._loaded = False * self._chain_map = new unordered_map[uint64_t, Block*]() # <<<<<<<<<<<<<< @@ -7035,11 +7036,11 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain___cin __pyx_t_1 = new std::unordered_map (); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 339, __pyx_L1_error) + __PYX_ERR(0, 338, __pyx_L1_error) } __pyx_v_self->_chain_map = __pyx_t_1; - /* "dopt_pollublock_blockchain/blockchain.pyx":340 + /* "dopt_pollublock_blockchain/blockchain.pyx":339 * self._loaded = False * self._chain_map = new unordered_map[uint64_t, Block*]() * self._chain = new vector[Block*]() # <<<<<<<<<<<<<< @@ -7050,11 +7051,11 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain___cin __pyx_t_2 = new std::vector<::Block *> (); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 340, __pyx_L1_error) + __PYX_ERR(0, 339, __pyx_L1_error) } __pyx_v_self->_chain = __pyx_t_2; - /* "dopt_pollublock_blockchain/blockchain.pyx":341 + /* "dopt_pollublock_blockchain/blockchain.pyx":340 * self._chain_map = new unordered_map[uint64_t, Block*]() * self._chain = new vector[Block*]() * if self._chain_map is NULL: # <<<<<<<<<<<<<< @@ -7064,7 +7065,7 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain___cin __pyx_t_3 = (__pyx_v_self->_chain_map == NULL); if (unlikely(__pyx_t_3)) { - /* "dopt_pollublock_blockchain/blockchain.pyx":342 + /* "dopt_pollublock_blockchain/blockchain.pyx":341 * self._chain = new vector[Block*]() * if self._chain_map is NULL: * raise MemoryError("Could not allocate hasmap") # <<<<<<<<<<<<<< @@ -7077,14 +7078,14 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain___cin PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Could_not_allocate_hasmap}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_MemoryError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 342, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 341, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 342, __pyx_L1_error) + __PYX_ERR(0, 341, __pyx_L1_error) - /* "dopt_pollublock_blockchain/blockchain.pyx":341 + /* "dopt_pollublock_blockchain/blockchain.pyx":340 * self._chain_map = new unordered_map[uint64_t, Block*]() * self._chain = new vector[Block*]() * if self._chain_map is NULL: # <<<<<<<<<<<<<< @@ -7093,7 +7094,7 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain___cin */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":343 + /* "dopt_pollublock_blockchain/blockchain.pyx":342 * if self._chain_map is NULL: * raise MemoryError("Could not allocate hasmap") * if self._chain is NULL: # <<<<<<<<<<<<<< @@ -7103,7 +7104,7 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain___cin __pyx_t_3 = (__pyx_v_self->_chain == NULL); if (unlikely(__pyx_t_3)) { - /* "dopt_pollublock_blockchain/blockchain.pyx":344 + /* "dopt_pollublock_blockchain/blockchain.pyx":343 * raise MemoryError("Could not allocate hasmap") * if self._chain is NULL: * raise MemoryError("Could not allocate vector") # <<<<<<<<<<<<<< @@ -7116,14 +7117,14 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain___cin PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Could_not_allocate_vector}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_MemoryError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 344, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 343, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 344, __pyx_L1_error) + __PYX_ERR(0, 343, __pyx_L1_error) - /* "dopt_pollublock_blockchain/blockchain.pyx":343 + /* "dopt_pollublock_blockchain/blockchain.pyx":342 * if self._chain_map is NULL: * raise MemoryError("Could not allocate hasmap") * if self._chain is NULL: # <<<<<<<<<<<<<< @@ -7132,7 +7133,7 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain___cin */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":334 + /* "dopt_pollublock_blockchain/blockchain.pyx":333 * readonly object _engine * * def __cinit__(self, *args, **kwargs): # <<<<<<<<<<<<<< @@ -7153,7 +7154,7 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain___cin return __pyx_r; } -/* "dopt_pollublock_blockchain/blockchain.pyx":346 +/* "dopt_pollublock_blockchain/blockchain.pyx":345 * raise MemoryError("Could not allocate vector") * * def __init__(self, db_path): # <<<<<<<<<<<<<< @@ -7183,32 +7184,32 @@ static int __pyx_pw_26dopt_pollublock_blockchain_10blockchain_10Blockchain_3__in { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_db_path,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 346, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 345, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 346, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 345, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 346, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 345, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, i); __PYX_ERR(0, 346, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, i); __PYX_ERR(0, 345, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 346, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 345, __pyx_L3_error) } __pyx_v_db_path = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 346, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 345, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -7245,7 +7246,7 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_2__in int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "dopt_pollublock_blockchain/blockchain.pyx":347 + /* "dopt_pollublock_blockchain/blockchain.pyx":346 * * def __init__(self, db_path): * self.db_path = Path(db_path).resolve() # <<<<<<<<<<<<<< @@ -7253,7 +7254,7 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_2__in * raise FileNotFoundError( */ __pyx_t_4 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Path); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 347, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Path); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = 1; #if CYTHON_UNPACK_METHODS @@ -7272,7 +7273,7 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_2__in __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 347, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_t_2 = __pyx_t_3; @@ -7283,7 +7284,7 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_2__in __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_resolve, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 347, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_GIVEREF(__pyx_t_1); @@ -7292,14 +7293,14 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_2__in __pyx_v_self->db_path = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":348 + /* "dopt_pollublock_blockchain/blockchain.pyx":347 * def __init__(self, db_path): * self.db_path = Path(db_path).resolve() * if not self.db_path.parent.exists(): # <<<<<<<<<<<<<< * raise FileNotFoundError( * "The parent directory of the provided database path does not exist" */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->db_path, __pyx_mstate_global->__pyx_n_u_parent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 348, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->db_path, __pyx_mstate_global->__pyx_n_u_parent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 347, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); @@ -7309,15 +7310,15 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_2__in __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_exists, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 348, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 347, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 348, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 347, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_8 = (!__pyx_t_7); if (unlikely(__pyx_t_8)) { - /* "dopt_pollublock_blockchain/blockchain.pyx":349 + /* "dopt_pollublock_blockchain/blockchain.pyx":348 * self.db_path = Path(db_path).resolve() * if not self.db_path.parent.exists(): * raise FileNotFoundError( # <<<<<<<<<<<<<< @@ -7330,14 +7331,14 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_2__in PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_The_parent_directory_of_the_prov}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_FileNotFoundError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 349, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 349, __pyx_L1_error) + __PYX_ERR(0, 348, __pyx_L1_error) - /* "dopt_pollublock_blockchain/blockchain.pyx":348 + /* "dopt_pollublock_blockchain/blockchain.pyx":347 * def __init__(self, db_path): * self.db_path = Path(db_path).resolve() * if not self.db_path.parent.exists(): # <<<<<<<<<<<<<< @@ -7346,7 +7347,7 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_2__in */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":353 + /* "dopt_pollublock_blockchain/blockchain.pyx":352 * ) * * self._engine = sql.create_engine(f"sqlite:///{str(self.db_path)}") # <<<<<<<<<<<<<< @@ -7354,14 +7355,14 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_2__in * */ __pyx_t_2 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_sql); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_sql); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 352, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_create_engine); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 353, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_create_engine); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 352, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Unicode(__pyx_v_self->db_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 353, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Unicode(__pyx_v_self->db_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 352, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_sqlite, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 353, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_sqlite, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 352, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = 1; @@ -7382,7 +7383,7 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_2__in __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 352, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_GIVEREF(__pyx_t_1); @@ -7391,16 +7392,16 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_2__in __pyx_v_self->_engine = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":354 + /* "dopt_pollublock_blockchain/blockchain.pyx":353 * * self._engine = sql.create_engine(f"sqlite:///{str(self.db_path)}") * db.metadata_blockchain.create_all(self._engine) # <<<<<<<<<<<<<< * * def __dealloc__(self): */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_db); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 354, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_db); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 353, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_metadata_blockchain); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 354, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_metadata_blockchain); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 353, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = __pyx_t_2; @@ -7411,12 +7412,12 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_2__in __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_create_all, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 354, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":346 + /* "dopt_pollublock_blockchain/blockchain.pyx":345 * raise MemoryError("Could not allocate vector") * * def __init__(self, db_path): # <<<<<<<<<<<<<< @@ -7440,7 +7441,7 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_2__in return __pyx_r; } -/* "dopt_pollublock_blockchain/blockchain.pyx":356 +/* "dopt_pollublock_blockchain/blockchain.pyx":355 * db.metadata_blockchain.create_all(self._engine) * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -7465,7 +7466,7 @@ static void __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_4__d std::unordered_map ::iterator __pyx_v_it; int __pyx_t_1; - /* "dopt_pollublock_blockchain/blockchain.pyx":358 + /* "dopt_pollublock_blockchain/blockchain.pyx":357 * def __dealloc__(self): * # ownership is typically not transferred from the Blockchain extension class * cdef BcHashmap.iterator it = self._chain_map.begin() # <<<<<<<<<<<<<< @@ -7474,7 +7475,7 @@ static void __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_4__d */ __pyx_v_it = __pyx_v_self->_chain_map->begin(); - /* "dopt_pollublock_blockchain/blockchain.pyx":359 + /* "dopt_pollublock_blockchain/blockchain.pyx":358 * # ownership is typically not transferred from the Blockchain extension class * cdef BcHashmap.iterator it = self._chain_map.begin() * if self._chain_map is not NULL: # <<<<<<<<<<<<<< @@ -7484,7 +7485,7 @@ static void __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_4__d __pyx_t_1 = (__pyx_v_self->_chain_map != NULL); if (__pyx_t_1) { - /* "dopt_pollublock_blockchain/blockchain.pyx":360 + /* "dopt_pollublock_blockchain/blockchain.pyx":359 * cdef BcHashmap.iterator it = self._chain_map.begin() * if self._chain_map is not NULL: * while it != self._chain_map.end(): # <<<<<<<<<<<<<< @@ -7495,7 +7496,7 @@ static void __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_4__d __pyx_t_1 = (__pyx_v_it != __pyx_v_self->_chain_map->end()); if (!__pyx_t_1) break; - /* "dopt_pollublock_blockchain/blockchain.pyx":361 + /* "dopt_pollublock_blockchain/blockchain.pyx":360 * if self._chain_map is not NULL: * while it != self._chain_map.end(): * del dereference(it).second # <<<<<<<<<<<<<< @@ -7504,7 +7505,7 @@ static void __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_4__d */ delete (*__pyx_v_it).second; - /* "dopt_pollublock_blockchain/blockchain.pyx":362 + /* "dopt_pollublock_blockchain/blockchain.pyx":361 * while it != self._chain_map.end(): * del dereference(it).second * postincrement(it) # <<<<<<<<<<<<<< @@ -7514,7 +7515,7 @@ static void __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_4__d (void)((__pyx_v_it++)); } - /* "dopt_pollublock_blockchain/blockchain.pyx":364 + /* "dopt_pollublock_blockchain/blockchain.pyx":363 * postincrement(it) * * del self._chain_map # <<<<<<<<<<<<<< @@ -7523,7 +7524,7 @@ static void __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_4__d */ delete __pyx_v_self->_chain_map; - /* "dopt_pollublock_blockchain/blockchain.pyx":365 + /* "dopt_pollublock_blockchain/blockchain.pyx":364 * * del self._chain_map * self._chain_map = NULL # <<<<<<<<<<<<<< @@ -7532,7 +7533,7 @@ static void __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_4__d */ __pyx_v_self->_chain_map = NULL; - /* "dopt_pollublock_blockchain/blockchain.pyx":359 + /* "dopt_pollublock_blockchain/blockchain.pyx":358 * # ownership is typically not transferred from the Blockchain extension class * cdef BcHashmap.iterator it = self._chain_map.begin() * if self._chain_map is not NULL: # <<<<<<<<<<<<<< @@ -7541,7 +7542,7 @@ static void __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_4__d */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":367 + /* "dopt_pollublock_blockchain/blockchain.pyx":366 * self._chain_map = NULL * * if self._chain is not NULL: # <<<<<<<<<<<<<< @@ -7551,7 +7552,7 @@ static void __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_4__d __pyx_t_1 = (__pyx_v_self->_chain != NULL); if (__pyx_t_1) { - /* "dopt_pollublock_blockchain/blockchain.pyx":368 + /* "dopt_pollublock_blockchain/blockchain.pyx":367 * * if self._chain is not NULL: * del self._chain # <<<<<<<<<<<<<< @@ -7560,7 +7561,7 @@ static void __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_4__d */ delete __pyx_v_self->_chain; - /* "dopt_pollublock_blockchain/blockchain.pyx":369 + /* "dopt_pollublock_blockchain/blockchain.pyx":368 * if self._chain is not NULL: * del self._chain * self._chain = NULL # <<<<<<<<<<<<<< @@ -7569,7 +7570,7 @@ static void __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_4__d */ __pyx_v_self->_chain = NULL; - /* "dopt_pollublock_blockchain/blockchain.pyx":367 + /* "dopt_pollublock_blockchain/blockchain.pyx":366 * self._chain_map = NULL * * if self._chain is not NULL: # <<<<<<<<<<<<<< @@ -7578,7 +7579,7 @@ static void __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_4__d */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":356 + /* "dopt_pollublock_blockchain/blockchain.pyx":355 * db.metadata_blockchain.create_all(self._engine) * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -7589,7 +7590,7 @@ static void __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_4__d /* function exit code */ } -/* "dopt_pollublock_blockchain/blockchain.pyx":371 +/* "dopt_pollublock_blockchain/blockchain.pyx":370 * self._chain = NULL * * cdef Block* get_block_c(self, uint64_t idx) nogil: # <<<<<<<<<<<<<< @@ -7601,7 +7602,7 @@ static ::Block *__pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_g ::Block *__pyx_r; int __pyx_t_1; - /* "dopt_pollublock_blockchain/blockchain.pyx":372 + /* "dopt_pollublock_blockchain/blockchain.pyx":371 * * cdef Block* get_block_c(self, uint64_t idx) nogil: * if idx > self._index: # <<<<<<<<<<<<<< @@ -7611,7 +7612,7 @@ static ::Block *__pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_g __pyx_t_1 = (__pyx_v_idx > __pyx_v_self->_index); if (__pyx_t_1) { - /* "dopt_pollublock_blockchain/blockchain.pyx":373 + /* "dopt_pollublock_blockchain/blockchain.pyx":372 * cdef Block* get_block_c(self, uint64_t idx) nogil: * if idx > self._index: * return NULL # <<<<<<<<<<<<<< @@ -7621,7 +7622,7 @@ static ::Block *__pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_g __pyx_r = NULL; goto __pyx_L0; - /* "dopt_pollublock_blockchain/blockchain.pyx":372 + /* "dopt_pollublock_blockchain/blockchain.pyx":371 * * cdef Block* get_block_c(self, uint64_t idx) nogil: * if idx > self._index: # <<<<<<<<<<<<<< @@ -7630,7 +7631,7 @@ static ::Block *__pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_g */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":374 + /* "dopt_pollublock_blockchain/blockchain.pyx":373 * if idx > self._index: * return NULL * return self._chain_map[0][idx] # <<<<<<<<<<<<<< @@ -7640,7 +7641,7 @@ static ::Block *__pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_g __pyx_r = ((__pyx_v_self->_chain_map[0])[__pyx_v_idx]); goto __pyx_L0; - /* "dopt_pollublock_blockchain/blockchain.pyx":371 + /* "dopt_pollublock_blockchain/blockchain.pyx":370 * self._chain = NULL * * cdef Block* get_block_c(self, uint64_t idx) nogil: # <<<<<<<<<<<<<< @@ -7653,7 +7654,7 @@ static ::Block *__pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_g return __pyx_r; } -/* "dopt_pollublock_blockchain/blockchain.pyx":376 +/* "dopt_pollublock_blockchain/blockchain.pyx":375 * return self._chain_map[0][idx] * * cdef void add_block_from_loading(self, Block *block) nogil: # <<<<<<<<<<<<<< @@ -7669,7 +7670,7 @@ static void __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_add_b int __pyx_clineno = 0; PyGILState_STATE __pyx_gilstate_save; - /* "dopt_pollublock_blockchain/blockchain.pyx":377 + /* "dopt_pollublock_blockchain/blockchain.pyx":376 * * cdef void add_block_from_loading(self, Block *block) nogil: * self._chain[0].push_back(block) # <<<<<<<<<<<<<< @@ -7682,10 +7683,10 @@ static void __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_add_b PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); __Pyx_CppExn2PyErr(); __Pyx_PyGILState_Release(__pyx_gilstate_save); - __PYX_ERR(0, 377, __pyx_L1_error) + __PYX_ERR(0, 376, __pyx_L1_error) } - /* "dopt_pollublock_blockchain/blockchain.pyx":378 + /* "dopt_pollublock_blockchain/blockchain.pyx":377 * cdef void add_block_from_loading(self, Block *block) nogil: * self._chain[0].push_back(block) * self._chain_map[0][block.index] = block # <<<<<<<<<<<<<< @@ -7694,7 +7695,7 @@ static void __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_add_b */ ((__pyx_v_self->_chain_map[0])[__pyx_v_block->index]) = __pyx_v_block; - /* "dopt_pollublock_blockchain/blockchain.pyx":379 + /* "dopt_pollublock_blockchain/blockchain.pyx":378 * self._chain[0].push_back(block) * self._chain_map[0][block.index] = block * self._index = block.index # <<<<<<<<<<<<<< @@ -7704,7 +7705,7 @@ static void __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_add_b __pyx_t_1 = __pyx_v_block->index; __pyx_v_self->_index = __pyx_t_1; - /* "dopt_pollublock_blockchain/blockchain.pyx":380 + /* "dopt_pollublock_blockchain/blockchain.pyx":379 * self._chain_map[0][block.index] = block * self._index = block.index * if not self._genesis_done: # <<<<<<<<<<<<<< @@ -7714,7 +7715,7 @@ static void __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_add_b __pyx_t_2 = (!__pyx_v_self->_genesis_done); if (__pyx_t_2) { - /* "dopt_pollublock_blockchain/blockchain.pyx":381 + /* "dopt_pollublock_blockchain/blockchain.pyx":380 * self._index = block.index * if not self._genesis_done: * self._genesis_done = True # <<<<<<<<<<<<<< @@ -7723,7 +7724,7 @@ static void __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_add_b */ __pyx_v_self->_genesis_done = 1; - /* "dopt_pollublock_blockchain/blockchain.pyx":380 + /* "dopt_pollublock_blockchain/blockchain.pyx":379 * self._chain_map[0][block.index] = block * self._index = block.index * if not self._genesis_done: # <<<<<<<<<<<<<< @@ -7732,7 +7733,7 @@ static void __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_add_b */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":376 + /* "dopt_pollublock_blockchain/blockchain.pyx":375 * return self._chain_map[0][idx] * * cdef void add_block_from_loading(self, Block *block) nogil: # <<<<<<<<<<<<<< @@ -7749,7 +7750,7 @@ static void __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_add_b __pyx_L0:; } -/* "dopt_pollublock_blockchain/blockchain.pyx":383 +/* "dopt_pollublock_blockchain/blockchain.pyx":382 * self._genesis_done = True * * cdef int add_block(self, Block *block) nogil: # <<<<<<<<<<<<<< @@ -7779,18 +7780,18 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_add_bl PyGILState_STATE __pyx_gilstate_save; __Pyx_RefNannySetupContext("add_block", 1); - /* "dopt_pollublock_blockchain/blockchain.pyx":389 + /* "dopt_pollublock_blockchain/blockchain.pyx":388 * unsigned char *sha256_digest * # mine block * if mine_block(block, self._difficulty, &mined_nonce) != 0: # <<<<<<<<<<<<<< * return 1 * block.nonce = mined_nonce */ - __pyx_t_1 = __pyx_f_26dopt_pollublock_blockchain_10blockchain_mine_block(__pyx_v_block, __pyx_v_self->_difficulty, (&__pyx_v_mined_nonce), NULL); if (unlikely(__pyx_t_1 == ((int)-1) && __Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 389, __pyx_L1_error) + __pyx_t_1 = __pyx_f_26dopt_pollublock_blockchain_10blockchain_mine_block(__pyx_v_block, __pyx_v_self->_difficulty, (&__pyx_v_mined_nonce), NULL); if (unlikely(__pyx_t_1 == ((int)-1) && __Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 388, __pyx_L1_error) __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "dopt_pollublock_blockchain/blockchain.pyx":390 + /* "dopt_pollublock_blockchain/blockchain.pyx":389 * # mine block * if mine_block(block, self._difficulty, &mined_nonce) != 0: * return 1 # <<<<<<<<<<<<<< @@ -7800,7 +7801,7 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_add_bl __pyx_r = 1; goto __pyx_L0; - /* "dopt_pollublock_blockchain/blockchain.pyx":389 + /* "dopt_pollublock_blockchain/blockchain.pyx":388 * unsigned char *sha256_digest * # mine block * if mine_block(block, self._difficulty, &mined_nonce) != 0: # <<<<<<<<<<<<<< @@ -7809,7 +7810,7 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_add_bl */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":391 + /* "dopt_pollublock_blockchain/blockchain.pyx":390 * if mine_block(block, self._difficulty, &mined_nonce) != 0: * return 1 * block.nonce = mined_nonce # <<<<<<<<<<<<<< @@ -7818,17 +7819,17 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_add_bl */ __pyx_v_block->nonce = __pyx_v_mined_nonce; - /* "dopt_pollublock_blockchain/blockchain.pyx":393 + /* "dopt_pollublock_blockchain/blockchain.pyx":392 * block.nonce = mined_nonce * # hash block, add hash to block, add block to blockchain hashmap * sha256_digest = perform_hash_c(block, &digest_size) # <<<<<<<<<<<<<< * with gil: * block.hash = bytes(sha256_digest[:digest_size]).hex().encode("UTF-8") */ - __pyx_t_3 = __pyx_f_26dopt_pollublock_blockchain_10blockchain_perform_hash_c(__pyx_v_block, (&__pyx_v_digest_size)); if (unlikely(__pyx_t_3 == ((void *)NULL) && __Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 393, __pyx_L1_error) + __pyx_t_3 = __pyx_f_26dopt_pollublock_blockchain_10blockchain_perform_hash_c(__pyx_v_block, (&__pyx_v_digest_size)); if (unlikely(__pyx_t_3 == ((void *)NULL) && __Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 392, __pyx_L1_error) __pyx_v_sha256_digest = __pyx_t_3; - /* "dopt_pollublock_blockchain/blockchain.pyx":394 + /* "dopt_pollublock_blockchain/blockchain.pyx":393 * # hash block, add hash to block, add block to blockchain hashmap * sha256_digest = perform_hash_c(block, &digest_size) * with gil: # <<<<<<<<<<<<<< @@ -7839,7 +7840,7 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_add_bl PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); /*try:*/ { - /* "dopt_pollublock_blockchain/blockchain.pyx":395 + /* "dopt_pollublock_blockchain/blockchain.pyx":394 * sha256_digest = perform_hash_c(block, &digest_size) * with gil: * block.hash = bytes(sha256_digest[:digest_size]).hex().encode("UTF-8") # <<<<<<<<<<<<<< @@ -7847,7 +7848,7 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_add_bl * self._chain[0].push_back(block) */ __pyx_t_7 = NULL; - __pyx_t_8 = __Pyx_PyBytes_FromStringAndSize(((char const *)__pyx_v_sha256_digest) + 0, __pyx_v_digest_size - 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 395, __pyx_L5_error) + __pyx_t_8 = __Pyx_PyBytes_FromStringAndSize(((char const *)__pyx_v_sha256_digest) + 0, __pyx_v_digest_size - 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 394, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = 1; { @@ -7855,7 +7856,7 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_add_bl __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(&PyBytes_Type), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 395, __pyx_L5_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 394, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_6); } __pyx_t_5 = __pyx_t_6; @@ -7866,18 +7867,18 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_add_bl __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_hex, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 395, __pyx_L5_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 394, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); } - __pyx_t_6 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_4)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 395, __pyx_L5_error) + __pyx_t_6 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_4)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 394, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_10 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_6); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 395, __pyx_L5_error) + __pyx_t_10 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_6); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 394, __pyx_L5_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_block->hash = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_10); } - /* "dopt_pollublock_blockchain/blockchain.pyx":394 + /* "dopt_pollublock_blockchain/blockchain.pyx":393 * # hash block, add hash to block, add block to blockchain hashmap * sha256_digest = perform_hash_c(block, &digest_size) * with gil: # <<<<<<<<<<<<<< @@ -7897,7 +7898,7 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_add_bl } } - /* "dopt_pollublock_blockchain/blockchain.pyx":396 + /* "dopt_pollublock_blockchain/blockchain.pyx":395 * with gil: * block.hash = bytes(sha256_digest[:digest_size]).hex().encode("UTF-8") * free(sha256_digest) # <<<<<<<<<<<<<< @@ -7906,7 +7907,7 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_add_bl */ free(__pyx_v_sha256_digest); - /* "dopt_pollublock_blockchain/blockchain.pyx":397 + /* "dopt_pollublock_blockchain/blockchain.pyx":396 * block.hash = bytes(sha256_digest[:digest_size]).hex().encode("UTF-8") * free(sha256_digest) * self._chain[0].push_back(block) # <<<<<<<<<<<<<< @@ -7919,10 +7920,10 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_add_bl PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); __Pyx_CppExn2PyErr(); __Pyx_PyGILState_Release(__pyx_gilstate_save); - __PYX_ERR(0, 397, __pyx_L1_error) + __PYX_ERR(0, 396, __pyx_L1_error) } - /* "dopt_pollublock_blockchain/blockchain.pyx":398 + /* "dopt_pollublock_blockchain/blockchain.pyx":397 * free(sha256_digest) * self._chain[0].push_back(block) * self._chain_map[0][block.index] = block # <<<<<<<<<<<<<< @@ -7931,7 +7932,7 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_add_bl */ ((__pyx_v_self->_chain_map[0])[__pyx_v_block->index]) = __pyx_v_block; - /* "dopt_pollublock_blockchain/blockchain.pyx":400 + /* "dopt_pollublock_blockchain/blockchain.pyx":399 * self._chain_map[0][block.index] = block * * if self._genesis_done: # <<<<<<<<<<<<<< @@ -7940,7 +7941,7 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_add_bl */ if (__pyx_v_self->_genesis_done) { - /* "dopt_pollublock_blockchain/blockchain.pyx":401 + /* "dopt_pollublock_blockchain/blockchain.pyx":400 * * if self._genesis_done: * self._index += 1 # <<<<<<<<<<<<<< @@ -7949,7 +7950,7 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_add_bl */ __pyx_v_self->_index = (__pyx_v_self->_index + 1); - /* "dopt_pollublock_blockchain/blockchain.pyx":400 + /* "dopt_pollublock_blockchain/blockchain.pyx":399 * self._chain_map[0][block.index] = block * * if self._genesis_done: # <<<<<<<<<<<<<< @@ -7958,7 +7959,7 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_add_bl */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":403 + /* "dopt_pollublock_blockchain/blockchain.pyx":402 * self._index += 1 * * return 0 # <<<<<<<<<<<<<< @@ -7968,7 +7969,7 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_add_bl __pyx_r = 0; goto __pyx_L0; - /* "dopt_pollublock_blockchain/blockchain.pyx":383 + /* "dopt_pollublock_blockchain/blockchain.pyx":382 * self._genesis_done = True * * cdef int add_block(self, Block *block) nogil: # <<<<<<<<<<<<<< @@ -7992,7 +7993,7 @@ static int __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_add_bl return __pyx_r; } -/* "dopt_pollublock_blockchain/blockchain.pyx":405 +/* "dopt_pollublock_blockchain/blockchain.pyx":404 * return 0 * * cdef string hash_data(self, data): # <<<<<<<<<<<<<< @@ -8020,7 +8021,7 @@ static std::string __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchai int __pyx_clineno = 0; __Pyx_RefNannySetupContext("hash_data", 0); - /* "dopt_pollublock_blockchain/blockchain.pyx":410 + /* "dopt_pollublock_blockchain/blockchain.pyx":409 * unsigned char *data_digest * size_t digest_size * data_str = data.encode("UTF-8") # <<<<<<<<<<<<<< @@ -8034,24 +8035,24 @@ static std::string __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchai PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_UTF_8}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 410, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 409, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } - __pyx_t_4 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 410, __pyx_L1_error) + __pyx_t_4 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 409, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_data_str = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_4); - /* "dopt_pollublock_blockchain/blockchain.pyx":411 + /* "dopt_pollublock_blockchain/blockchain.pyx":410 * size_t digest_size * data_str = data.encode("UTF-8") * data_digest = SHA256_digest(data_str.c_str(), data_str.size(), &digest_size) # <<<<<<<<<<<<<< * if data_digest is NULL: * raise RuntimeError("Failed to hash data") */ - __pyx_t_5 = __pyx_f_26dopt_pollublock_blockchain_10blockchain_SHA256_digest(__pyx_v_data_str.c_str(), __pyx_v_data_str.size(), (&__pyx_v_digest_size)); if (unlikely(__pyx_t_5 == ((void *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 411, __pyx_L1_error) + __pyx_t_5 = __pyx_f_26dopt_pollublock_blockchain_10blockchain_SHA256_digest(__pyx_v_data_str.c_str(), __pyx_v_data_str.size(), (&__pyx_v_digest_size)); if (unlikely(__pyx_t_5 == ((void *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 410, __pyx_L1_error) __pyx_v_data_digest = __pyx_t_5; - /* "dopt_pollublock_blockchain/blockchain.pyx":412 + /* "dopt_pollublock_blockchain/blockchain.pyx":411 * data_str = data.encode("UTF-8") * data_digest = SHA256_digest(data_str.c_str(), data_str.size(), &digest_size) * if data_digest is NULL: # <<<<<<<<<<<<<< @@ -8061,7 +8062,7 @@ static std::string __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchai __pyx_t_6 = (__pyx_v_data_digest == NULL); if (unlikely(__pyx_t_6)) { - /* "dopt_pollublock_blockchain/blockchain.pyx":413 + /* "dopt_pollublock_blockchain/blockchain.pyx":412 * data_digest = SHA256_digest(data_str.c_str(), data_str.size(), &digest_size) * if data_digest is NULL: * raise RuntimeError("Failed to hash data") # <<<<<<<<<<<<<< @@ -8074,14 +8075,14 @@ static std::string __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchai PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Failed_to_hash_data}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 413, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 412, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 413, __pyx_L1_error) + __PYX_ERR(0, 412, __pyx_L1_error) - /* "dopt_pollublock_blockchain/blockchain.pyx":412 + /* "dopt_pollublock_blockchain/blockchain.pyx":411 * data_str = data.encode("UTF-8") * data_digest = SHA256_digest(data_str.c_str(), data_str.size(), &digest_size) * if data_digest is NULL: # <<<<<<<<<<<<<< @@ -8090,7 +8091,7 @@ static std::string __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchai */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":414 + /* "dopt_pollublock_blockchain/blockchain.pyx":413 * if data_digest is NULL: * raise RuntimeError("Failed to hash data") * data_str = bytes(data_digest[:digest_size]).hex().encode("UTF-8") # <<<<<<<<<<<<<< @@ -8098,7 +8099,7 @@ static std::string __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchai * */ __pyx_t_8 = NULL; - __pyx_t_9 = __Pyx_PyBytes_FromStringAndSize(((char const *)__pyx_v_data_digest) + 0, __pyx_v_digest_size - 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 414, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyBytes_FromStringAndSize(((char const *)__pyx_v_data_digest) + 0, __pyx_v_digest_size - 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_3 = 1; { @@ -8106,7 +8107,7 @@ static std::string __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchai __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)(&PyBytes_Type), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 414, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); } __pyx_t_2 = __pyx_t_7; @@ -8117,17 +8118,17 @@ static std::string __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchai __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_hex, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 414, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } - __pyx_t_7 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 414, __pyx_L1_error) + __pyx_t_7 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_7); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 414, __pyx_L1_error) + __pyx_t_4 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_7); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_data_str = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_4); - /* "dopt_pollublock_blockchain/blockchain.pyx":415 + /* "dopt_pollublock_blockchain/blockchain.pyx":414 * raise RuntimeError("Failed to hash data") * data_str = bytes(data_digest[:digest_size]).hex().encode("UTF-8") * free(data_digest) # <<<<<<<<<<<<<< @@ -8136,7 +8137,7 @@ static std::string __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchai */ free(__pyx_v_data_digest); - /* "dopt_pollublock_blockchain/blockchain.pyx":417 + /* "dopt_pollublock_blockchain/blockchain.pyx":416 * free(data_digest) * * return data_str # <<<<<<<<<<<<<< @@ -8146,7 +8147,7 @@ static std::string __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchai __pyx_r = __pyx_v_data_str; goto __pyx_L0; - /* "dopt_pollublock_blockchain/blockchain.pyx":405 + /* "dopt_pollublock_blockchain/blockchain.pyx":404 * return 0 * * cdef string hash_data(self, data): # <<<<<<<<<<<<<< @@ -8168,7 +8169,7 @@ static std::string __pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchai return __pyx_r; } -/* "dopt_pollublock_blockchain/blockchain.pyx":419 +/* "dopt_pollublock_blockchain/blockchain.pyx":418 * return data_str * * cdef load_from_batch(self, batch): # <<<<<<<<<<<<<< @@ -8200,7 +8201,7 @@ static PyObject *__pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("load_from_batch", 0); - /* "dopt_pollublock_blockchain/blockchain.pyx":422 + /* "dopt_pollublock_blockchain/blockchain.pyx":421 * cdef Block *block * * for entry in batch: # <<<<<<<<<<<<<< @@ -8212,9 +8213,9 @@ static PyObject *__pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_ __pyx_t_2 = 0; __pyx_t_3 = NULL; } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_batch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 422, __pyx_L1_error) + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_batch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 421, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 422, __pyx_L1_error) + __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 421, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_3)) { @@ -8222,7 +8223,7 @@ static PyObject *__pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_ { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); #if !CYTHON_ASSUME_SAFE_SIZE - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 422, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 421, __pyx_L1_error) #endif if (__pyx_t_2 >= __pyx_temp) break; } @@ -8232,7 +8233,7 @@ static PyObject *__pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_ { Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); #if !CYTHON_ASSUME_SAFE_SIZE - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 422, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 421, __pyx_L1_error) #endif if (__pyx_t_2 >= __pyx_temp) break; } @@ -8243,13 +8244,13 @@ static PyObject *__pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_ #endif ++__pyx_t_2; } - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 422, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 421, __pyx_L1_error) } else { __pyx_t_4 = __pyx_t_3(__pyx_t_1); if (unlikely(!__pyx_t_4)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { - if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 422, __pyx_L1_error) + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 421, __pyx_L1_error) PyErr_Clear(); } break; @@ -8259,50 +8260,50 @@ static PyObject *__pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_ __Pyx_XDECREF_SET(__pyx_v_entry, __pyx_t_4); __pyx_t_4 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":424 + /* "dopt_pollublock_blockchain/blockchain.pyx":423 * for entry in batch: * block = new Block( * entry[0], # <<<<<<<<<<<<<< * entry[1], * entry[2], */ - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_entry, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 424, __pyx_L1_error) + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_entry, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 423, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyLong_As_uint64_t(__pyx_t_4); if (unlikely((__pyx_t_5 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 424, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyLong_As_uint64_t(__pyx_t_4); if (unlikely((__pyx_t_5 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 423, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":425 + /* "dopt_pollublock_blockchain/blockchain.pyx":424 * block = new Block( * entry[0], * entry[1], # <<<<<<<<<<<<<< * entry[2], * entry[5].encode("UTF-8"), */ - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_entry, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 425, __pyx_L1_error) + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_entry, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 424, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 425, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 424, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":426 + /* "dopt_pollublock_blockchain/blockchain.pyx":425 * entry[0], * entry[1], * entry[2], # <<<<<<<<<<<<<< * entry[5].encode("UTF-8"), * entry[3].encode("UTF-8"), */ - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_entry, 2, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 426, __pyx_L1_error) + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_entry, 2, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 425, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = __Pyx_PyLong_As_uint64_t(__pyx_t_4); if (unlikely((__pyx_t_7 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 426, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyLong_As_uint64_t(__pyx_t_4); if (unlikely((__pyx_t_7 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 425, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":427 + /* "dopt_pollublock_blockchain/blockchain.pyx":426 * entry[1], * entry[2], * entry[5].encode("UTF-8"), # <<<<<<<<<<<<<< * entry[3].encode("UTF-8"), * entry[4].encode("UTF-8"), */ - __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_entry, 5, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 427, __pyx_L1_error) + __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_entry, 5, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 426, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_8 = __pyx_t_9; __Pyx_INCREF(__pyx_t_8); @@ -8312,20 +8313,20 @@ static PyObject *__pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_ __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 427, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 426, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } - __pyx_t_11 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 427, __pyx_L1_error) + __pyx_t_11 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 426, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":428 + /* "dopt_pollublock_blockchain/blockchain.pyx":427 * entry[2], * entry[5].encode("UTF-8"), * entry[3].encode("UTF-8"), # <<<<<<<<<<<<<< * entry[4].encode("UTF-8"), * ) */ - __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_entry, 3, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 428, __pyx_L1_error) + __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_entry, 3, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 427, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = __pyx_t_8; __Pyx_INCREF(__pyx_t_9); @@ -8335,20 +8336,20 @@ static PyObject *__pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_ __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 428, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 427, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } - __pyx_t_12 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 428, __pyx_L1_error) + __pyx_t_12 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 427, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":429 + /* "dopt_pollublock_blockchain/blockchain.pyx":428 * entry[5].encode("UTF-8"), * entry[3].encode("UTF-8"), * entry[4].encode("UTF-8"), # <<<<<<<<<<<<<< * ) * self.add_block_from_loading(block) */ - __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_entry, 4, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 429, __pyx_L1_error) + __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_entry, 4, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 428, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_8 = __pyx_t_9; __Pyx_INCREF(__pyx_t_8); @@ -8358,13 +8359,13 @@ static PyObject *__pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_ __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 429, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 428, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } - __pyx_t_13 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 429, __pyx_L1_error) + __pyx_t_13 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 428, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":423 + /* "dopt_pollublock_blockchain/blockchain.pyx":422 * * for entry in batch: * block = new Block( # <<<<<<<<<<<<<< @@ -8375,20 +8376,20 @@ static PyObject *__pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_ __pyx_t_14 = new ::Block(__pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_11, __pyx_t_12, __pyx_t_13); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 423, __pyx_L1_error) + __PYX_ERR(0, 422, __pyx_L1_error) } __pyx_v_block = __pyx_t_14; - /* "dopt_pollublock_blockchain/blockchain.pyx":431 + /* "dopt_pollublock_blockchain/blockchain.pyx":430 * entry[4].encode("UTF-8"), * ) * self.add_block_from_loading(block) # <<<<<<<<<<<<<< * * # // Python public API */ - ((struct __pyx_vtabstruct_26dopt_pollublock_blockchain_10blockchain_Blockchain *)__pyx_v_self->__pyx_vtab)->add_block_from_loading(__pyx_v_self, __pyx_v_block); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 431, __pyx_L1_error) + ((struct __pyx_vtabstruct_26dopt_pollublock_blockchain_10blockchain_Blockchain *)__pyx_v_self->__pyx_vtab)->add_block_from_loading(__pyx_v_self, __pyx_v_block); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 430, __pyx_L1_error) - /* "dopt_pollublock_blockchain/blockchain.pyx":422 + /* "dopt_pollublock_blockchain/blockchain.pyx":421 * cdef Block *block * * for entry in batch: # <<<<<<<<<<<<<< @@ -8398,7 +8399,7 @@ static PyObject *__pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_ } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":419 + /* "dopt_pollublock_blockchain/blockchain.pyx":418 * return data_str * * cdef load_from_batch(self, batch): # <<<<<<<<<<<<<< @@ -8423,12 +8424,12 @@ static PyObject *__pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_ return __pyx_r; } -/* "dopt_pollublock_blockchain/blockchain.pyx":434 +/* "dopt_pollublock_blockchain/blockchain.pyx":433 * * # // Python public API * def __len__(self): # <<<<<<<<<<<<<< - * return self._index + 1 - * + * if self.genesis_done: + * return self._index + 1 */ /* Python wrapper */ @@ -8448,32 +8449,78 @@ static Py_ssize_t __pyx_pw_26dopt_pollublock_blockchain_10blockchain_10Blockchai static Py_ssize_t __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_6__len__(struct __pyx_obj_26dopt_pollublock_blockchain_10blockchain_Blockchain *__pyx_v_self) { Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__len__", 0); - /* "dopt_pollublock_blockchain/blockchain.pyx":435 + /* "dopt_pollublock_blockchain/blockchain.pyx":434 * # // Python public API * def __len__(self): - * return self._index + 1 # <<<<<<<<<<<<<< + * if self.genesis_done: # <<<<<<<<<<<<<< + * return self._index + 1 + * else: +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_genesis_done); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 434, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "dopt_pollublock_blockchain/blockchain.pyx":435 + * def __len__(self): + * if self.genesis_done: + * return self._index + 1 # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = (__pyx_v_self->_index + 1); + goto __pyx_L0; + + /* "dopt_pollublock_blockchain/blockchain.pyx":434 + * # // Python public API + * def __len__(self): + * if self.genesis_done: # <<<<<<<<<<<<<< + * return self._index + 1 + * else: +*/ + } + + /* "dopt_pollublock_blockchain/blockchain.pyx":437 + * return self._index + 1 + * else: + * return 0 # <<<<<<<<<<<<<< * * @property */ - __pyx_r = (__pyx_v_self->_index + 1); - goto __pyx_L0; + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } - /* "dopt_pollublock_blockchain/blockchain.pyx":434 + /* "dopt_pollublock_blockchain/blockchain.pyx":433 * * # // Python public API * def __len__(self): # <<<<<<<<<<<<<< - * return self._index + 1 - * + * if self.genesis_done: + * return self._index + 1 */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dopt_pollublock_blockchain.blockchain.Blockchain.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "dopt_pollublock_blockchain/blockchain.pyx":437 - * return self._index + 1 +/* "dopt_pollublock_blockchain/blockchain.pyx":439 + * return 0 * * @property # <<<<<<<<<<<<<< * def difficulty(self): @@ -8504,7 +8551,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "dopt_pollublock_blockchain/blockchain.pyx":439 + /* "dopt_pollublock_blockchain/blockchain.pyx":441 * @property * def difficulty(self): * return self._difficulty # <<<<<<<<<<<<<< @@ -8512,14 +8559,14 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain * @difficulty.setter */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyLong_From_unsigned_int(__pyx_v_self->_difficulty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_unsigned_int(__pyx_v_self->_difficulty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "dopt_pollublock_blockchain/blockchain.pyx":437 - * return self._index + 1 + /* "dopt_pollublock_blockchain/blockchain.pyx":439 + * return 0 * * @property # <<<<<<<<<<<<<< * def difficulty(self): @@ -8537,7 +8584,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain return __pyx_r; } -/* "dopt_pollublock_blockchain/blockchain.pyx":441 +/* "dopt_pollublock_blockchain/blockchain.pyx":443 * return self._difficulty * * @difficulty.setter # <<<<<<<<<<<<<< @@ -8574,7 +8621,7 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_10dif int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - /* "dopt_pollublock_blockchain/blockchain.pyx":443 + /* "dopt_pollublock_blockchain/blockchain.pyx":445 * @difficulty.setter * def difficulty(self, value): * if not isinstance(value, int): # <<<<<<<<<<<<<< @@ -8585,7 +8632,7 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_10dif __pyx_t_2 = (!__pyx_t_1); if (unlikely(__pyx_t_2)) { - /* "dopt_pollublock_blockchain/blockchain.pyx":444 + /* "dopt_pollublock_blockchain/blockchain.pyx":446 * def difficulty(self, value): * if not isinstance(value, int): * raise TypeError("Difficulty must be integer value") # <<<<<<<<<<<<<< @@ -8598,14 +8645,14 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_10dif PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Difficulty_must_be_integer_value}; __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 444, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 446, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 444, __pyx_L1_error) + __PYX_ERR(0, 446, __pyx_L1_error) - /* "dopt_pollublock_blockchain/blockchain.pyx":443 + /* "dopt_pollublock_blockchain/blockchain.pyx":445 * @difficulty.setter * def difficulty(self, value): * if not isinstance(value, int): # <<<<<<<<<<<<<< @@ -8614,19 +8661,19 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_10dif */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":445 + /* "dopt_pollublock_blockchain/blockchain.pyx":447 * if not isinstance(value, int): * raise TypeError("Difficulty must be integer value") * if value <= 0: # <<<<<<<<<<<<<< * raise ValueError("Difficulty must be greater than 0") * self._difficulty = value */ - __pyx_t_3 = PyObject_RichCompare(__pyx_v_value, __pyx_mstate_global->__pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 445, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 445, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_value, __pyx_mstate_global->__pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 447, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 447, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(__pyx_t_2)) { - /* "dopt_pollublock_blockchain/blockchain.pyx":446 + /* "dopt_pollublock_blockchain/blockchain.pyx":448 * raise TypeError("Difficulty must be integer value") * if value <= 0: * raise ValueError("Difficulty must be greater than 0") # <<<<<<<<<<<<<< @@ -8639,14 +8686,14 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_10dif PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Difficulty_must_be_greater_than}; __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 446, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 448, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 446, __pyx_L1_error) + __PYX_ERR(0, 448, __pyx_L1_error) - /* "dopt_pollublock_blockchain/blockchain.pyx":445 + /* "dopt_pollublock_blockchain/blockchain.pyx":447 * if not isinstance(value, int): * raise TypeError("Difficulty must be integer value") * if value <= 0: # <<<<<<<<<<<<<< @@ -8655,17 +8702,17 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_10dif */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":447 + /* "dopt_pollublock_blockchain/blockchain.pyx":449 * if value <= 0: * raise ValueError("Difficulty must be greater than 0") * self._difficulty = value # <<<<<<<<<<<<<< * * @property */ - __pyx_t_6 = __Pyx_PyLong_As_unsigned_int(__pyx_v_value); if (unlikely((__pyx_t_6 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 447, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyLong_As_unsigned_int(__pyx_v_value); if (unlikely((__pyx_t_6 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 449, __pyx_L1_error) __pyx_v_self->_difficulty = __pyx_t_6; - /* "dopt_pollublock_blockchain/blockchain.pyx":441 + /* "dopt_pollublock_blockchain/blockchain.pyx":443 * return self._difficulty * * @difficulty.setter # <<<<<<<<<<<<<< @@ -8686,7 +8733,7 @@ static int __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_10dif return __pyx_r; } -/* "dopt_pollublock_blockchain/blockchain.pyx":449 +/* "dopt_pollublock_blockchain/blockchain.pyx":451 * self._difficulty = value * * @property # <<<<<<<<<<<<<< @@ -8718,7 +8765,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "dopt_pollublock_blockchain/blockchain.pyx":451 + /* "dopt_pollublock_blockchain/blockchain.pyx":453 * @property * def genesis_done(self): * return self._genesis_done # <<<<<<<<<<<<<< @@ -8726,13 +8773,13 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->_genesis_done); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 451, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->_genesis_done); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "dopt_pollublock_blockchain/blockchain.pyx":449 + /* "dopt_pollublock_blockchain/blockchain.pyx":451 * self._difficulty = value * * @property # <<<<<<<<<<<<<< @@ -8751,7 +8798,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain return __pyx_r; } -/* "dopt_pollublock_blockchain/blockchain.pyx":453 +/* "dopt_pollublock_blockchain/blockchain.pyx":455 * return self._genesis_done * * @property # <<<<<<<<<<<<<< @@ -8783,7 +8830,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "dopt_pollublock_blockchain/blockchain.pyx":455 + /* "dopt_pollublock_blockchain/blockchain.pyx":457 * @property * def index(self): * return self._index # <<<<<<<<<<<<<< @@ -8791,13 +8838,13 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain * def _print_key_value_pair(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 455, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 457, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "dopt_pollublock_blockchain/blockchain.pyx":453 + /* "dopt_pollublock_blockchain/blockchain.pyx":455 * return self._genesis_done * * @property # <<<<<<<<<<<<<< @@ -8816,7 +8863,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain return __pyx_r; } -/* "dopt_pollublock_blockchain/blockchain.pyx":457 +/* "dopt_pollublock_blockchain/blockchain.pyx":459 * return self._index * * def _print_key_value_pair(self): # <<<<<<<<<<<<<< @@ -8883,7 +8930,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_print_key_value_pair", 0); - /* "dopt_pollublock_blockchain/blockchain.pyx":458 + /* "dopt_pollublock_blockchain/blockchain.pyx":460 * * def _print_key_value_pair(self): * cdef BcHashmap.iterator it = self._chain_map.begin() # <<<<<<<<<<<<<< @@ -8892,7 +8939,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ __pyx_v_it = __pyx_v_self->_chain_map->begin(); - /* "dopt_pollublock_blockchain/blockchain.pyx":460 + /* "dopt_pollublock_blockchain/blockchain.pyx":462 * cdef BcHashmap.iterator it = self._chain_map.begin() * cdef Block *block * while it != self._chain_map.end(): # <<<<<<<<<<<<<< @@ -8903,7 +8950,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_t_1 = (__pyx_v_it != __pyx_v_self->_chain_map->end()); if (!__pyx_t_1) break; - /* "dopt_pollublock_blockchain/blockchain.pyx":461 + /* "dopt_pollublock_blockchain/blockchain.pyx":463 * cdef Block *block * while it != self._chain_map.end(): * print(dereference(it).first) # <<<<<<<<<<<<<< @@ -8911,7 +8958,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain * py_block = PyBlock.from_ptr(block) */ __pyx_t_3 = NULL; - __pyx_t_4 = __Pyx_PyLong_From_uint64_t((*__pyx_v_it).first); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 461, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyLong_From_uint64_t((*__pyx_v_it).first); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 463, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 1; { @@ -8919,12 +8966,12 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_print, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 461, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 463, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":462 + /* "dopt_pollublock_blockchain/blockchain.pyx":464 * while it != self._chain_map.end(): * print(dereference(it).first) * block = dereference(it).second # <<<<<<<<<<<<<< @@ -8934,19 +8981,19 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_t_6 = (*__pyx_v_it).second; __pyx_v_block = __pyx_t_6; - /* "dopt_pollublock_blockchain/blockchain.pyx":463 + /* "dopt_pollublock_blockchain/blockchain.pyx":465 * print(dereference(it).first) * block = dereference(it).second * py_block = PyBlock.from_ptr(block) # <<<<<<<<<<<<<< * print(py_block) * postincrement(it) */ - __pyx_t_2 = ((PyObject *)__pyx_vtabptr_26dopt_pollublock_blockchain_10blockchain_PyBlock->from_ptr(__pyx_v_block, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 463, __pyx_L1_error) + __pyx_t_2 = ((PyObject *)__pyx_vtabptr_26dopt_pollublock_blockchain_10blockchain_PyBlock->from_ptr(__pyx_v_block, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 465, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_XDECREF_SET(__pyx_v_py_block, ((struct __pyx_obj_26dopt_pollublock_blockchain_10blockchain_PyBlock *)__pyx_t_2)); __pyx_t_2 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":464 + /* "dopt_pollublock_blockchain/blockchain.pyx":466 * block = dereference(it).second * py_block = PyBlock.from_ptr(block) * print(py_block) # <<<<<<<<<<<<<< @@ -8959,12 +9006,12 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain PyObject *__pyx_callargs[2] = {__pyx_t_4, ((PyObject *)__pyx_v_py_block)}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_print, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 464, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 466, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":465 + /* "dopt_pollublock_blockchain/blockchain.pyx":467 * py_block = PyBlock.from_ptr(block) * print(py_block) * postincrement(it) # <<<<<<<<<<<<<< @@ -8974,7 +9021,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain (void)((__pyx_v_it++)); } - /* "dopt_pollublock_blockchain/blockchain.pyx":457 + /* "dopt_pollublock_blockchain/blockchain.pyx":459 * return self._index * * def _print_key_value_pair(self): # <<<<<<<<<<<<<< @@ -8998,7 +9045,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain return __pyx_r; } -/* "dopt_pollublock_blockchain/blockchain.pyx":467 +/* "dopt_pollublock_blockchain/blockchain.pyx":469 * postincrement(it) * * def print_blocks(self, max_num): # <<<<<<<<<<<<<< @@ -9045,32 +9092,32 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_max_num,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 467, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 469, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 467, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 469, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "print_blocks", 0) < (0)) __PYX_ERR(0, 467, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "print_blocks", 0) < (0)) __PYX_ERR(0, 469, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("print_blocks", 1, 1, 1, i); __PYX_ERR(0, 467, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("print_blocks", 1, 1, 1, i); __PYX_ERR(0, 469, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 467, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 469, __pyx_L3_error) } __pyx_v_max_num = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("print_blocks", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 467, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("print_blocks", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 469, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -9111,17 +9158,17 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain int __pyx_clineno = 0; __Pyx_RefNannySetupContext("print_blocks", 0); - /* "dopt_pollublock_blockchain/blockchain.pyx":470 + /* "dopt_pollublock_blockchain/blockchain.pyx":472 * cdef: * Block *block * int max_nummber = max_num # <<<<<<<<<<<<<< * int idx, num = 0 * */ - __pyx_t_1 = __Pyx_PyLong_As_int(__pyx_v_max_num); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_As_int(__pyx_v_max_num); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 472, __pyx_L1_error) __pyx_v_max_nummber = __pyx_t_1; - /* "dopt_pollublock_blockchain/blockchain.pyx":471 + /* "dopt_pollublock_blockchain/blockchain.pyx":473 * Block *block * int max_nummber = max_num * int idx, num = 0 # <<<<<<<<<<<<<< @@ -9130,19 +9177,19 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ __pyx_v_num = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":473 + /* "dopt_pollublock_blockchain/blockchain.pyx":475 * int idx, num = 0 * * if max_num <= 0: # <<<<<<<<<<<<<< * raise ValueError("Maximum number must be greater than 0") * */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_max_num, __pyx_mstate_global->__pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 473, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 473, __pyx_L1_error) + __pyx_t_2 = PyObject_RichCompare(__pyx_v_max_num, __pyx_mstate_global->__pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 475, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 475, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_3)) { - /* "dopt_pollublock_blockchain/blockchain.pyx":474 + /* "dopt_pollublock_blockchain/blockchain.pyx":476 * * if max_num <= 0: * raise ValueError("Maximum number must be greater than 0") # <<<<<<<<<<<<<< @@ -9155,14 +9202,14 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Maximum_number_must_be_greater_t}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 474, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 476, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 474, __pyx_L1_error) + __PYX_ERR(0, 476, __pyx_L1_error) - /* "dopt_pollublock_blockchain/blockchain.pyx":473 + /* "dopt_pollublock_blockchain/blockchain.pyx":475 * int idx, num = 0 * * if max_num <= 0: # <<<<<<<<<<<<<< @@ -9171,7 +9218,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":476 + /* "dopt_pollublock_blockchain/blockchain.pyx":478 * raise ValueError("Maximum number must be greater than 0") * * for idx in range(self._chain[0].size()): # <<<<<<<<<<<<<< @@ -9183,7 +9230,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_7; __pyx_t_1+=1) { __pyx_v_idx = __pyx_t_1; - /* "dopt_pollublock_blockchain/blockchain.pyx":477 + /* "dopt_pollublock_blockchain/blockchain.pyx":479 * * for idx in range(self._chain[0].size()): * block = self._chain[0][idx] # <<<<<<<<<<<<<< @@ -9192,19 +9239,19 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ __pyx_v_block = ((__pyx_v_self->_chain[0])[__pyx_v_idx]); - /* "dopt_pollublock_blockchain/blockchain.pyx":478 + /* "dopt_pollublock_blockchain/blockchain.pyx":480 * for idx in range(self._chain[0].size()): * block = self._chain[0][idx] * py_block = PyBlock.from_ptr(block) # <<<<<<<<<<<<<< * print(py_block) * num += 1 */ - __pyx_t_2 = ((PyObject *)__pyx_vtabptr_26dopt_pollublock_blockchain_10blockchain_PyBlock->from_ptr(__pyx_v_block, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 478, __pyx_L1_error) + __pyx_t_2 = ((PyObject *)__pyx_vtabptr_26dopt_pollublock_blockchain_10blockchain_PyBlock->from_ptr(__pyx_v_block, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_XDECREF_SET(__pyx_v_py_block, ((struct __pyx_obj_26dopt_pollublock_blockchain_10blockchain_PyBlock *)__pyx_t_2)); __pyx_t_2 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":479 + /* "dopt_pollublock_blockchain/blockchain.pyx":481 * block = self._chain[0][idx] * py_block = PyBlock.from_ptr(block) * print(py_block) # <<<<<<<<<<<<<< @@ -9217,12 +9264,12 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain PyObject *__pyx_callargs[2] = {__pyx_t_4, ((PyObject *)__pyx_v_py_block)}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_print, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 479, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 481, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":480 + /* "dopt_pollublock_blockchain/blockchain.pyx":482 * py_block = PyBlock.from_ptr(block) * print(py_block) * num += 1 # <<<<<<<<<<<<<< @@ -9231,7 +9278,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ __pyx_v_num = (__pyx_v_num + 1); - /* "dopt_pollublock_blockchain/blockchain.pyx":481 + /* "dopt_pollublock_blockchain/blockchain.pyx":483 * print(py_block) * num += 1 * if num == max_nummber: # <<<<<<<<<<<<<< @@ -9241,7 +9288,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_t_3 = (__pyx_v_num == __pyx_v_max_nummber); if (__pyx_t_3) { - /* "dopt_pollublock_blockchain/blockchain.pyx":482 + /* "dopt_pollublock_blockchain/blockchain.pyx":484 * num += 1 * if num == max_nummber: * break # <<<<<<<<<<<<<< @@ -9250,7 +9297,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ goto __pyx_L5_break; - /* "dopt_pollublock_blockchain/blockchain.pyx":481 + /* "dopt_pollublock_blockchain/blockchain.pyx":483 * print(py_block) * num += 1 * if num == max_nummber: # <<<<<<<<<<<<<< @@ -9261,7 +9308,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain } __pyx_L5_break:; - /* "dopt_pollublock_blockchain/blockchain.pyx":467 + /* "dopt_pollublock_blockchain/blockchain.pyx":469 * postincrement(it) * * def print_blocks(self, max_num): # <<<<<<<<<<<<<< @@ -9284,7 +9331,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain return __pyx_r; } -/* "dopt_pollublock_blockchain/blockchain.pyx":484 +/* "dopt_pollublock_blockchain/blockchain.pyx":486 * break * * def get_block(self, idx): # <<<<<<<<<<<<<< @@ -9331,32 +9378,32 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_idx,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 484, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 486, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 484, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 486, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_block", 0) < (0)) __PYX_ERR(0, 484, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_block", 0) < (0)) __PYX_ERR(0, 486, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_block", 1, 1, 1, i); __PYX_ERR(0, 484, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_block", 1, 1, 1, i); __PYX_ERR(0, 486, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 484, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 486, __pyx_L3_error) } __pyx_v_idx = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("get_block", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 484, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_block", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 486, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -9394,32 +9441,32 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_block", 0); - /* "dopt_pollublock_blockchain/blockchain.pyx":485 + /* "dopt_pollublock_blockchain/blockchain.pyx":487 * * def get_block(self, idx): * if idx < 0 or idx > self._index: # <<<<<<<<<<<<<< * raise IndexError("Index value is out of bounds") * */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_idx, __pyx_mstate_global->__pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 485, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 485, __pyx_L1_error) + __pyx_t_2 = PyObject_RichCompare(__pyx_v_idx, __pyx_mstate_global->__pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 487, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 487, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!__pyx_t_3) { } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L4_bool_binop_done; } - __pyx_t_2 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 485, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 487, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_idx, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 485, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_v_idx, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 487, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 485, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 487, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_1 = __pyx_t_3; __pyx_L4_bool_binop_done:; if (unlikely(__pyx_t_1)) { - /* "dopt_pollublock_blockchain/blockchain.pyx":486 + /* "dopt_pollublock_blockchain/blockchain.pyx":488 * def get_block(self, idx): * if idx < 0 or idx > self._index: * raise IndexError("Index value is out of bounds") # <<<<<<<<<<<<<< @@ -9432,14 +9479,14 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Index_value_is_out_of_bounds}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_IndexError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 486, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 488, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 486, __pyx_L1_error) + __PYX_ERR(0, 488, __pyx_L1_error) - /* "dopt_pollublock_blockchain/blockchain.pyx":485 + /* "dopt_pollublock_blockchain/blockchain.pyx":487 * * def get_block(self, idx): * if idx < 0 or idx > self._index: # <<<<<<<<<<<<<< @@ -9448,18 +9495,18 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":488 + /* "dopt_pollublock_blockchain/blockchain.pyx":490 * raise IndexError("Index value is out of bounds") * * cdef Block *block = self.get_block_c(idx) # <<<<<<<<<<<<<< * if block is NULL: * raise IndexError("Provided index not found") */ - __pyx_t_6 = __Pyx_PyLong_As_uint64_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 488, __pyx_L1_error) - __pyx_t_7 = ((struct __pyx_vtabstruct_26dopt_pollublock_blockchain_10blockchain_Blockchain *)__pyx_v_self->__pyx_vtab)->get_block_c(__pyx_v_self, __pyx_t_6); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 488, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyLong_As_uint64_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 490, __pyx_L1_error) + __pyx_t_7 = ((struct __pyx_vtabstruct_26dopt_pollublock_blockchain_10blockchain_Blockchain *)__pyx_v_self->__pyx_vtab)->get_block_c(__pyx_v_self, __pyx_t_6); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 490, __pyx_L1_error) __pyx_v_block = __pyx_t_7; - /* "dopt_pollublock_blockchain/blockchain.pyx":489 + /* "dopt_pollublock_blockchain/blockchain.pyx":491 * * cdef Block *block = self.get_block_c(idx) * if block is NULL: # <<<<<<<<<<<<<< @@ -9469,7 +9516,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_t_1 = (__pyx_v_block == NULL); if (unlikely(__pyx_t_1)) { - /* "dopt_pollublock_blockchain/blockchain.pyx":490 + /* "dopt_pollublock_blockchain/blockchain.pyx":492 * cdef Block *block = self.get_block_c(idx) * if block is NULL: * raise IndexError("Provided index not found") # <<<<<<<<<<<<<< @@ -9482,14 +9529,14 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Provided_index_not_found}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_IndexError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 490, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 492, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 490, __pyx_L1_error) + __PYX_ERR(0, 492, __pyx_L1_error) - /* "dopt_pollublock_blockchain/blockchain.pyx":489 + /* "dopt_pollublock_blockchain/blockchain.pyx":491 * * cdef Block *block = self.get_block_c(idx) * if block is NULL: # <<<<<<<<<<<<<< @@ -9498,7 +9545,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":491 + /* "dopt_pollublock_blockchain/blockchain.pyx":493 * if block is NULL: * raise IndexError("Provided index not found") * return PyBlock.from_ptr(block, owner=False) # <<<<<<<<<<<<<< @@ -9508,13 +9555,13 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __Pyx_XDECREF(__pyx_r); __pyx_t_8.__pyx_n = 1; __pyx_t_8.owner = 0; - __pyx_t_4 = ((PyObject *)__pyx_vtabptr_26dopt_pollublock_blockchain_10blockchain_PyBlock->from_ptr(__pyx_v_block, &__pyx_t_8)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 491, __pyx_L1_error) + __pyx_t_4 = ((PyObject *)__pyx_vtabptr_26dopt_pollublock_blockchain_10blockchain_PyBlock->from_ptr(__pyx_v_block, &__pyx_t_8)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 493, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0; - /* "dopt_pollublock_blockchain/blockchain.pyx":484 + /* "dopt_pollublock_blockchain/blockchain.pyx":486 * break * * def get_block(self, idx): # <<<<<<<<<<<<<< @@ -9534,7 +9581,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain return __pyx_r; } -/* "dopt_pollublock_blockchain/blockchain.pyx":493 +/* "dopt_pollublock_blockchain/blockchain.pyx":495 * return PyBlock.from_ptr(block, owner=False) * * def create_genesis_block(self): # <<<<<<<<<<<<<< @@ -9605,7 +9652,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain int __pyx_clineno = 0; __Pyx_RefNannySetupContext("create_genesis_block", 0); - /* "dopt_pollublock_blockchain/blockchain.pyx":494 + /* "dopt_pollublock_blockchain/blockchain.pyx":496 * * def create_genesis_block(self): * if self._genesis_done: # <<<<<<<<<<<<<< @@ -9614,7 +9661,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ if (unlikely(__pyx_v_self->_genesis_done)) { - /* "dopt_pollublock_blockchain/blockchain.pyx":495 + /* "dopt_pollublock_blockchain/blockchain.pyx":497 * def create_genesis_block(self): * if self._genesis_done: * raise RuntimeError( # <<<<<<<<<<<<<< @@ -9627,14 +9674,14 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Blockchain_already_has_a_genesis}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 497, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 495, __pyx_L1_error) + __PYX_ERR(0, 497, __pyx_L1_error) - /* "dopt_pollublock_blockchain/blockchain.pyx":494 + /* "dopt_pollublock_blockchain/blockchain.pyx":496 * * def create_genesis_block(self): * if self._genesis_done: # <<<<<<<<<<<<<< @@ -9643,7 +9690,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":500 + /* "dopt_pollublock_blockchain/blockchain.pyx":502 * ) * * genesis_prev_hash = ("0" * 64).encode("UTF-8") # <<<<<<<<<<<<<< @@ -9653,44 +9700,44 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_b_00000000000000000000000000000000); __pyx_v_genesis_prev_hash = __pyx_mstate_global->__pyx_kp_b_00000000000000000000000000000000; - /* "dopt_pollublock_blockchain/blockchain.pyx":501 + /* "dopt_pollublock_blockchain/blockchain.pyx":503 * * genesis_prev_hash = ("0" * 64).encode("UTF-8") * cdef string data_str = self.hash_data("Genesis Block") # <<<<<<<<<<<<<< * * cdef Block *block = new Block( */ - __pyx_t_4 = ((struct __pyx_vtabstruct_26dopt_pollublock_blockchain_10blockchain_Blockchain *)__pyx_v_self->__pyx_vtab)->hash_data(__pyx_v_self, __pyx_mstate_global->__pyx_kp_u_Genesis_Block); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 501, __pyx_L1_error) + __pyx_t_4 = ((struct __pyx_vtabstruct_26dopt_pollublock_blockchain_10blockchain_Blockchain *)__pyx_v_self->__pyx_vtab)->hash_data(__pyx_v_self, __pyx_mstate_global->__pyx_kp_u_Genesis_Block); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 503, __pyx_L1_error) __pyx_v_data_str = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_4); - /* "dopt_pollublock_blockchain/blockchain.pyx":505 + /* "dopt_pollublock_blockchain/blockchain.pyx":507 * cdef Block *block = new Block( * self._index, * current_timestamp_integer(), # <<<<<<<<<<<<<< * 0, * data_str, */ - __pyx_t_5 = __pyx_f_26dopt_pollublock_blockchain_10blockchain_current_timestamp_integer(); if (unlikely(__pyx_t_5 == ((uint64_t)-1LL) && PyErr_Occurred())) __PYX_ERR(0, 505, __pyx_L1_error) + __pyx_t_5 = __pyx_f_26dopt_pollublock_blockchain_10blockchain_current_timestamp_integer(); if (unlikely(__pyx_t_5 == ((uint64_t)-1LL) && PyErr_Occurred())) __PYX_ERR(0, 507, __pyx_L1_error) - /* "dopt_pollublock_blockchain/blockchain.pyx":508 + /* "dopt_pollublock_blockchain/blockchain.pyx":510 * 0, * data_str, * genesis_prev_hash, # <<<<<<<<<<<<<< * "".encode("UTF-8"), * ) */ - __pyx_t_4 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_v_genesis_prev_hash); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 508, __pyx_L1_error) + __pyx_t_4 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_v_genesis_prev_hash); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 510, __pyx_L1_error) - /* "dopt_pollublock_blockchain/blockchain.pyx":509 + /* "dopt_pollublock_blockchain/blockchain.pyx":511 * data_str, * genesis_prev_hash, * "".encode("UTF-8"), # <<<<<<<<<<<<<< * ) * cdef int res = self.add_block(block) */ - __pyx_t_6 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_mstate_global->__pyx_kp_b_); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 509, __pyx_L1_error) + __pyx_t_6 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_mstate_global->__pyx_kp_b_); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 511, __pyx_L1_error) - /* "dopt_pollublock_blockchain/blockchain.pyx":503 + /* "dopt_pollublock_blockchain/blockchain.pyx":505 * cdef string data_str = self.hash_data("Genesis Block") * * cdef Block *block = new Block( # <<<<<<<<<<<<<< @@ -9701,21 +9748,21 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_t_7 = new ::Block(__pyx_v_self->_index, __pyx_t_5, 0, __pyx_v_data_str, __pyx_t_4, __pyx_t_6); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 503, __pyx_L1_error) + __PYX_ERR(0, 505, __pyx_L1_error) } __pyx_v_block = __pyx_t_7; - /* "dopt_pollublock_blockchain/blockchain.pyx":511 + /* "dopt_pollublock_blockchain/blockchain.pyx":513 * "".encode("UTF-8"), * ) * cdef int res = self.add_block(block) # <<<<<<<<<<<<<< * if res != 0: * raise RuntimeError("Could not mine block. No nonce found") */ - __pyx_t_8 = ((struct __pyx_vtabstruct_26dopt_pollublock_blockchain_10blockchain_Blockchain *)__pyx_v_self->__pyx_vtab)->add_block(__pyx_v_self, __pyx_v_block); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 511, __pyx_L1_error) + __pyx_t_8 = ((struct __pyx_vtabstruct_26dopt_pollublock_blockchain_10blockchain_Blockchain *)__pyx_v_self->__pyx_vtab)->add_block(__pyx_v_self, __pyx_v_block); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 513, __pyx_L1_error) __pyx_v_res = __pyx_t_8; - /* "dopt_pollublock_blockchain/blockchain.pyx":512 + /* "dopt_pollublock_blockchain/blockchain.pyx":514 * ) * cdef int res = self.add_block(block) * if res != 0: # <<<<<<<<<<<<<< @@ -9725,7 +9772,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_t_9 = (__pyx_v_res != 0); if (unlikely(__pyx_t_9)) { - /* "dopt_pollublock_blockchain/blockchain.pyx":513 + /* "dopt_pollublock_blockchain/blockchain.pyx":515 * cdef int res = self.add_block(block) * if res != 0: * raise RuntimeError("Could not mine block. No nonce found") # <<<<<<<<<<<<<< @@ -9738,14 +9785,14 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Could_not_mine_block_No_nonce_fo}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 513, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 513, __pyx_L1_error) + __PYX_ERR(0, 515, __pyx_L1_error) - /* "dopt_pollublock_blockchain/blockchain.pyx":512 + /* "dopt_pollublock_blockchain/blockchain.pyx":514 * ) * cdef int res = self.add_block(block) * if res != 0: # <<<<<<<<<<<<<< @@ -9754,7 +9801,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":514 + /* "dopt_pollublock_blockchain/blockchain.pyx":516 * if res != 0: * raise RuntimeError("Could not mine block. No nonce found") * self._genesis_done = True # <<<<<<<<<<<<<< @@ -9763,7 +9810,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ __pyx_v_self->_genesis_done = 1; - /* "dopt_pollublock_blockchain/blockchain.pyx":493 + /* "dopt_pollublock_blockchain/blockchain.pyx":495 * return PyBlock.from_ptr(block, owner=False) * * def create_genesis_block(self): # <<<<<<<<<<<<<< @@ -9786,7 +9833,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain return __pyx_r; } -/* "dopt_pollublock_blockchain/blockchain.pyx":516 +/* "dopt_pollublock_blockchain/blockchain.pyx":518 * self._genesis_done = True * * def new_block(self, data): # <<<<<<<<<<<<<< @@ -9833,32 +9880,32 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_data,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 516, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 518, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 516, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 518, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "new_block", 0) < (0)) __PYX_ERR(0, 516, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "new_block", 0) < (0)) __PYX_ERR(0, 518, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("new_block", 1, 1, 1, i); __PYX_ERR(0, 516, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("new_block", 1, 1, 1, i); __PYX_ERR(0, 518, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 516, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 518, __pyx_L3_error) } __pyx_v_data = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("new_block", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 516, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("new_block", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 518, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -9902,7 +9949,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain int __pyx_clineno = 0; __Pyx_RefNannySetupContext("new_block", 0); - /* "dopt_pollublock_blockchain/blockchain.pyx":525 + /* "dopt_pollublock_blockchain/blockchain.pyx":527 * size_t digest_size * * if not self._genesis_done: # <<<<<<<<<<<<<< @@ -9912,7 +9959,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_t_1 = (!__pyx_v_self->_genesis_done); if (unlikely(__pyx_t_1)) { - /* "dopt_pollublock_blockchain/blockchain.pyx":526 + /* "dopt_pollublock_blockchain/blockchain.pyx":528 * * if not self._genesis_done: * raise RuntimeError("Create a genesis block first.") # <<<<<<<<<<<<<< @@ -9925,14 +9972,14 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Create_a_genesis_block_first}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 526, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 528, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 526, __pyx_L1_error) + __PYX_ERR(0, 528, __pyx_L1_error) - /* "dopt_pollublock_blockchain/blockchain.pyx":525 + /* "dopt_pollublock_blockchain/blockchain.pyx":527 * size_t digest_size * * if not self._genesis_done: # <<<<<<<<<<<<<< @@ -9941,7 +9988,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":527 + /* "dopt_pollublock_blockchain/blockchain.pyx":529 * if not self._genesis_done: * raise RuntimeError("Create a genesis block first.") * if not isinstance(data, str): # <<<<<<<<<<<<<< @@ -9952,7 +9999,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_t_5 = (!__pyx_t_1); if (unlikely(__pyx_t_5)) { - /* "dopt_pollublock_blockchain/blockchain.pyx":528 + /* "dopt_pollublock_blockchain/blockchain.pyx":530 * raise RuntimeError("Create a genesis block first.") * if not isinstance(data, str): * raise TypeError("Data must be a string") # <<<<<<<<<<<<<< @@ -9965,14 +10012,14 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Data_must_be_a_string}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 528, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 530, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 528, __pyx_L1_error) + __PYX_ERR(0, 530, __pyx_L1_error) - /* "dopt_pollublock_blockchain/blockchain.pyx":527 + /* "dopt_pollublock_blockchain/blockchain.pyx":529 * if not self._genesis_done: * raise RuntimeError("Create a genesis block first.") * if not isinstance(data, str): # <<<<<<<<<<<<<< @@ -9981,27 +10028,27 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":530 + /* "dopt_pollublock_blockchain/blockchain.pyx":532 * raise TypeError("Data must be a string") * * data_str = self.hash_data(data) # <<<<<<<<<<<<<< * prev_block = self.get_block_c(self._index) * prev_hash = prev_block.hash */ - __pyx_t_6 = ((struct __pyx_vtabstruct_26dopt_pollublock_blockchain_10blockchain_Blockchain *)__pyx_v_self->__pyx_vtab)->hash_data(__pyx_v_self, __pyx_v_data); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 530, __pyx_L1_error) + __pyx_t_6 = ((struct __pyx_vtabstruct_26dopt_pollublock_blockchain_10blockchain_Blockchain *)__pyx_v_self->__pyx_vtab)->hash_data(__pyx_v_self, __pyx_v_data); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 532, __pyx_L1_error) __pyx_v_data_str = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_6); - /* "dopt_pollublock_blockchain/blockchain.pyx":531 + /* "dopt_pollublock_blockchain/blockchain.pyx":533 * * data_str = self.hash_data(data) * prev_block = self.get_block_c(self._index) # <<<<<<<<<<<<<< * prev_hash = prev_block.hash * new_idx = self._index + 1 */ - __pyx_t_7 = ((struct __pyx_vtabstruct_26dopt_pollublock_blockchain_10blockchain_Blockchain *)__pyx_v_self->__pyx_vtab)->get_block_c(__pyx_v_self, __pyx_v_self->_index); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 531, __pyx_L1_error) + __pyx_t_7 = ((struct __pyx_vtabstruct_26dopt_pollublock_blockchain_10blockchain_Blockchain *)__pyx_v_self->__pyx_vtab)->get_block_c(__pyx_v_self, __pyx_v_self->_index); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 533, __pyx_L1_error) __pyx_v_prev_block = __pyx_t_7; - /* "dopt_pollublock_blockchain/blockchain.pyx":532 + /* "dopt_pollublock_blockchain/blockchain.pyx":534 * data_str = self.hash_data(data) * prev_block = self.get_block_c(self._index) * prev_hash = prev_block.hash # <<<<<<<<<<<<<< @@ -10011,7 +10058,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_t_6 = __pyx_v_prev_block->hash; __pyx_v_prev_hash = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_6); - /* "dopt_pollublock_blockchain/blockchain.pyx":533 + /* "dopt_pollublock_blockchain/blockchain.pyx":535 * prev_block = self.get_block_c(self._index) * prev_hash = prev_block.hash * new_idx = self._index + 1 # <<<<<<<<<<<<<< @@ -10020,25 +10067,25 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ __pyx_v_new_idx = (__pyx_v_self->_index + 1); - /* "dopt_pollublock_blockchain/blockchain.pyx":537 + /* "dopt_pollublock_blockchain/blockchain.pyx":539 * cdef Block *block = new Block( * new_idx, * current_timestamp_integer(), # <<<<<<<<<<<<<< * 0, * data_str, */ - __pyx_t_8 = __pyx_f_26dopt_pollublock_blockchain_10blockchain_current_timestamp_integer(); if (unlikely(__pyx_t_8 == ((uint64_t)-1LL) && PyErr_Occurred())) __PYX_ERR(0, 537, __pyx_L1_error) + __pyx_t_8 = __pyx_f_26dopt_pollublock_blockchain_10blockchain_current_timestamp_integer(); if (unlikely(__pyx_t_8 == ((uint64_t)-1LL) && PyErr_Occurred())) __PYX_ERR(0, 539, __pyx_L1_error) - /* "dopt_pollublock_blockchain/blockchain.pyx":541 + /* "dopt_pollublock_blockchain/blockchain.pyx":543 * data_str, * prev_hash, * "".encode("UTF-8"), # <<<<<<<<<<<<<< * ) * cdef int res = self.add_block(block) */ - __pyx_t_6 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_mstate_global->__pyx_kp_b_); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 541, __pyx_L1_error) + __pyx_t_6 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_mstate_global->__pyx_kp_b_); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 543, __pyx_L1_error) - /* "dopt_pollublock_blockchain/blockchain.pyx":535 + /* "dopt_pollublock_blockchain/blockchain.pyx":537 * new_idx = self._index + 1 * * cdef Block *block = new Block( # <<<<<<<<<<<<<< @@ -10049,21 +10096,21 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_t_7 = new ::Block(__pyx_v_new_idx, __pyx_t_8, 0, __pyx_v_data_str, __pyx_v_prev_hash, __pyx_t_6); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 535, __pyx_L1_error) + __PYX_ERR(0, 537, __pyx_L1_error) } __pyx_v_block = __pyx_t_7; - /* "dopt_pollublock_blockchain/blockchain.pyx":543 + /* "dopt_pollublock_blockchain/blockchain.pyx":545 * "".encode("UTF-8"), * ) * cdef int res = self.add_block(block) # <<<<<<<<<<<<<< * if res != 0: * raise RuntimeError("Could not mine block. No nonce found") */ - __pyx_t_9 = ((struct __pyx_vtabstruct_26dopt_pollublock_blockchain_10blockchain_Blockchain *)__pyx_v_self->__pyx_vtab)->add_block(__pyx_v_self, __pyx_v_block); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 543, __pyx_L1_error) + __pyx_t_9 = ((struct __pyx_vtabstruct_26dopt_pollublock_blockchain_10blockchain_Blockchain *)__pyx_v_self->__pyx_vtab)->add_block(__pyx_v_self, __pyx_v_block); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 545, __pyx_L1_error) __pyx_v_res = __pyx_t_9; - /* "dopt_pollublock_blockchain/blockchain.pyx":544 + /* "dopt_pollublock_blockchain/blockchain.pyx":546 * ) * cdef int res = self.add_block(block) * if res != 0: # <<<<<<<<<<<<<< @@ -10073,12 +10120,12 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_t_5 = (__pyx_v_res != 0); if (unlikely(__pyx_t_5)) { - /* "dopt_pollublock_blockchain/blockchain.pyx":545 + /* "dopt_pollublock_blockchain/blockchain.pyx":547 * cdef int res = self.add_block(block) * if res != 0: * raise RuntimeError("Could not mine block. No nonce found") # <<<<<<<<<<<<<< * - * def validate(self): + * return self._index */ __pyx_t_3 = NULL; __pyx_t_4 = 1; @@ -10086,14 +10133,14 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Could_not_mine_block_No_nonce_fo}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 545, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 547, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 545, __pyx_L1_error) + __PYX_ERR(0, 547, __pyx_L1_error) - /* "dopt_pollublock_blockchain/blockchain.pyx":544 + /* "dopt_pollublock_blockchain/blockchain.pyx":546 * ) * cdef int res = self.add_block(block) * if res != 0: # <<<<<<<<<<<<<< @@ -10102,7 +10149,21 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":516 + /* "dopt_pollublock_blockchain/blockchain.pyx":549 + * raise RuntimeError("Could not mine block. No nonce found") + * + * return self._index # <<<<<<<<<<<<<< + * + * def validate(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 549, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "dopt_pollublock_blockchain/blockchain.pyx":518 * self._genesis_done = True * * def new_block(self, data): # <<<<<<<<<<<<<< @@ -10111,8 +10172,6 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); @@ -10124,8 +10183,8 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain return __pyx_r; } -/* "dopt_pollublock_blockchain/blockchain.pyx":547 - * raise RuntimeError("Could not mine block. No nonce found") +/* "dopt_pollublock_blockchain/blockchain.pyx":551 + * return self._index * * def validate(self): # <<<<<<<<<<<<<< * cdef: @@ -10200,7 +10259,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain int __pyx_clineno = 0; __Pyx_RefNannySetupContext("validate", 0); - /* "dopt_pollublock_blockchain/blockchain.pyx":550 + /* "dopt_pollublock_blockchain/blockchain.pyx":554 * cdef: * Block *block * Block *prev_block = NULL # <<<<<<<<<<<<<< @@ -10209,7 +10268,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ __pyx_v_prev_block = NULL; - /* "dopt_pollublock_blockchain/blockchain.pyx":551 + /* "dopt_pollublock_blockchain/blockchain.pyx":555 * Block *block * Block *prev_block = NULL * int idx = 0 # <<<<<<<<<<<<<< @@ -10218,7 +10277,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ __pyx_v_idx = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":555 + /* "dopt_pollublock_blockchain/blockchain.pyx":559 * size_t digest_size * * for idx in range(self._chain[0].size()): # <<<<<<<<<<<<<< @@ -10230,7 +10289,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_idx = __pyx_t_3; - /* "dopt_pollublock_blockchain/blockchain.pyx":556 + /* "dopt_pollublock_blockchain/blockchain.pyx":560 * * for idx in range(self._chain[0].size()): * block = self._chain[0][idx] # <<<<<<<<<<<<<< @@ -10239,7 +10298,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ __pyx_v_block = ((__pyx_v_self->_chain[0])[__pyx_v_idx]); - /* "dopt_pollublock_blockchain/blockchain.pyx":557 + /* "dopt_pollublock_blockchain/blockchain.pyx":561 * for idx in range(self._chain[0].size()): * block = self._chain[0][idx] * py_bytes = bytes.fromhex(block.hash.decode("UTF-8")) # <<<<<<<<<<<<<< @@ -10248,7 +10307,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ __pyx_t_5 = ((PyObject *)(&PyBytes_Type)); __Pyx_INCREF(__pyx_t_5); - __pyx_t_6 = __Pyx_decode_cpp_string(__pyx_v_block->hash, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 557, __pyx_L1_error) + __pyx_t_6 = __Pyx_decode_cpp_string(__pyx_v_block->hash, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 561, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = 0; { @@ -10256,23 +10315,23 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_fromhex, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 557, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 561, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_XDECREF_SET(__pyx_v_py_bytes, __pyx_t_4); __pyx_t_4 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":558 + /* "dopt_pollublock_blockchain/blockchain.pyx":562 * block = self._chain[0][idx] * py_bytes = bytes.fromhex(block.hash.decode("UTF-8")) * digest = perform_hash_c(block, &digest_size) # <<<<<<<<<<<<<< * py_bytes_rehashed = bytes(digest[:digest_size]) * free(digest) */ - __pyx_t_8 = __pyx_f_26dopt_pollublock_blockchain_10blockchain_perform_hash_c(__pyx_v_block, (&__pyx_v_digest_size)); if (unlikely(__pyx_t_8 == ((void *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 558, __pyx_L1_error) + __pyx_t_8 = __pyx_f_26dopt_pollublock_blockchain_10blockchain_perform_hash_c(__pyx_v_block, (&__pyx_v_digest_size)); if (unlikely(__pyx_t_8 == ((void *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 562, __pyx_L1_error) __pyx_v_digest = __pyx_t_8; - /* "dopt_pollublock_blockchain/blockchain.pyx":559 + /* "dopt_pollublock_blockchain/blockchain.pyx":563 * py_bytes = bytes.fromhex(block.hash.decode("UTF-8")) * digest = perform_hash_c(block, &digest_size) * py_bytes_rehashed = bytes(digest[:digest_size]) # <<<<<<<<<<<<<< @@ -10280,7 +10339,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain * if py_bytes != py_bytes_rehashed: */ __pyx_t_6 = NULL; - __pyx_t_5 = __Pyx_PyBytes_FromStringAndSize(((char const *)__pyx_v_digest) + 0, __pyx_v_digest_size - 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 559, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyBytes_FromStringAndSize(((char const *)__pyx_v_digest) + 0, __pyx_v_digest_size - 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 563, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = 1; { @@ -10288,13 +10347,13 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(&PyBytes_Type), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 559, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 563, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_XDECREF_SET(__pyx_v_py_bytes_rehashed, ((PyObject*)__pyx_t_4)); __pyx_t_4 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":560 + /* "dopt_pollublock_blockchain/blockchain.pyx":564 * digest = perform_hash_c(block, &digest_size) * py_bytes_rehashed = bytes(digest[:digest_size]) * free(digest) # <<<<<<<<<<<<<< @@ -10303,17 +10362,17 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ free(__pyx_v_digest); - /* "dopt_pollublock_blockchain/blockchain.pyx":561 + /* "dopt_pollublock_blockchain/blockchain.pyx":565 * py_bytes_rehashed = bytes(digest[:digest_size]) * free(digest) * if py_bytes != py_bytes_rehashed: # <<<<<<<<<<<<<< * print(f"Index {idx}: Hashes to not match. Abort.") * return False */ - __pyx_t_9 = (__Pyx_PyBytes_Equals(__pyx_v_py_bytes, __pyx_v_py_bytes_rehashed, Py_NE)); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 561, __pyx_L1_error) + __pyx_t_9 = (__Pyx_PyBytes_Equals(__pyx_v_py_bytes, __pyx_v_py_bytes_rehashed, Py_NE)); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 565, __pyx_L1_error) if (__pyx_t_9) { - /* "dopt_pollublock_blockchain/blockchain.pyx":562 + /* "dopt_pollublock_blockchain/blockchain.pyx":566 * free(digest) * if py_bytes != py_bytes_rehashed: * print(f"Index {idx}: Hashes to not match. Abort.") # <<<<<<<<<<<<<< @@ -10321,13 +10380,13 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain * if prev_block is not NULL: */ __pyx_t_5 = NULL; - __pyx_t_6 = __Pyx_PyUnicode_From_int(__pyx_v_idx, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 562, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyUnicode_From_int(__pyx_v_idx, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 566, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_10[0] = __pyx_mstate_global->__pyx_kp_u_Index; __pyx_t_10[1] = __pyx_t_6; __pyx_t_10[2] = __pyx_mstate_global->__pyx_kp_u_Hashes_to_not_match_Abort; __pyx_t_11 = __Pyx_PyUnicode_Join(__pyx_t_10, 3, 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + 29, 127); - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 562, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 566, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_7 = 1; @@ -10336,12 +10395,12 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_print, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 562, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 566, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":563 + /* "dopt_pollublock_blockchain/blockchain.pyx":567 * if py_bytes != py_bytes_rehashed: * print(f"Index {idx}: Hashes to not match. Abort.") * return False # <<<<<<<<<<<<<< @@ -10353,7 +10412,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_r = Py_False; goto __pyx_L0; - /* "dopt_pollublock_blockchain/blockchain.pyx":561 + /* "dopt_pollublock_blockchain/blockchain.pyx":565 * py_bytes_rehashed = bytes(digest[:digest_size]) * free(digest) * if py_bytes != py_bytes_rehashed: # <<<<<<<<<<<<<< @@ -10362,7 +10421,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":564 + /* "dopt_pollublock_blockchain/blockchain.pyx":568 * print(f"Index {idx}: Hashes to not match. Abort.") * return False * if prev_block is not NULL: # <<<<<<<<<<<<<< @@ -10372,7 +10431,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_t_9 = (__pyx_v_prev_block != NULL); if (__pyx_t_9) { - /* "dopt_pollublock_blockchain/blockchain.pyx":565 + /* "dopt_pollublock_blockchain/blockchain.pyx":569 * return False * if prev_block is not NULL: * if prev_block.hash != block.prev_hash: # <<<<<<<<<<<<<< @@ -10382,7 +10441,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_t_9 = (__pyx_v_prev_block->hash != __pyx_v_block->prev_hash); if (__pyx_t_9) { - /* "dopt_pollublock_blockchain/blockchain.pyx":566 + /* "dopt_pollublock_blockchain/blockchain.pyx":570 * if prev_block is not NULL: * if prev_block.hash != block.prev_hash: * print( # <<<<<<<<<<<<<< @@ -10391,20 +10450,20 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ __pyx_t_11 = NULL; - /* "dopt_pollublock_blockchain/blockchain.pyx":567 + /* "dopt_pollublock_blockchain/blockchain.pyx":571 * if prev_block.hash != block.prev_hash: * print( * (f"Index {idx}: Hash mismatch. Hash of previous block does not " # <<<<<<<<<<<<<< * "match the saved one in the current block. Abort.") * ) */ - __pyx_t_5 = __Pyx_PyUnicode_From_int(__pyx_v_idx, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 567, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyUnicode_From_int(__pyx_v_idx, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 571, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_10[0] = __pyx_mstate_global->__pyx_kp_u_Index; __pyx_t_10[1] = __pyx_t_5; __pyx_t_10[2] = __pyx_mstate_global->__pyx_kp_u_Hash_mismatch_Hash_of_previous; __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_10, 3, 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 97, 127); - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 567, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 571, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = 1; @@ -10413,12 +10472,12 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_print, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 566, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 570, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":570 + /* "dopt_pollublock_blockchain/blockchain.pyx":574 * "match the saved one in the current block. Abort.") * ) * return False # <<<<<<<<<<<<<< @@ -10430,7 +10489,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_r = Py_False; goto __pyx_L0; - /* "dopt_pollublock_blockchain/blockchain.pyx":565 + /* "dopt_pollublock_blockchain/blockchain.pyx":569 * return False * if prev_block is not NULL: * if prev_block.hash != block.prev_hash: # <<<<<<<<<<<<<< @@ -10439,7 +10498,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":564 + /* "dopt_pollublock_blockchain/blockchain.pyx":568 * print(f"Index {idx}: Hashes to not match. Abort.") * return False * if prev_block is not NULL: # <<<<<<<<<<<<<< @@ -10448,7 +10507,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":571 + /* "dopt_pollublock_blockchain/blockchain.pyx":575 * ) * return False * prev_block = block # <<<<<<<<<<<<<< @@ -10458,20 +10517,20 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_v_prev_block = __pyx_v_block; } - /* "dopt_pollublock_blockchain/blockchain.pyx":573 + /* "dopt_pollublock_blockchain/blockchain.pyx":577 * prev_block = block * * return True # <<<<<<<<<<<<<< * - * def get_saving_entries(self, max_idx): + * def get_saving_entries(self, min_idx): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_True); __pyx_r = Py_True; goto __pyx_L0; - /* "dopt_pollublock_blockchain/blockchain.pyx":547 - * raise RuntimeError("Could not mine block. No nonce found") + /* "dopt_pollublock_blockchain/blockchain.pyx":551 + * return self._index * * def validate(self): # <<<<<<<<<<<<<< * cdef: @@ -10494,10 +10553,10 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain return __pyx_r; } -/* "dopt_pollublock_blockchain/blockchain.pyx":575 +/* "dopt_pollublock_blockchain/blockchain.pyx":579 * return True * - * def get_saving_entries(self, max_idx): # <<<<<<<<<<<<<< + * def get_saving_entries(self, min_idx): # <<<<<<<<<<<<<< * entries = [] * cdef: */ @@ -10518,7 +10577,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { - PyObject *__pyx_v_max_idx = 0; + PyObject *__pyx_v_min_idx = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif @@ -10539,34 +10598,34 @@ PyObject *__pyx_args, PyObject *__pyx_kwds #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_max_idx,0}; + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_min_idx,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 575, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 579, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 575, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 579, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_saving_entries", 0) < (0)) __PYX_ERR(0, 575, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_saving_entries", 0) < (0)) __PYX_ERR(0, 579, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_saving_entries", 1, 1, 1, i); __PYX_ERR(0, 575, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_saving_entries", 1, 1, 1, i); __PYX_ERR(0, 579, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 575, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 579, __pyx_L3_error) } - __pyx_v_max_idx = values[0]; + __pyx_v_min_idx = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("get_saving_entries", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 575, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_saving_entries", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 579, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -10577,7 +10636,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_20get_saving_entries(((struct __pyx_obj_26dopt_pollublock_blockchain_10blockchain_Blockchain *)__pyx_v_self), __pyx_v_max_idx); + __pyx_r = __pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_20get_saving_entries(((struct __pyx_obj_26dopt_pollublock_blockchain_10blockchain_Blockchain *)__pyx_v_self), __pyx_v_min_idx); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { @@ -10587,11 +10646,11 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_20get_saving_entries(struct __pyx_obj_26dopt_pollublock_blockchain_10blockchain_Blockchain *__pyx_v_self, PyObject *__pyx_v_max_idx) { +static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain_20get_saving_entries(struct __pyx_obj_26dopt_pollublock_blockchain_10blockchain_Blockchain *__pyx_v_self, PyObject *__pyx_v_min_idx) { PyObject *__pyx_v_entries = NULL; ::Block *__pyx_v_block; int __pyx_v_idx; - int __pyx_v__max_idx; + int __pyx_v__min_idx; PyObject *__pyx_v_contents = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -10606,74 +10665,74 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_saving_entries", 0); - /* "dopt_pollublock_blockchain/blockchain.pyx":576 + /* "dopt_pollublock_blockchain/blockchain.pyx":580 * - * def get_saving_entries(self, max_idx): + * def get_saving_entries(self, min_idx): * entries = [] # <<<<<<<<<<<<<< * cdef: * Block *block */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 576, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 580, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_entries = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":579 + /* "dopt_pollublock_blockchain/blockchain.pyx":583 * cdef: * Block *block * int idx = 0 # <<<<<<<<<<<<<< - * int _max_idx + * int _min_idx * */ __pyx_v_idx = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":582 - * int _max_idx + /* "dopt_pollublock_blockchain/blockchain.pyx":586 + * int _min_idx * - * if max_idx is None: # <<<<<<<<<<<<<< - * _max_idx = -1 + * if min_idx is None: # <<<<<<<<<<<<<< + * _min_idx = -1 * else: */ - __pyx_t_2 = (__pyx_v_max_idx == Py_None); + __pyx_t_2 = (__pyx_v_min_idx == Py_None); if (__pyx_t_2) { - /* "dopt_pollublock_blockchain/blockchain.pyx":583 + /* "dopt_pollublock_blockchain/blockchain.pyx":587 * - * if max_idx is None: - * _max_idx = -1 # <<<<<<<<<<<<<< + * if min_idx is None: + * _min_idx = -1 # <<<<<<<<<<<<<< * else: - * _max_idx = max_idx + * _min_idx = min_idx */ - __pyx_v__max_idx = -1; + __pyx_v__min_idx = -1; - /* "dopt_pollublock_blockchain/blockchain.pyx":582 - * int _max_idx + /* "dopt_pollublock_blockchain/blockchain.pyx":586 + * int _min_idx * - * if max_idx is None: # <<<<<<<<<<<<<< - * _max_idx = -1 + * if min_idx is None: # <<<<<<<<<<<<<< + * _min_idx = -1 * else: */ goto __pyx_L3; } - /* "dopt_pollublock_blockchain/blockchain.pyx":585 - * _max_idx = -1 + /* "dopt_pollublock_blockchain/blockchain.pyx":589 + * _min_idx = -1 * else: - * _max_idx = max_idx # <<<<<<<<<<<<<< + * _min_idx = min_idx # <<<<<<<<<<<<<< * * for idx in range(self._chain[0].size()): */ /*else*/ { - __pyx_t_3 = __Pyx_PyLong_As_int(__pyx_v_max_idx); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 585, __pyx_L1_error) - __pyx_v__max_idx = __pyx_t_3; + __pyx_t_3 = __Pyx_PyLong_As_int(__pyx_v_min_idx); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 589, __pyx_L1_error) + __pyx_v__min_idx = __pyx_t_3; } __pyx_L3:; - /* "dopt_pollublock_blockchain/blockchain.pyx":587 - * _max_idx = max_idx + /* "dopt_pollublock_blockchain/blockchain.pyx":591 + * _min_idx = min_idx * * for idx in range(self._chain[0].size()): # <<<<<<<<<<<<<< - * if idx <= _max_idx: + * if idx <= _min_idx: * continue */ __pyx_t_4 = (__pyx_v_self->_chain[0]).size(); @@ -10681,36 +10740,36 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_5; __pyx_t_3+=1) { __pyx_v_idx = __pyx_t_3; - /* "dopt_pollublock_blockchain/blockchain.pyx":588 + /* "dopt_pollublock_blockchain/blockchain.pyx":592 * * for idx in range(self._chain[0].size()): - * if idx <= _max_idx: # <<<<<<<<<<<<<< + * if idx <= _min_idx: # <<<<<<<<<<<<<< * continue * block = self._chain[0][idx] */ - __pyx_t_2 = (__pyx_v_idx <= __pyx_v__max_idx); + __pyx_t_2 = (__pyx_v_idx <= __pyx_v__min_idx); if (__pyx_t_2) { - /* "dopt_pollublock_blockchain/blockchain.pyx":589 + /* "dopt_pollublock_blockchain/blockchain.pyx":593 * for idx in range(self._chain[0].size()): - * if idx <= _max_idx: + * if idx <= _min_idx: * continue # <<<<<<<<<<<<<< * block = self._chain[0][idx] * contents = {} */ goto __pyx_L4_continue; - /* "dopt_pollublock_blockchain/blockchain.pyx":588 + /* "dopt_pollublock_blockchain/blockchain.pyx":592 * * for idx in range(self._chain[0].size()): - * if idx <= _max_idx: # <<<<<<<<<<<<<< + * if idx <= _min_idx: # <<<<<<<<<<<<<< * continue * block = self._chain[0][idx] */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":590 - * if idx <= _max_idx: + /* "dopt_pollublock_blockchain/blockchain.pyx":594 + * if idx <= _min_idx: * continue * block = self._chain[0][idx] # <<<<<<<<<<<<<< * contents = {} @@ -10718,102 +10777,102 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ __pyx_v_block = ((__pyx_v_self->_chain[0])[__pyx_v_idx]); - /* "dopt_pollublock_blockchain/blockchain.pyx":591 + /* "dopt_pollublock_blockchain/blockchain.pyx":595 * continue * block = self._chain[0][idx] * contents = {} # <<<<<<<<<<<<<< * contents["index"] = block.index * contents["timestamp"] = block.timestamp */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 591, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 595, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_v_contents, ((PyObject*)__pyx_t_1)); __pyx_t_1 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":592 + /* "dopt_pollublock_blockchain/blockchain.pyx":596 * block = self._chain[0][idx] * contents = {} * contents["index"] = block.index # <<<<<<<<<<<<<< * contents["timestamp"] = block.timestamp * contents["nonce"] = block.nonce */ - __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_block->index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 592, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_block->index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 596, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely((PyDict_SetItem(__pyx_v_contents, __pyx_mstate_global->__pyx_n_u_index, __pyx_t_1) < 0))) __PYX_ERR(0, 592, __pyx_L1_error) + if (unlikely((PyDict_SetItem(__pyx_v_contents, __pyx_mstate_global->__pyx_n_u_index, __pyx_t_1) < 0))) __PYX_ERR(0, 596, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":593 + /* "dopt_pollublock_blockchain/blockchain.pyx":597 * contents = {} * contents["index"] = block.index * contents["timestamp"] = block.timestamp # <<<<<<<<<<<<<< * contents["nonce"] = block.nonce * contents["previous_hash"] = block.prev_hash.decode("UTF-8") */ - __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_block->timestamp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 593, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_block->timestamp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 597, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely((PyDict_SetItem(__pyx_v_contents, __pyx_mstate_global->__pyx_n_u_timestamp, __pyx_t_1) < 0))) __PYX_ERR(0, 593, __pyx_L1_error) + if (unlikely((PyDict_SetItem(__pyx_v_contents, __pyx_mstate_global->__pyx_n_u_timestamp, __pyx_t_1) < 0))) __PYX_ERR(0, 597, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":594 + /* "dopt_pollublock_blockchain/blockchain.pyx":598 * contents["index"] = block.index * contents["timestamp"] = block.timestamp * contents["nonce"] = block.nonce # <<<<<<<<<<<<<< * contents["previous_hash"] = block.prev_hash.decode("UTF-8") * contents["hash"] = block.hash.decode("UTF-8") */ - __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_block->nonce); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 594, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_block->nonce); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 598, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely((PyDict_SetItem(__pyx_v_contents, __pyx_mstate_global->__pyx_n_u_nonce, __pyx_t_1) < 0))) __PYX_ERR(0, 594, __pyx_L1_error) + if (unlikely((PyDict_SetItem(__pyx_v_contents, __pyx_mstate_global->__pyx_n_u_nonce, __pyx_t_1) < 0))) __PYX_ERR(0, 598, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":595 + /* "dopt_pollublock_blockchain/blockchain.pyx":599 * contents["timestamp"] = block.timestamp * contents["nonce"] = block.nonce * contents["previous_hash"] = block.prev_hash.decode("UTF-8") # <<<<<<<<<<<<<< * contents["hash"] = block.hash.decode("UTF-8") * contents["data"] = block.data.decode("UTF-8") */ - __pyx_t_1 = __Pyx_decode_cpp_string(__pyx_v_block->prev_hash, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 595, __pyx_L1_error) + __pyx_t_1 = __Pyx_decode_cpp_string(__pyx_v_block->prev_hash, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 599, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely((PyDict_SetItem(__pyx_v_contents, __pyx_mstate_global->__pyx_n_u_previous_hash, __pyx_t_1) < 0))) __PYX_ERR(0, 595, __pyx_L1_error) + if (unlikely((PyDict_SetItem(__pyx_v_contents, __pyx_mstate_global->__pyx_n_u_previous_hash, __pyx_t_1) < 0))) __PYX_ERR(0, 599, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":596 + /* "dopt_pollublock_blockchain/blockchain.pyx":600 * contents["nonce"] = block.nonce * contents["previous_hash"] = block.prev_hash.decode("UTF-8") * contents["hash"] = block.hash.decode("UTF-8") # <<<<<<<<<<<<<< * contents["data"] = block.data.decode("UTF-8") * entries.append(contents) */ - __pyx_t_1 = __Pyx_decode_cpp_string(__pyx_v_block->hash, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 596, __pyx_L1_error) + __pyx_t_1 = __Pyx_decode_cpp_string(__pyx_v_block->hash, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 600, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely((PyDict_SetItem(__pyx_v_contents, __pyx_mstate_global->__pyx_n_u_hash, __pyx_t_1) < 0))) __PYX_ERR(0, 596, __pyx_L1_error) + if (unlikely((PyDict_SetItem(__pyx_v_contents, __pyx_mstate_global->__pyx_n_u_hash, __pyx_t_1) < 0))) __PYX_ERR(0, 600, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":597 + /* "dopt_pollublock_blockchain/blockchain.pyx":601 * contents["previous_hash"] = block.prev_hash.decode("UTF-8") * contents["hash"] = block.hash.decode("UTF-8") * contents["data"] = block.data.decode("UTF-8") # <<<<<<<<<<<<<< * entries.append(contents) * */ - __pyx_t_1 = __Pyx_decode_cpp_string(__pyx_v_block->data, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 597, __pyx_L1_error) + __pyx_t_1 = __Pyx_decode_cpp_string(__pyx_v_block->data, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 601, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely((PyDict_SetItem(__pyx_v_contents, __pyx_mstate_global->__pyx_n_u_data, __pyx_t_1) < 0))) __PYX_ERR(0, 597, __pyx_L1_error) + if (unlikely((PyDict_SetItem(__pyx_v_contents, __pyx_mstate_global->__pyx_n_u_data, __pyx_t_1) < 0))) __PYX_ERR(0, 601, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":598 + /* "dopt_pollublock_blockchain/blockchain.pyx":602 * contents["hash"] = block.hash.decode("UTF-8") * contents["data"] = block.data.decode("UTF-8") * entries.append(contents) # <<<<<<<<<<<<<< * * return entries */ - __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_entries, __pyx_v_contents); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 598, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_entries, __pyx_v_contents); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 602, __pyx_L1_error) __pyx_L4_continue:; } - /* "dopt_pollublock_blockchain/blockchain.pyx":600 + /* "dopt_pollublock_blockchain/blockchain.pyx":604 * entries.append(contents) * * return entries # <<<<<<<<<<<<<< @@ -10825,10 +10884,10 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_r = __pyx_v_entries; goto __pyx_L0; - /* "dopt_pollublock_blockchain/blockchain.pyx":575 + /* "dopt_pollublock_blockchain/blockchain.pyx":579 * return True * - * def get_saving_entries(self, max_idx): # <<<<<<<<<<<<<< + * def get_saving_entries(self, min_idx): # <<<<<<<<<<<<<< * entries = [] * cdef: */ @@ -10846,7 +10905,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain return __pyx_r; } -/* "dopt_pollublock_blockchain/blockchain.pyx":602 +/* "dopt_pollublock_blockchain/blockchain.pyx":606 * return entries * * def save(self): # <<<<<<<<<<<<<< @@ -10926,7 +10985,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain int __pyx_clineno = 0; __Pyx_RefNannySetupContext("save", 0); - /* "dopt_pollublock_blockchain/blockchain.pyx":605 + /* "dopt_pollublock_blockchain/blockchain.pyx":609 * # get max index from db * # only retrieve indices greater than max value * stmt = sql.select(sql.func.max(db.blocks.c.index)) # <<<<<<<<<<<<<< @@ -10934,27 +10993,27 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain * result = conn.execute(stmt) */ __pyx_t_2 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_sql); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 605, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_sql); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 609, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_select); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 605, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_select); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 609, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_sql); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 605, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_sql); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 609, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_func); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 605, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_func); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 609, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_5 = __pyx_t_7; __Pyx_INCREF(__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_db); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 605, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_db); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 609, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_blocks); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 605, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_blocks); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 609, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_c); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 605, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_c); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 609, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 605, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 609, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_9 = 0; @@ -10964,7 +11023,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 605, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 609, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_t_9 = 1; @@ -10985,13 +11044,13 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 605, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 609, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_stmt = __pyx_t_1; __pyx_t_1 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":606 + /* "dopt_pollublock_blockchain/blockchain.pyx":610 * # only retrieve indices greater than max value * stmt = sql.select(sql.func.max(db.blocks.c.index)) * with self._engine.connect() as conn: # <<<<<<<<<<<<<< @@ -11006,13 +11065,13 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_connect, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 606, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 610, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } - __pyx_t_10 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 606, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 610, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_3 = NULL; - __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 606, __pyx_L3_error) + __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 610, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_9 = 1; #if CYTHON_UNPACK_METHODS @@ -11031,7 +11090,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 606, __pyx_L3_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 610, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); } __pyx_t_2 = __pyx_t_4; @@ -11049,7 +11108,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_v_conn = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":607 + /* "dopt_pollublock_blockchain/blockchain.pyx":611 * stmt = sql.select(sql.func.max(db.blocks.c.index)) * with self._engine.connect() as conn: * result = conn.execute(stmt) # <<<<<<<<<<<<<< @@ -11063,13 +11122,13 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_stmt}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_execute, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 607, __pyx_L7_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 611, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_result = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":608 + /* "dopt_pollublock_blockchain/blockchain.pyx":612 * with self._engine.connect() as conn: * result = conn.execute(stmt) * max_value = result.scalar() # <<<<<<<<<<<<<< @@ -11083,13 +11142,13 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_scalar, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 608, __pyx_L7_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 612, __pyx_L7_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_max_value = __pyx_t_2; __pyx_t_2 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":606 + /* "dopt_pollublock_blockchain/blockchain.pyx":610 * # only retrieve indices greater than max value * stmt = sql.select(sql.func.max(db.blocks.c.index)) * with self._engine.connect() as conn: # <<<<<<<<<<<<<< @@ -11112,20 +11171,20 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; /*except:*/ { __Pyx_AddTraceback("dopt_pollublock_blockchain.blockchain.Blockchain.save", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_4) < 0) __PYX_ERR(0, 606, __pyx_L9_except_error) + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_4) < 0) __PYX_ERR(0, 610, __pyx_L9_except_error) __Pyx_XGOTREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_t_4); - __pyx_t_3 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 606, __pyx_L9_except_error) + __pyx_t_3 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 610, __pyx_L9_except_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_3, NULL); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 606, __pyx_L9_except_error) + if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 610, __pyx_L9_except_error) __Pyx_GOTREF(__pyx_t_14); __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_14); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (__pyx_t_15 < (0)) __PYX_ERR(0, 606, __pyx_L9_except_error) + if (__pyx_t_15 < (0)) __PYX_ERR(0, 610, __pyx_L9_except_error) __pyx_t_16 = (!__pyx_t_15); if (unlikely(__pyx_t_16)) { __Pyx_GIVEREF(__pyx_t_2); @@ -11133,7 +11192,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __Pyx_XGIVEREF(__pyx_t_4); __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_1, __pyx_t_4); __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_4 = 0; - __PYX_ERR(0, 606, __pyx_L9_except_error) + __PYX_ERR(0, 610, __pyx_L9_except_error) } __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -11159,7 +11218,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain if (__pyx_t_10) { __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_mstate_global->__pyx_tuple[0], NULL); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 606, __pyx_L1_error) + if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 610, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; } @@ -11174,7 +11233,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_L16:; } - /* "dopt_pollublock_blockchain/blockchain.pyx":610 + /* "dopt_pollublock_blockchain/blockchain.pyx":614 * max_value = result.scalar() * * entries = self.get_saving_entries(max_value) # <<<<<<<<<<<<<< @@ -11183,30 +11242,30 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ __pyx_t_1 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_1); - if (unlikely(!__pyx_v_max_value)) { __Pyx_RaiseUnboundLocalError("max_value"); __PYX_ERR(0, 610, __pyx_L1_error) } + if (unlikely(!__pyx_v_max_value)) { __Pyx_RaiseUnboundLocalError("max_value"); __PYX_ERR(0, 614, __pyx_L1_error) } __pyx_t_9 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_max_value}; __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_saving_entries, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 610, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 614, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __pyx_v_entries = __pyx_t_4; __pyx_t_4 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":611 + /* "dopt_pollublock_blockchain/blockchain.pyx":615 * * entries = self.get_saving_entries(max_value) * if not entries: # <<<<<<<<<<<<<< * return * */ - __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_v_entries); if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(0, 611, __pyx_L1_error) + __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_v_entries); if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(0, 615, __pyx_L1_error) __pyx_t_15 = (!__pyx_t_16); if (__pyx_t_15) { - /* "dopt_pollublock_blockchain/blockchain.pyx":612 + /* "dopt_pollublock_blockchain/blockchain.pyx":616 * entries = self.get_saving_entries(max_value) * if not entries: * return # <<<<<<<<<<<<<< @@ -11217,7 +11276,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "dopt_pollublock_blockchain/blockchain.pyx":611 + /* "dopt_pollublock_blockchain/blockchain.pyx":615 * * entries = self.get_saving_entries(max_value) * if not entries: # <<<<<<<<<<<<<< @@ -11226,7 +11285,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":614 + /* "dopt_pollublock_blockchain/blockchain.pyx":618 * return * * with self._engine.begin() as con: # <<<<<<<<<<<<<< @@ -11241,13 +11300,13 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL}; __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_begin, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 614, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 618, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } - __pyx_t_10 = __Pyx_PyObject_LookupSpecial(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 614, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_LookupSpecial(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 618, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_2 = NULL; - __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 614, __pyx_L18_error) + __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 618, __pyx_L18_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_9 = 1; #if CYTHON_UNPACK_METHODS @@ -11266,7 +11325,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 614, __pyx_L18_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 618, __pyx_L18_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_3 = __pyx_t_1; @@ -11284,7 +11343,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_v_con = __pyx_t_3; __pyx_t_3 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":615 + /* "dopt_pollublock_blockchain/blockchain.pyx":619 * * with self._engine.begin() as con: * con.execute(sql.insert(db.blocks), entries) # <<<<<<<<<<<<<< @@ -11294,14 +11353,14 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_t_4 = __pyx_v_con; __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_sql); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 615, __pyx_L22_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_sql); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 619, __pyx_L22_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_insert); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 615, __pyx_L22_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_insert); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 619, __pyx_L22_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_db); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 615, __pyx_L22_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_db); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 619, __pyx_L22_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_blocks); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 615, __pyx_L22_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_blocks); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 619, __pyx_L22_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_9 = 1; @@ -11322,7 +11381,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 615, __pyx_L22_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 619, __pyx_L22_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_9 = 0; @@ -11331,12 +11390,12 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_execute, __pyx_callargs+__pyx_t_9, (3-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 615, __pyx_L22_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 619, __pyx_L22_error) __Pyx_GOTREF(__pyx_t_3); } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":614 + /* "dopt_pollublock_blockchain/blockchain.pyx":618 * return * * with self._engine.begin() as con: # <<<<<<<<<<<<<< @@ -11359,20 +11418,20 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; /*except:*/ { __Pyx_AddTraceback("dopt_pollublock_blockchain.blockchain.Blockchain.save", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_4) < 0) __PYX_ERR(0, 614, __pyx_L24_except_error) + if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_4) < 0) __PYX_ERR(0, 618, __pyx_L24_except_error) __Pyx_XGOTREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_t_4); - __pyx_t_8 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 614, __pyx_L24_except_error) + __pyx_t_8 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 618, __pyx_L24_except_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_8, NULL); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 614, __pyx_L24_except_error) + if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 618, __pyx_L24_except_error) __Pyx_GOTREF(__pyx_t_14); __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_14); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (__pyx_t_15 < (0)) __PYX_ERR(0, 614, __pyx_L24_except_error) + if (__pyx_t_15 < (0)) __PYX_ERR(0, 618, __pyx_L24_except_error) __pyx_t_16 = (!__pyx_t_15); if (unlikely(__pyx_t_16)) { __Pyx_GIVEREF(__pyx_t_3); @@ -11380,7 +11439,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __Pyx_XGIVEREF(__pyx_t_4); __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_1, __pyx_t_4); __pyx_t_3 = 0; __pyx_t_1 = 0; __pyx_t_4 = 0; - __PYX_ERR(0, 614, __pyx_L24_except_error) + __PYX_ERR(0, 618, __pyx_L24_except_error) } __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -11406,7 +11465,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain if (__pyx_t_10) { __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_mstate_global->__pyx_tuple[0], NULL); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 614, __pyx_L1_error) + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 618, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; } @@ -11421,7 +11480,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_L31:; } - /* "dopt_pollublock_blockchain/blockchain.pyx":602 + /* "dopt_pollublock_blockchain/blockchain.pyx":606 * return entries * * def save(self): # <<<<<<<<<<<<<< @@ -11455,7 +11514,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain return __pyx_r; } -/* "dopt_pollublock_blockchain/blockchain.pyx":617 +/* "dopt_pollublock_blockchain/blockchain.pyx":621 * con.execute(sql.insert(db.blocks), entries) * * def close_db_connections(self): # <<<<<<<<<<<<<< @@ -11516,7 +11575,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain int __pyx_clineno = 0; __Pyx_RefNannySetupContext("close_db_connections", 0); - /* "dopt_pollublock_blockchain/blockchain.pyx":618 + /* "dopt_pollublock_blockchain/blockchain.pyx":622 * * def close_db_connections(self): * self._engine.dispose() # <<<<<<<<<<<<<< @@ -11530,12 +11589,12 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_dispose, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 618, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 622, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":617 + /* "dopt_pollublock_blockchain/blockchain.pyx":621 * con.execute(sql.insert(db.blocks), entries) * * def close_db_connections(self): # <<<<<<<<<<<<<< @@ -11557,7 +11616,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain return __pyx_r; } -/* "dopt_pollublock_blockchain/blockchain.pyx":620 +/* "dopt_pollublock_blockchain/blockchain.pyx":624 * self._engine.dispose() * * def load(self, batch_size): # <<<<<<<<<<<<<< @@ -11604,32 +11663,32 @@ PyObject *__pyx_args, PyObject *__pyx_kwds { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_batch_size,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; - if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 620, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 624, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 620, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 624, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "load", 0) < (0)) __PYX_ERR(0, 620, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "load", 0) < (0)) __PYX_ERR(0, 624, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("load", 1, 1, 1, i); __PYX_ERR(0, 620, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("load", 1, 1, 1, i); __PYX_ERR(0, 624, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 620, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 624, __pyx_L3_error) } __pyx_v_batch_size = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("load", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 620, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("load", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 624, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -11680,7 +11739,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain int __pyx_clineno = 0; __Pyx_RefNannySetupContext("load", 0); - /* "dopt_pollublock_blockchain/blockchain.pyx":621 + /* "dopt_pollublock_blockchain/blockchain.pyx":625 * * def load(self, batch_size): * if self._loaded: # <<<<<<<<<<<<<< @@ -11689,7 +11748,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ if (unlikely(__pyx_v_self->_loaded)) { - /* "dopt_pollublock_blockchain/blockchain.pyx":622 + /* "dopt_pollublock_blockchain/blockchain.pyx":626 * def load(self, batch_size): * if self._loaded: * raise RuntimeError("Blockchain was already loaded") # <<<<<<<<<<<<<< @@ -11702,14 +11761,14 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Blockchain_was_already_loaded}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 622, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 626, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 622, __pyx_L1_error) + __PYX_ERR(0, 626, __pyx_L1_error) - /* "dopt_pollublock_blockchain/blockchain.pyx":621 + /* "dopt_pollublock_blockchain/blockchain.pyx":625 * * def load(self, batch_size): * if self._loaded: # <<<<<<<<<<<<<< @@ -11718,7 +11777,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain */ } - /* "dopt_pollublock_blockchain/blockchain.pyx":624 + /* "dopt_pollublock_blockchain/blockchain.pyx":628 * raise RuntimeError("Blockchain was already loaded") * * with self._engine.connect() as con: # <<<<<<<<<<<<<< @@ -11733,13 +11792,13 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_connect, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 628, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } - __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 624, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 628, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; - __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 624, __pyx_L4_error) + __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 628, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_3 = 1; #if CYTHON_UNPACK_METHODS @@ -11758,7 +11817,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 624, __pyx_L4_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 628, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = __pyx_t_2; @@ -11776,7 +11835,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_v_con = __pyx_t_6; __pyx_t_6 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":625 + /* "dopt_pollublock_blockchain/blockchain.pyx":629 * * with self._engine.connect() as con: * res = con.execute(sql.select(db.blocks).order_by(db.blocks.c.index.asc())) # <<<<<<<<<<<<<< @@ -11786,14 +11845,14 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_t_1 = __pyx_v_con; __Pyx_INCREF(__pyx_t_1); __pyx_t_11 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_sql); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 625, __pyx_L8_error) + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_sql); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 629, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_12); - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_select); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 625, __pyx_L8_error) + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_select); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 629, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_db); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 625, __pyx_L8_error) + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_db); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 629, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_12); - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_blocks); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 625, __pyx_L8_error) + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_blocks); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 629, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_3 = 1; @@ -11814,20 +11873,20 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 625, __pyx_L8_error) + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 629, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_10); } __pyx_t_5 = __pyx_t_10; __Pyx_INCREF(__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_db); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 625, __pyx_L8_error) + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_db); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 629, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_blocks); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 625, __pyx_L8_error) + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_blocks); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 629, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_c); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 625, __pyx_L8_error) + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_c); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 629, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 625, __pyx_L8_error) + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 629, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_14 = __pyx_t_12; @@ -11838,7 +11897,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_t_13 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_asc, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 625, __pyx_L8_error) + if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 629, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_13); } __pyx_t_3 = 0; @@ -11848,7 +11907,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 625, __pyx_L8_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 629, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_3 = 0; @@ -11857,13 +11916,13 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_execute, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 625, __pyx_L8_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 629, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_6); } __pyx_v_res = __pyx_t_6; __pyx_t_6 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":624 + /* "dopt_pollublock_blockchain/blockchain.pyx":628 * raise RuntimeError("Blockchain was already loaded") * * with self._engine.connect() as con: # <<<<<<<<<<<<<< @@ -11887,20 +11946,20 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; /*except:*/ { __Pyx_AddTraceback("dopt_pollublock_blockchain.blockchain.Blockchain.load", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 624, __pyx_L10_except_error) + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 628, __pyx_L10_except_error) __Pyx_XGOTREF(__pyx_t_6); __Pyx_XGOTREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_t_1); - __pyx_t_10 = PyTuple_Pack(3, __pyx_t_6, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 624, __pyx_L10_except_error) + __pyx_t_10 = PyTuple_Pack(3, __pyx_t_6, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 628, __pyx_L10_except_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 624, __pyx_L10_except_error) + if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 628, __pyx_L10_except_error) __Pyx_GOTREF(__pyx_t_15); __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_15); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - if (__pyx_t_16 < (0)) __PYX_ERR(0, 624, __pyx_L10_except_error) + if (__pyx_t_16 < (0)) __PYX_ERR(0, 628, __pyx_L10_except_error) __pyx_t_17 = (!__pyx_t_16); if (unlikely(__pyx_t_17)) { __Pyx_GIVEREF(__pyx_t_6); @@ -11908,7 +11967,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __Pyx_XGIVEREF(__pyx_t_1); __Pyx_ErrRestoreWithState(__pyx_t_6, __pyx_t_2, __pyx_t_1); __pyx_t_6 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; - __PYX_ERR(0, 624, __pyx_L10_except_error) + __PYX_ERR(0, 628, __pyx_L10_except_error) } __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -11934,7 +11993,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain if (__pyx_t_4) { __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[0], NULL); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 624, __pyx_L1_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 628, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } @@ -11949,14 +12008,14 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_L17:; } - /* "dopt_pollublock_blockchain/blockchain.pyx":627 + /* "dopt_pollublock_blockchain/blockchain.pyx":631 * res = con.execute(sql.select(db.blocks).order_by(db.blocks.c.index.asc())) * * for batch in res.partitions(batch_size): # <<<<<<<<<<<<<< * self.load_from_batch(batch) * */ - if (unlikely(!__pyx_v_res)) { __Pyx_RaiseUnboundLocalError("res"); __PYX_ERR(0, 627, __pyx_L1_error) } + if (unlikely(!__pyx_v_res)) { __Pyx_RaiseUnboundLocalError("res"); __PYX_ERR(0, 631, __pyx_L1_error) } __pyx_t_2 = __pyx_v_res; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; @@ -11964,7 +12023,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_batch_size}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_partitions, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 627, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 631, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { @@ -11972,9 +12031,9 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __pyx_t_18 = 0; __pyx_t_19 = NULL; } else { - __pyx_t_18 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 627, __pyx_L1_error) + __pyx_t_18 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 631, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_19 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 627, __pyx_L1_error) + __pyx_t_19 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 631, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { @@ -11983,7 +12042,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); #if !CYTHON_ASSUME_SAFE_SIZE - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 627, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 631, __pyx_L1_error) #endif if (__pyx_t_18 >= __pyx_temp) break; } @@ -11993,7 +12052,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain { Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); #if !CYTHON_ASSUME_SAFE_SIZE - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 627, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 631, __pyx_L1_error) #endif if (__pyx_t_18 >= __pyx_temp) break; } @@ -12004,13 +12063,13 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain #endif ++__pyx_t_18; } - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 627, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 631, __pyx_L1_error) } else { __pyx_t_1 = __pyx_t_19(__pyx_t_2); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { - if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 627, __pyx_L1_error) + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 631, __pyx_L1_error) PyErr_Clear(); } break; @@ -12020,18 +12079,18 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain __Pyx_XDECREF_SET(__pyx_v_batch, __pyx_t_1); __pyx_t_1 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":628 + /* "dopt_pollublock_blockchain/blockchain.pyx":632 * * for batch in res.partitions(batch_size): * self.load_from_batch(batch) # <<<<<<<<<<<<<< * * self._loaded = True */ - __pyx_t_1 = ((struct __pyx_vtabstruct_26dopt_pollublock_blockchain_10blockchain_Blockchain *)__pyx_v_self->__pyx_vtab)->load_from_batch(__pyx_v_self, __pyx_v_batch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 628, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_26dopt_pollublock_blockchain_10blockchain_Blockchain *)__pyx_v_self->__pyx_vtab)->load_from_batch(__pyx_v_self, __pyx_v_batch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 632, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":627 + /* "dopt_pollublock_blockchain/blockchain.pyx":631 * res = con.execute(sql.select(db.blocks).order_by(db.blocks.c.index.asc())) * * for batch in res.partitions(batch_size): # <<<<<<<<<<<<<< @@ -12041,14 +12100,14 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":630 + /* "dopt_pollublock_blockchain/blockchain.pyx":634 * self.load_from_batch(batch) * * self._loaded = True # <<<<<<<<<<<<<< */ __pyx_v_self->_loaded = 1; - /* "dopt_pollublock_blockchain/blockchain.pyx":620 + /* "dopt_pollublock_blockchain/blockchain.pyx":624 * self._engine.dispose() * * def load(self, batch_size): # <<<<<<<<<<<<<< @@ -12080,7 +12139,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain return __pyx_r; } -/* "dopt_pollublock_blockchain/blockchain.pyx":331 +/* "dopt_pollublock_blockchain/blockchain.pyx":330 * bint _genesis_done * bint _loaded * readonly object db_path # <<<<<<<<<<<<<< @@ -12119,7 +12178,7 @@ static PyObject *__pyx_pf_26dopt_pollublock_blockchain_10blockchain_10Blockchain return __pyx_r; } -/* "dopt_pollublock_blockchain/blockchain.pyx":332 +/* "dopt_pollublock_blockchain/blockchain.pyx":331 * bint _loaded * readonly object db_path * readonly object _engine # <<<<<<<<<<<<<< @@ -12875,15 +12934,15 @@ static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { __pyx_vtable_26dopt_pollublock_blockchain_10blockchain_Blockchain.hash_data = (std::string (*)(struct __pyx_obj_26dopt_pollublock_blockchain_10blockchain_Blockchain *, PyObject *))__pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_hash_data; __pyx_vtable_26dopt_pollublock_blockchain_10blockchain_Blockchain.load_from_batch = (PyObject *(*)(struct __pyx_obj_26dopt_pollublock_blockchain_10blockchain_Blockchain *, PyObject *))__pyx_f_26dopt_pollublock_blockchain_10blockchain_10Blockchain_load_from_batch; #if CYTHON_USE_TYPE_SPECS - __pyx_mstate->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_26dopt_pollublock_blockchain_10blockchain_Blockchain_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain)) __PYX_ERR(0, 323, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_26dopt_pollublock_blockchain_10blockchain_Blockchain_spec, __pyx_mstate->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain) < (0)) __PYX_ERR(0, 323, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_26dopt_pollublock_blockchain_10blockchain_Blockchain_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain)) __PYX_ERR(0, 322, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_26dopt_pollublock_blockchain_10blockchain_Blockchain_spec, __pyx_mstate->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain) < (0)) __PYX_ERR(0, 322, __pyx_L1_error) #else __pyx_mstate->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain = &__pyx_type_26dopt_pollublock_blockchain_10blockchain_Blockchain; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain) < (0)) __PYX_ERR(0, 323, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain) < (0)) __PYX_ERR(0, 322, __pyx_L1_error) #endif #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain); @@ -12893,10 +12952,10 @@ static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { __pyx_mstate->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain->tp_getattro = PyObject_GenericGetAttr; } #endif - if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain, __pyx_vtabptr_26dopt_pollublock_blockchain_10blockchain_Blockchain) < (0)) __PYX_ERR(0, 323, __pyx_L1_error) - if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain) < (0)) __PYX_ERR(0, 323, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Blockchain, (PyObject *) __pyx_mstate->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain) < (0)) __PYX_ERR(0, 323, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain) < (0)) __PYX_ERR(0, 323, __pyx_L1_error) + if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain, __pyx_vtabptr_26dopt_pollublock_blockchain_10blockchain_Blockchain) < (0)) __PYX_ERR(0, 322, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain) < (0)) __PYX_ERR(0, 322, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Blockchain, (PyObject *) __pyx_mstate->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain) < (0)) __PYX_ERR(0, 322, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain) < (0)) __PYX_ERR(0, 322, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -13358,154 +13417,154 @@ __Pyx_RefNannySetupContext("PyInit_blockchain", 0); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_2) < (0)) __PYX_ERR(1, 3, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":457 + /* "dopt_pollublock_blockchain/blockchain.pyx":459 * return self._index * * def _print_key_value_pair(self): # <<<<<<<<<<<<<< * cdef BcHashmap.iterator it = self._chain_map.begin() * cdef Block *block */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_26dopt_pollublock_blockchain_10blockchain_10Blockchain_9_print_key_value_pair, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain__print_key_value_pair, NULL, __pyx_mstate_global->__pyx_n_u_dopt_pollublock_blockchain_block, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 457, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_26dopt_pollublock_blockchain_10blockchain_10Blockchain_9_print_key_value_pair, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain__print_key_value_pair, NULL, __pyx_mstate_global->__pyx_n_u_dopt_pollublock_blockchain_block, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 459, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain, __pyx_mstate_global->__pyx_n_u_print_key_value_pair, __pyx_t_2) < (0)) __PYX_ERR(0, 457, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain, __pyx_mstate_global->__pyx_n_u_print_key_value_pair, __pyx_t_2) < (0)) __PYX_ERR(0, 459, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":467 + /* "dopt_pollublock_blockchain/blockchain.pyx":469 * postincrement(it) * * def print_blocks(self, max_num): # <<<<<<<<<<<<<< * cdef: * Block *block */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_26dopt_pollublock_blockchain_10blockchain_10Blockchain_11print_blocks, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain_print_blocks, NULL, __pyx_mstate_global->__pyx_n_u_dopt_pollublock_blockchain_block, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 467, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_26dopt_pollublock_blockchain_10blockchain_10Blockchain_11print_blocks, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain_print_blocks, NULL, __pyx_mstate_global->__pyx_n_u_dopt_pollublock_blockchain_block, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 469, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain, __pyx_mstate_global->__pyx_n_u_print_blocks, __pyx_t_2) < (0)) __PYX_ERR(0, 467, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain, __pyx_mstate_global->__pyx_n_u_print_blocks, __pyx_t_2) < (0)) __PYX_ERR(0, 469, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":484 + /* "dopt_pollublock_blockchain/blockchain.pyx":486 * break * * def get_block(self, idx): # <<<<<<<<<<<<<< * if idx < 0 or idx > self._index: * raise IndexError("Index value is out of bounds") */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_26dopt_pollublock_blockchain_10blockchain_10Blockchain_13get_block, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain_get_block, NULL, __pyx_mstate_global->__pyx_n_u_dopt_pollublock_blockchain_block, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 484, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_26dopt_pollublock_blockchain_10blockchain_10Blockchain_13get_block, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain_get_block, NULL, __pyx_mstate_global->__pyx_n_u_dopt_pollublock_blockchain_block, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 486, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain, __pyx_mstate_global->__pyx_n_u_get_block, __pyx_t_2) < (0)) __PYX_ERR(0, 484, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain, __pyx_mstate_global->__pyx_n_u_get_block, __pyx_t_2) < (0)) __PYX_ERR(0, 486, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":493 + /* "dopt_pollublock_blockchain/blockchain.pyx":495 * return PyBlock.from_ptr(block, owner=False) * * def create_genesis_block(self): # <<<<<<<<<<<<<< * if self._genesis_done: * raise RuntimeError( */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_26dopt_pollublock_blockchain_10blockchain_10Blockchain_15create_genesis_block, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain_create_genesis_block, NULL, __pyx_mstate_global->__pyx_n_u_dopt_pollublock_blockchain_block, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 493, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_26dopt_pollublock_blockchain_10blockchain_10Blockchain_15create_genesis_block, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain_create_genesis_block, NULL, __pyx_mstate_global->__pyx_n_u_dopt_pollublock_blockchain_block, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 495, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain, __pyx_mstate_global->__pyx_n_u_create_genesis_block, __pyx_t_2) < (0)) __PYX_ERR(0, 493, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain, __pyx_mstate_global->__pyx_n_u_create_genesis_block, __pyx_t_2) < (0)) __PYX_ERR(0, 495, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":516 + /* "dopt_pollublock_blockchain/blockchain.pyx":518 * self._genesis_done = True * * def new_block(self, data): # <<<<<<<<<<<<<< * cdef: * Block *prev_block */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_26dopt_pollublock_blockchain_10blockchain_10Blockchain_17new_block, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain_new_block, NULL, __pyx_mstate_global->__pyx_n_u_dopt_pollublock_blockchain_block, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 516, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_26dopt_pollublock_blockchain_10blockchain_10Blockchain_17new_block, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain_new_block, NULL, __pyx_mstate_global->__pyx_n_u_dopt_pollublock_blockchain_block, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 518, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain, __pyx_mstate_global->__pyx_n_u_new_block, __pyx_t_2) < (0)) __PYX_ERR(0, 516, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain, __pyx_mstate_global->__pyx_n_u_new_block, __pyx_t_2) < (0)) __PYX_ERR(0, 518, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":547 - * raise RuntimeError("Could not mine block. No nonce found") + /* "dopt_pollublock_blockchain/blockchain.pyx":551 + * return self._index * * def validate(self): # <<<<<<<<<<<<<< * cdef: * Block *block */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_26dopt_pollublock_blockchain_10blockchain_10Blockchain_19validate, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain_validate, NULL, __pyx_mstate_global->__pyx_n_u_dopt_pollublock_blockchain_block, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 547, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_26dopt_pollublock_blockchain_10blockchain_10Blockchain_19validate, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain_validate, NULL, __pyx_mstate_global->__pyx_n_u_dopt_pollublock_blockchain_block, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 551, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain, __pyx_mstate_global->__pyx_n_u_validate, __pyx_t_2) < (0)) __PYX_ERR(0, 547, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain, __pyx_mstate_global->__pyx_n_u_validate, __pyx_t_2) < (0)) __PYX_ERR(0, 551, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":575 + /* "dopt_pollublock_blockchain/blockchain.pyx":579 * return True * - * def get_saving_entries(self, max_idx): # <<<<<<<<<<<<<< + * def get_saving_entries(self, min_idx): # <<<<<<<<<<<<<< * entries = [] * cdef: */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_26dopt_pollublock_blockchain_10blockchain_10Blockchain_21get_saving_entries, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain_get_saving_entries, NULL, __pyx_mstate_global->__pyx_n_u_dopt_pollublock_blockchain_block, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 575, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_26dopt_pollublock_blockchain_10blockchain_10Blockchain_21get_saving_entries, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain_get_saving_entries, NULL, __pyx_mstate_global->__pyx_n_u_dopt_pollublock_blockchain_block, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 579, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain, __pyx_mstate_global->__pyx_n_u_get_saving_entries, __pyx_t_2) < (0)) __PYX_ERR(0, 575, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain, __pyx_mstate_global->__pyx_n_u_get_saving_entries, __pyx_t_2) < (0)) __PYX_ERR(0, 579, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":602 + /* "dopt_pollublock_blockchain/blockchain.pyx":606 * return entries * * def save(self): # <<<<<<<<<<<<<< * # get max index from db * # only retrieve indices greater than max value */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_26dopt_pollublock_blockchain_10blockchain_10Blockchain_23save, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain_save, NULL, __pyx_mstate_global->__pyx_n_u_dopt_pollublock_blockchain_block, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 602, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_26dopt_pollublock_blockchain_10blockchain_10Blockchain_23save, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain_save, NULL, __pyx_mstate_global->__pyx_n_u_dopt_pollublock_blockchain_block, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 606, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain, __pyx_mstate_global->__pyx_n_u_save, __pyx_t_2) < (0)) __PYX_ERR(0, 602, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain, __pyx_mstate_global->__pyx_n_u_save, __pyx_t_2) < (0)) __PYX_ERR(0, 606, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":617 + /* "dopt_pollublock_blockchain/blockchain.pyx":621 * con.execute(sql.insert(db.blocks), entries) * * def close_db_connections(self): # <<<<<<<<<<<<<< * self._engine.dispose() * */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_26dopt_pollublock_blockchain_10blockchain_10Blockchain_25close_db_connections, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain_close_db_connections, NULL, __pyx_mstate_global->__pyx_n_u_dopt_pollublock_blockchain_block, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[13])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 617, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_26dopt_pollublock_blockchain_10blockchain_10Blockchain_25close_db_connections, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain_close_db_connections, NULL, __pyx_mstate_global->__pyx_n_u_dopt_pollublock_blockchain_block, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[13])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 621, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain, __pyx_mstate_global->__pyx_n_u_close_db_connections, __pyx_t_2) < (0)) __PYX_ERR(0, 617, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain, __pyx_mstate_global->__pyx_n_u_close_db_connections, __pyx_t_2) < (0)) __PYX_ERR(0, 621, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "dopt_pollublock_blockchain/blockchain.pyx":620 + /* "dopt_pollublock_blockchain/blockchain.pyx":624 * self._engine.dispose() * * def load(self, batch_size): # <<<<<<<<<<<<<< * if self._loaded: * raise RuntimeError("Blockchain was already loaded") */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_26dopt_pollublock_blockchain_10blockchain_10Blockchain_27load, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain_load, NULL, __pyx_mstate_global->__pyx_n_u_dopt_pollublock_blockchain_block, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[14])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 620, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_26dopt_pollublock_blockchain_10blockchain_10Blockchain_27load, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain_load, NULL, __pyx_mstate_global->__pyx_n_u_dopt_pollublock_blockchain_block, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[14])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 624, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif - if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain, __pyx_mstate_global->__pyx_n_u_load, __pyx_t_2) < (0)) __PYX_ERR(0, 620, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_26dopt_pollublock_blockchain_10blockchain_Blockchain, __pyx_mstate_global->__pyx_n_u_load, __pyx_t_2) < (0)) __PYX_ERR(0, 624, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "(tree fragment)":1 @@ -13582,7 +13641,7 @@ __Pyx_RefNannySetupContext("PyInit_blockchain", 0); static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) { CYTHON_UNUSED_VAR(__pyx_mstate); - __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_print); if (!__pyx_builtin_print) __PYX_ERR(0, 461, __pyx_L1_error) + __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_print); if (!__pyx_builtin_print) __PYX_ERR(0, 463, __pyx_L1_error) /* Cached unbound methods */ __pyx_mstate->__pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type; @@ -13602,14 +13661,14 @@ static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "dopt_pollublock_blockchain/blockchain.pyx":606 + /* "dopt_pollublock_blockchain/blockchain.pyx":610 * # only retrieve indices greater than max value * stmt = sql.select(sql.func.max(db.blocks.c.index)) * with self._engine.connect() as conn: # <<<<<<<<<<<<<< * result = conn.execute(stmt) * max_value = result.scalar() */ - __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(0, 606, __pyx_L1_error) + __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(0, 610, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]); #if CYTHON_IMMORTAL_CONSTANTS @@ -13635,31 +13694,31 @@ static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) { CYTHON_UNUSED_VAR(__pyx_mstate); { - const struct { const unsigned int length: 8; } index[] = {{72},{29},{25},{25},{36},{29},{9},{21},{33},{32},{19},{13},{9},{97},{29},{6},{28},{37},{13},{24},{18},{65},{5},{2},{1},{1},{7},{6},{2},{9},{50},{10},{10},{45},{14},{13},{10},{28},{30},{32},{31},{31},{20},{29},{15},{20},{23},{15},{19},{4},{7},{25},{27},{23},{20},{22},{20},{12},{3},{18},{5},{10},{5},{5},{6},{15},{1},{18},{20},{3},{4},{7},{8},{10},{13},{20},{15},{16},{4},{11},{8},{8},{2},{7},{6},{11},{7},{11},{20},{26},{37},{6},{9},{7},{7},{6},{8},{8},{7},{13},{4},{8},{17},{9},{18},{12},{4},{3},{3},{5},{6},{13},{2},{5},{4},{8},{3},{7},{8},{7},{11},{9},{19},{10},{8},{9},{7},{5},{3},{8},{6},{10},{7},{12},{3},{10},{9},{13},{5},{12},{21},{8},{8},{17},{11},{14},{12},{10},{17},{13},{8},{3},{7},{6},{4},{6},{6},{4},{14},{13},{14},{12},{10},{12},{19},{3},{10},{4},{8},{9},{8},{6},{0},{64},{75},{85},{115},{95},{70},{148},{11},{39},{71},{101},{187},{180},{112},{9}}; - #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (1984 bytes) */ -const char* const cstring = "BZh91AY&SY\252\301U\317\000\001p\377\377\377\377\377\377\377\377\377\367\277\377\377\373\277\357\377\370@@@@@@@@@@@@@\000@\000`\007\177\030\365\"f\204\323T\251\031\014k\201\340h\221\002z\200\000\r\r\2500\233S\332\221\241\240\032\006A\240\000\000\000441\r\003M4\031&@&SD\301O%=G\246\200i4\310\000\000\000\000\000\000\000\r\006\2324\001\240\212\247\370\247\211(\000\000\000\000\000\014\206\200\000\000\000\000\000\000\000\000\006\231$\324\r\004\217j\236\230\232mS4M\000\032\000h\000\000\000\000\000\000\014 h\r\020i\211\211\211\200\230\t\200\000\000\000L\000\0010\000\t\200\000\000\000\232\004\211\021\252l\200j\023\365S\332\032\231O\321M\000\001\352=@\000\r\000\000\320\000\000\014\206\215\003\324\365,\301\237\0046\303\240\227L\017\335\177\035O\344\237RJjO\374\256\002\270#\221\205|\242\235t\205Q\311R\240\034\251\261\2641\2646\332hg\220\031\222\276\036p\210\206\360\323\275\374x\274\013\274\317'n\322\364\027\031@36\333\000\033K\225\242\242\2443\243\303n\027\277|\001\004\010\002\002\360b\365,\n\026n>\246<\005\306\246gF\306@\350\263\321\021\036\272k4\010@h\362\025\202A\0360q\001\222F\366\213=\002\243\237Qh<<#T\270P\304\321yH\301\020>\234\271\231@b\203\006\227Hl\035Cx\350\257\323\350h\346\320(Qt\001\004\276rZ\031\377h\276F;\250\254\340\207\356\202\024H\374\206\201\234Y\204DE2\"\257\3579\305\204(,\202\265\027iF\021\302+\032u\272\270\203_w8\030\240\340\272\310\255'sA\023\201\340\364\206-\032\0206\347\327Cy*m\"\033\307\247\341Y\247p\222\271\327T`I\004\316q\010\016X\234\0355\370\\\230\345\262\2575\306\265p\3008\201\005P*\253\210vp\003\230+\212\242\372j\037\247?\033\203\213\37577\205\260\300ZX\263\341\210\213\020\206$[\026\356\tVVR\367\203\016Y=\031\352\346\216f\255\2417\234\354w/\370\303L\234\361o\347Fp7\000\320>\356\216\2056\311\267n\351x\200\272\005\255g\251\360\203\304\034\237f\217\277\\\272\231(&\267\021\013\341\n\225n&X@8\t3\022v\371.\323\3077u\210\021F\006\234\270+\305\212\t\212\244\037WC6b\034\n\027O\252\322\007\261\331\2400\241@1K\207:\216\027u\355\271\221\326\034Y\346aA:N\244L*m\177J\201\302\316\216\3078 -\206\000`2\357oy\3310\252W\303q\010+\222X!I\022un\366\341h_P\234\271\221(\022I\244 \023\221Y\006\020\326\010\202\210\300\n>\2345\rVQ\205h\324Y\202\261\347\310*\335\370H]\365]O\351\365\304n\314\242!\226e\235XA-\227\222,\014\023`\226M\202g$\325\300\340\314xnL\223,d\242c\223S\t2\245\2102Ui-\031\352\342\3374fU,\203\224%`\202n\331\257KS\023I\006.\241\337\305.\367\306!8\007\00573\240\330P\271\301!\2240`h\211\314\342er\210\277\034\022I\255\343k`Z\364\250\353\366\213\312\212\013\353A3\021\023\301\2000v(H\021\335VkU\361d\245Bc'\0014W\227\210U-s$\026G\312\316\250\206\227_\016\202g\310\325@\021\0236\221bA\027\010N=VSHsm\334\205\027\326kkB\r)\356\343\3270\237\265\243i\241\246\301\241\262Q\002\"\022&\"'b T\032.P\354\225\250L\352\232\240\261Y\034\240\345\244,(C\255U\257](\023\250\222\233\000hcr0\363\360O\001Z\356)\027\314\343\255\214\211\303d\323U\013c[~jl\2544c;\253\241)\225:\310\006\342\003\220\005\220u2\216:C)$\035Y\354(x\347V\243]\240\241\220\202\001B\221\221\rZu\242\003hk\014'R{3!\033\330a 0\333\2306\313\271e\256\222c\231\3724e~\272F\225xV\221\013K\326sxS\267\207\223\277\276\340\347\001\311\034\347\027\006g\007\016\301Wg#\221f\301\003\r)\214\325\261\224\227\206&+\014\241N\315\222\0106\257\022\362\300U\313\256\301\n\3041`\230\032\301\357\265W\022F[\002U \242\353Q4\220\021AD#H\316n\357\335`d\217R\355\335\350e\017\202V\217\245Z\340g~""\024\3033n5P\214\366\251%\001S\274\264m1U\327\306\227=\206\2001\212\221q\004.\034\013\247\247\007\337\210m\240n\001\210q\027\223\\r\035\251\221%\235\267E\205D\320QX\240{X\236\026s\020\020\212\271QMP\003(\252(L\300fR3\004B\3670-!\242\3531Q!|*X`)\t,\204\034\210\323\305\0012\177\252\246q@a8\247\300\240G\313\361\003\362h\314\3545\004X$\320\307\355\022J!\3772\022\022\300L\222\212\365\350\234\214\211O\214lDy\021\356\240\345y\255\273pW\035\333\356\256{\327\267\266u(\306=\313\222\361\260\025\260k\267cm[\255\357=y\365\365M\356\334<\314U\373\3453\235q\325\254\264\032\245p\332\025\030Zd\311\0064@\320T\024\314\202\200\000P\201^T\227V4p<\002O\022\260\240\013(\230\013\000\230\t\356\21309\300D\204\014\372\252\203\201\\dbo\351\274\257\022\010\243\354\004\342bQ}\310\312 \"T\244\037\342\356H\247\n\022\025X*\271\340"; - PyObject *data = __Pyx_DecompressString(cstring, 1984, 2); + const struct { const unsigned int length: 8; } index[] = {{72},{29},{25},{25},{36},{29},{9},{21},{33},{32},{19},{13},{9},{97},{29},{6},{28},{37},{13},{24},{18},{65},{5},{2},{1},{1},{7},{6},{2},{9},{50},{10},{10},{45},{14},{13},{10},{28},{30},{32},{31},{31},{20},{29},{15},{20},{23},{15},{19},{4},{7},{25},{27},{23},{20},{22},{20},{12},{3},{18},{5},{10},{5},{5},{6},{15},{1},{18},{20},{3},{4},{7},{8},{10},{13},{20},{15},{16},{4},{11},{8},{8},{2},{7},{6},{11},{7},{11},{20},{26},{37},{6},{9},{7},{7},{6},{8},{8},{7},{13},{4},{8},{12},{17},{9},{18},{12},{4},{3},{3},{5},{6},{13},{2},{5},{4},{8},{3},{7},{11},{9},{19},{7},{8},{10},{8},{9},{7},{5},{3},{8},{6},{10},{7},{12},{3},{10},{9},{13},{5},{12},{21},{8},{8},{17},{11},{14},{12},{10},{17},{13},{8},{3},{7},{6},{4},{6},{6},{4},{14},{13},{14},{12},{10},{12},{19},{3},{10},{4},{8},{9},{8},{6},{0},{64},{75},{85},{115},{95},{70},{155},{11},{39},{71},{101},{187},{180},{112},{9}}; + #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (1991 bytes) */ +const char* const cstring = "BZh91AY&SY&r\r\301\000\001r\177\377\377\377\377\377\377\377\377\367\277\377\377\373\277\357\377\370@@@@@@@@@@@@@\000@\000`\007\177\036\001\310SZ*\224\022ILp`\202\2114\364 \000\003Cj`\322m6\244h\000\003i\006F\232\003@4\003F\217P\332L\214\214OPd\2014\311\224LhS\311=G\251\241\243@\000\000\000\000\000\000\000\000\320\000\000\020i\211\211\211\200\230\t\200\000\000\000L\000\0010\000\t\200\000\000\000\232\004\246\204 @\214\232O@S\301S\364\247\244di\210\365=@\0004\000\000\006\200\000\315\250\214'\250\323D\032bbb`&\002`\000\000\000\023\000\000L\000\002`\000\000\000&\201\"T\364*z\233(zi\017\325\036\325\0004\000\000hdz\201\240\000\000\310\000\000d\3204\3204\3653\265\357\353\303l1\222\373\201\226\277\031\237\222Y\225\224\225g\374\236\002x#5\204\367\205)\350\2051\2332\240\013\311\261\2611\2646\332hg(-%L;\360\210\206\354Q\302\310\337\342[\346\342\325|R\202\331\240\000\264\333\020\r\245y\242bd`*\023\276\324\247\224\005P\230CPkR\032FM3\327\266[\245\235\261k\333f\351\263\220\363D\222\247\0067\2410E\273\"Er\241\223\260J\271\263\346\264\321\020\236\230\231\253B\202\234Y\314\032\315\204v\251\022)\207~\366\272\246\224e7w\033\217ar/m\374\221\353\373~;'.\207\004%\035\316\376\277\255\354V:\372a\352\375\303\237\362\316\\\217\366MZ\373L\226,a\241D{W\337i+\201\231\030\342g\233\255[eh\266\034\333{\307\017\213\2349E\325\304\316\237\335\210Vt\272\242b\363\226\353J\357s\371s\361rv\367P\336\236\377\313\327\206\344\223\375n'\254\244\204\271\327\032\010L\227W\333\177i\376\225|\346}\006\315\315\267r\222\tB\204DC\260\372\300y!\332\024}\310)\301\257\253\247\243\311>_\202r\310\315v\231\245t\226\226\010h\"VY\264%l[\026Z\320]\245'6\233\332q\231{\010LJU\233s\366\272\353\324\321/\305w\000\266\005c\325\233Z\314\254a\303\222Z\034&\201q\2157\232\34749I\350\257\327}\377K\020\033;\325'\230s\034\333\235\237P@;\263$\275\016\310nz\370\375c\317\321%q\273\010I4\257\354\344d\342EY\212\243\255U3F\216\220xf\200\212>\265\321\266\335\243\317\005\327D+\270\213\340\276\0139\010\271{\234-\3133>\036\2700sG\220\266\003\027""\273\317`\2352\021\341\301\335\351\230\312\2715\205\251\3359\0062\326\320\260\263\016\253B\010`\274L[\344\245\244]0\341]\241B!.\202dOR\032\020@k&\010\026\020\346\017\325\377\027\001\003o\351=\304H\332[;`c\211\202\215\247\251\252;\201\t0\342\321\3439\006\301\250o\320\234\232\023!\235\261\377H\3528X\275\274\325\324\307W\231\337r;\016a\320\221\014\260\254\352\3520,\315p'\262P\025\221B\251\\\215\3535\254\014\034\242\215T\211\254\305\253~\227^EN\263T\023\240m1\306\032Xat\346\236\334\030\030\262\003\233M\365\315\231\313\304Q\315\212\235j\321\n\005\n\251\376\261\340\353pV\030 P\013)0\245ABj\234\255\330|\307E\373\322`_\205\370\261y\013\212\235\330\016Nh\266\347q\rL\262\014\215\\\274\277_F\254t\360\3012\373\251\245\017J\245\337\210\357N\323\231\347\235B\243\274\244\222\274\221\341\030\334I^\021\212\301j\206\024\303\301\2118\314\031c\204\341\027\215\026\363n#\031\317X\270\233b\273\315\370\347\301\303IDB\373K\246,\016Ide\211\002\344\300\037c\000\244\330\245j&\251B\313}\221\010\301\020\362(M!\010\243f\r\024\304\216-\352z=\007\026\246\243X\032@\371\004\024\253\005\373\254\205\223\007\206\025\010\034vRmm\024\004\312\031P\267q\006\002\205N3\010\261}\351\207\231=\024V\035\370s\271\014\311\274\243v\301\265\332\207\203q\302P\261\234\341W\265\2137NCU\364\241\203\"\3569\245)\215-+\014E\246n\200\2751\305\301\321IL\275\004\2205\362TC\256\252uk\022\345\206E\000DKWD\211\004LL\332\177\362-\314\034\370\362;?\rK\256v\016f\\\271\365\231\037\347\021&L&H\023\t3$$\231\213\313\027\346b\255\003a\032\207\321\216\"\327\266\264\264\\\332\206\325\205N\014K\210Vj\354\265\326\t\241\r(\0010\222h3zW\315\345[\341Y\361\223\303T!\345\322%\235\332\214\333.\350\226\224\324\016,\347\241\276\354\322QTpI\334t\021p\370j:\325u30\333u\3460n\266\333\265\261\342\0315\305l\340@\243\326C#\014\360p\302\031!U1'^^(\234\205O\002\2546\2030MK}\370=\206\323k\257!\267\341D\"\320\266<\205\302q\246\226\205\234:l\274h\023\030\031cR\242\240\3068\347\231\021\360)\t\265\351A\302\357\261l\317\320\364\3448\371X\3550\327\255\010[y\022""\214\244\315\347ha\314\350d\303\260\263\221\314\331\240\245r\322d\364.\207\340\331I*\343\324RR\231\364\303\216kp\017F\254\253'\023\262\003\\\221\203a\026L\013\215\252\025Ze\266E\010\271(\222P\225\234K\203.\320\265\337\320\277V\301X\026hY\023\016B\241\224\273\277\0276y\303*\315\360\322;\031\356\234\347c\355\224\256\327<\306\343\320\370\0303\342\343\213\234\323:\014;\353\300\276B\352A\r\r\302F6y2\347\316\231)\"\341\0068CA\024\2366\373\304\022\255u5\332\023i\362\340\310\302;7Y\355\250 yAQ\347\356t\245/|\262\356\320/Ky\303/\031\341\321\206\211uM\336D\360Dkd\020\0223\362\316\006%u\314[\035`=\360<\371\034\245\320\006\221\310>)\274\024\245\300\025\350\0079\005)\347\036I\316f\t\n\261C\020\210\201\242~`m\337\247\370Q\224\032_\215\220\252\010\0133&\324\320L\310\017\373\023(\007\022\321X\006\242\241Tdj\243\0053g\2271\340u\027\341\007\366\230C\361#\302$!\254 \251^aT\277\224\003\001\223\003M\030\211$\025N\323]\361\006\372\257UJ8J{\"K\241u\345\312\341\334\304\\\341\270\\\203E\333q\365\275\013\250Wrb\360\271mA\204X\274\267B\003G\260\331?|~\303\216\233\206\330\371\373'\305F\316c\307\017E\245\021ER\261\016t\202\243\225\232\323um\021K\212\t\350\366\261AV\252\005a@\243\323V\261u\303\275\034\265/\255nJ\267C\302\213\377\014\326^\216\357K\354=\357g/\272kD$\375\256\177\361w$S\205\t\002g \334\020"; + PyObject *data = __Pyx_DecompressString(cstring, 1991, 2); if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) const char* const bytes = __Pyx_PyBytes_AsString(data); #if !CYTHON_ASSUME_SAFE_MACROS if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } #endif - #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (1867 bytes) */ -const char* const cstring = "x\332\245UIs\033\307\025\026\274H\000\004Z\004)\222r\304X\203X\212\255$\002M[\211\025V\226\202DjIbE\224)'Q*\351\032\3144\200)\017f\200\231\036\022P.:\342\330\307>\366q\2168\362\250\243\216<\342\310\237\240\237\340\3575\006\213E\250*\225\260\206\275\275\356\367\336\367\275\005w\375\320\371\336i\331^`\331~\304m\267o\265\354\330\262\255&\017x\354\305V\235.T\255=O\264xdy\302:\202\330\301M\301]+\214,?\264]\356V\357\316\364\320\205\211\256\261\364^\230\370\256\025\204\002\347\270\207\247d\244mw\026\010\016\271#\302h&h{\001\2378\3618\304Q\340p\253\021&\201{\3178\361\266\253V\303\213bQ-\026vma\357\024\314d\265\223XXu\272\033\213\310\013\232\273^\243\3419\211/\372SQ\323h\213,\321\262\003\353\213\005\027\274@\360&.\034\332~\302\357\333\236\017\374\"$ -\313\205\221\007\231\027\206\211b\341!\316a~\307\242\005P\000\256pZ\325\3616lX\235\210\037za2\361\332\ry<\306K\327\340\005\267b\373\220(\016\310\2649p\222(\342\201\230\260Q\253\207\221\250\216\r\340\261\010g\357'\302G\201\313{\326x4~[p0L\0049P'\016\343o\354\236\327N\332V\220\264\353\000\267\230\215b\341\t\274\265\306\220\236D\341\241\207\240\302+RK6M8\236\364\r\362\317\213\005c\017\330\017\340s\3076.\273^d\342\332'\313\204\2453\321B\324\325\355\230n\212\326\214\006\336\363b\361\354\340\376\255;\305\233\325?\272^l\327}\316\003\032\233\216\027\217Wn\020Z.o\330\210\223\305X\304\335\304\341\214Y.p\0326\202[\210\366\241g\373\220:^\340\t\306\212\005\223A\360.\356\372\236\340;[[[q\344l\271aG\260N\350\373\211a\227\325\247\371\2745[V;\375\336\357\306\031\024\207I\344\360?\024\013\302k\363X\330\355\316NaV\003\263Uu\352\227\323\027\2550`\354G\262\230\013<\026\213\245\035\030\022\354{\336g&v\254c{\321\234\334\361\303\2303\267\316\2340\010\300\256\027\006\361\274\330\204\220e\3051\0064'nr\261\360\014Y\007x\014A\213<>\257\217Jyn\033\360\2433\357\307\016\233\323\371\227\224\310s[\200\361\020u\376\004\001\317\222&\233\316\2225\023\234aj\"\252\367\005\217!\216\020g\357\005\237\034wx\324\010\2436\243\372\234\234M/1\327s\004\251\350\341\177\227""\326\217yO<\345\215\203G\337\354=\377\353\343=\366\354\340\236\035;v\334\017\034/\254:a\204\252A'\212\353T^f`1\024\325y\323\013\014\3401\352\267\234q\034\037\217\230\0270\021\331\016\257\333\340`A\324\260\244]v\202I\200\3768\013 :c\266\342\001\214\361Eq\315:\003\243dd\342\205\223\010\326\366\234\010\226\240\314\215\251\306\350\037\260\233HV\263D\032S\020\350\205[\207;T~\231\330\214\006\036\352\256\003%\2468P\244\236\023\317-\253\323\367\357\254\235wK\252\263%\007p\027u\013\000j\004c\343\307\325<\333\341\305lCYl\232GF-V\331/\306\\Ka\013\332\013~\036\360\331\276\323\342\355~,\332\270/\250,\3304\341&}\314p\025\177\361\177\376\275\254\275)\236+\024G\2455\371o\275\255w\323\302\260<\254\214J\227\006G\322Q\345\321r\371\264\264,/\310\236JtM\177\227~\231\376\353\370\372q\375\325\205W\335\3279\022\345d\3714\177i \344\366\313\332(\277*\267O\363txU\355\352\013\272;2\233k\372\003\375 \335\036\235\221\234\224\257\303dn,\370\211\272\255\272sKR\333%\245\027\007\267\007\335QiE\376J\331\243\362\312\233\374\271\302'\352\037\272\231\356\247\366(\177M\t\275C\313\323\374\246z\244\367G\344\324\250t\203VK\223\357\243AS\356K\\\331\220B\355\350}m\217\325\306\262\222)&\323\245\223\322O\325\376\333&\341\311RY^QW\364\2726g\237\312\277\253}\345\350\2154\227\256\244w\206\277=\256\035?=>zU\177}\376\265{\362\364\333\323|i\360H~\253.\202\320\032\3349Y\266tN\227\351\370\317r\212(\222+\362+\351\252\237\201\217\034""\251\375\205\252\251}\002\261\253Ki-\335\247k\277\221\253\2626\025\216\362\353\322S]\275\224\302\3117+\347\n%\350\001\363s\020H\363\013UV?\037\353\274\251\266U\355\024a\271-_\350\262\256\214\362k\362@m\202\0007\305\346\262\374\023(\315\257\310\353\262\245\352:7\245p\351\177!\220\220\225\006\017\345CU\203{y\223V\233'\233\267\020\034wx\363x\373\030HV\345\357\365{\272\222e\016\275\270\241\017\322\253\303\373\307\225\323\374G\003\007xwA\334mb\272,\313P\354\350\362\250tY\376E\277\257\001\364\023\345\351.2\306\010a\372c`\255\300\332\371sK\327\000\245tU!\001/\016\356\200Z{\216\324\322\340\201\374\265\312\251\313\352oH\343\247:Ik\244tW]\000\235\360g\221\352U\"\2262\233T-\033_Wd\205,mH\033\023\330\317\314\\Q(\205\r\331}\207\235\231\21636\361\210\316j\362\237\372C\342\233\226L\357\245\345\267OO\326>O?L\237\017\217\216\355\343\354\311s\224\344^\2721\314\r\313\013\016V\345\327\252Bd\230\"\"\257+\224\022\353p\035\221Y\372/\370\330\220\211z\010\351\263\364Fz4\264\207\335I\223@)\323u\213\234\323\215\364.\252p\034N\202\332W\357\253\355\321\362\032\262\245eRr\331`\2744\370\217\372\014\221\\^\225;\352;\375\225\346\350\007\227\021\275\321\307\025JL8\270\266\211\207\024\320\231\317\205e$\330g\010\361\247\352\231\276\256m\035\001\336{\350O\363\005I\031}\305$7\002q^55\342\215\214>Y\277\231\226)\311\263Z^\032W\361\272:$J/\rz\262\013W\277\006\326/\365\363\264\37327\372\2408\370\245\334\377\001f\260\232\305"; - PyObject *data = __Pyx_DecompressString(cstring, 1867, 1); + #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (1874 bytes) */ +const char* const cstring = "x\332\245UIs\033\307\025\026\274H\000\004Z\004)\222r\304X\203X\212\255$\002M[\211\025V\226\202DjIbE\224)'Q*\351\032\3144\200)\017f\200\231\036\022P.:\342\330\307>\366q\2168\362\250\243\216<\342\310\237\240\237\340\3575\006\213E\250*\225\260\300\336^\367{\357\373\3362w\375\320\371\336i\331^`\331~\304m\267o\265\354\330\262\255&\017x\354\305V\235.T\255=O\264xdy\302:\202\330\301M\301]+\214,?\264]\356V\357\316\364\320\205\211\256\261\364^\230\370\256\025\204\002\347\270\207\247d\244mw\026\010\016\271#\302h&h{\001\2378\3618\304Q\340p\253\021&\201{\3178\361\266\253V\303\213bQ-\026vma\357\024\314d\265\223XXu\272\033\213\310\013\232\273^\243\3419\211/\372SQ\323h\213,\321\262\003\353\213\005\027\274@\360&.\034\332~\302\357\333\236\017\374\"$ -\313\205\221\007\231\027\206\211b\341!\316a~\307\242\005P\000\256pZ\325\3616lX\235\210\037za2\361\332\ry<\306K\327\340\005\267b\373\220(\016\310\2649p\222(\342\201\230\260Q\253\207\221\250\216\r\340\261\010g\357'\302G\201\313{\326x4~[p0L\0049P'\016\343o\354\236\327N\332V\220\264\353\000\267\230\215b\341\t\274\265\306\220\236D\341\241\207\240\302+RK6M8\236\364\r\362\317\213\005c\017\330\017\340s\3076.\273^d\342\332'\313\204\2453\321B\324\325\355\230n\212\326\214\006\336\363b\361\354\340\376\255;\305\233\325?\272^l\327}\316\003\032\233\216\027\217Wn\020Z.o\330\210\223\305X\304\335\304\341\214Y.p\0326\202[\210\366\241g\373\220:^\340\t\306\212\005\223A\360.\356\372\236\340;[[[q\344l\271aG\260N\350\373\211a\227\325\247\371\2745[V;\375\336\357\306\031\024\207I\344\360?\024\013\302k\363X\330\355\316NaV\003\263Uu\352\227\323\027\2550`\354G\262\230\013<\026\213\245\035\030\022\354{\336g&v\254c{\321\234\334\361\303\2303\267\316\2340\010\300\256\027\006\361\274\330\204\220e\3051\0064'nr\261\360\014Y\007x\014A\213<>\257\217Jyn\033\360\2433\357\307\016\233\323\371\227\224\310s[\200\361\020u\376\004\001\317\222&\233\316\2225\023\234aj\"\252\367\005\217!\216\020g\357\005\237\034wx\324\010\2436\243\372\234\234M/1\327s\004\251\350\341\177\227\326\217yO<""\345\215\203G\337\354=\377\353\343=\366\354\340\236\035;v\334\017\034/\254:a\204\252A'\212\353T^f`1\024\325y\323\013\014\3401\352\267\234q\034\037\217\230\0270\021\331\016\257\333\340`A\324\260\244]v\202I\200\3768\013 :c\266\342\001\214\361Eq\315:\003\243dd\342\205\223\010\326\366\234\010\226\240\314\215\251\306\350\037\260\233HV\263D\032S\020\350\205[\207;T~\231\330\214\006\036\352\256\003%\2468P\244\236\023\317-\253\323\367\357\254\235wK\252\263%\007p\027u\013\000\3143\026\330\010&\233\326\031-p\303\264/(\016#\027l\325\373\343\006\213\021\316P.Q\034}\257>\237\376\235\260c\300\0335S\032&\037\240l\203\312\235/\337\205\315\247\323\317t`\246D\237\314\250ZR\302A\003:$\313\010\244\345\241\240>Mh\272\211\355\217\021\315:\365\231r\237\036\360\336x\323\211h\214\361\013\375C\216\t\255\236\332\tJ\323\267\243\230\373\250\027\214\215\037W\366l\207\027\263\re\264i$\031\265Xe_\217\271\366\302\026\264\032|*\360\263}\247\305\333\375X\264q_P\211\260i\362Mz\232\341*\376\342\377\374{Y{SzU\177}\376\265{\362\364\333\323|i\360H~\253.\202\320\032\3349Y\266tN\227\351\370\317r\212(\222+\362+""\351\252\237\201\217\034\251\375\205\252\251}\002\261\253Ki-\335\247k\277\221\253\2626\025\216\362\353\322S]\275\224\302\3117+\347\n%\350\001\363s\020H\363\013UV?\037\353\274\251\266U\355\024a\271-_\350\262\256\214\362k\362@m\202\0007\305\346\262\374\023(\315\257\310\353\262\245\352:7\245p\351\177!p.\017J\203\207\362\241\252\301\313\274\311\256\315\223\315[\210\221;\274y\274}\014@\253\362\367\372=]\311\022\210^\334\320\007\351\325\341\375\343\312i\376\243\201\003\330\273\340\3576\021^\226e\350w42\361\262\374\213~_\003\357'\312\323]$\216\021\302\203\217\001\271\002k\347\317-]\003\242\322U\205<\2748\270\003\206\3559nK\203\007\362\327*\247.\253\277!\233\237\352$\255\221\322]u\001\254\302\237E\252W\211_\002F\252\226\215\257+\262B\2266\244\215\tA\310\314\\Q\250\210\r\331}\207\235\231\21636\361\210\316j\362\237\372C\242\235\226L\357\245\345\267OO\326>O?L\237\017\217\216\355\343\354\311sT\346^\2721\314\r\313\013\016V\345\327\252Bd\230Z\"\257+\224\031\353p\035\221Y\372/\370\330\220\211z\010\351\263\364Fz4\264\207\335I\257@E\323u\213\234\323\215\364.\212q\034N\202\332W\357\253\355\321\362\032\222\246e2s\331`\2744\370\217\372\014\221\\^\225;\352;\375\225\346h\013\227\021\275\321\307\025\312O8\270\266\211\207\024\320\231\317\205e\344\331g\010\361\247\352\231\276\256m\035\001\336{hS\363uI\211}\305\3448\002q^55\342\215\304>Y\277\231\226)\327\263\222^\032\027\363\272:$J/\rz\262\013W\277\006\326/\365\363\264\37327\372\2408\370\245\334\377\001z\264\242`"; + PyObject *data = __Pyx_DecompressString(cstring, 1874, 1); if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) const char* const bytes = __Pyx_PyBytes_AsString(data); #if !CYTHON_ASSUME_SAFE_MACROS if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } #endif - #else /* compression: none (3739 bytes) */ -const char* const bytes = "Blockchain already has a genesis block. Either it was created or loaded.Blockchain was already loadedCould not allocate hasmapCould not allocate vectorCould not mine block. No nonce foundCreate a genesis block first.\n\tData:\t\tData must be a stringDifficulty must be greater than 0Difficulty must be integer valueFailed to hash dataGenesis Block\n\tHash:\t\t: Hash mismatch. Hash of previous block does not match the saved one in the current block. Abort.: Hashes to not match. Abort.Index Index value is out of boundsMaximum number must be greater than 0\n\tPrev Hash:\tProvided index not foundPyBlock(\n\tIndex:\t\tThe parent directory of the provided database path does not existUTF-8\n).?disableenablegcisenabledno default __reduce__ due to non-trivial __cinit__\n\tnonce:\t\tsqlite:///src/dopt_pollublock_blockchain/blockchain.pyx\n\ttimestamp:\tBlockchainBlockchain.__reduce_cython__Blockchain.__setstate_cython__Blockchain._print_key_value_pairBlockchain.close_db_connectionsBlockchain.create_genesis_blockBlockchain.get_blockBlockchain.get_saving_entriesBlockchain.loadBlockchain.new_blockBlockchain.print_blocksBlockchain.saveBlockchain.validatePathPyBlockPyBlock.__reduce_cython__PyBlock.__setstate_cython__PyBlock.bytes_serializePyBlock.perform_hashPyBlock.serialize_dict__Pyx_PyDict_NextRefTIMEZONE_UTCascasyncio.coroutinesbatchbatch_sizebeginblockblocksbytes_serializeccline_in_tracebackclose_db_connectionsconconnconnectcontentscreate_allcreate_enginecreate_genesis_blockcurrent_time_tzcut_microsecondsdatadata_digestdata_strdatetimedbdb_pathdigestdigest_sizedisposedopt_basicsdopt_basics.datetimedopt_pollublock_blockchaindopt_pollublock_blockchain.blockchainencode__enter__entriesexecuteexists__exit__from_ptrfromhexfromtimestampfunc__func__genesis_prev_hashget_blockget_saving_entries__getstate__hashhexidxindexinsert_is_coroutineititemsload__main__maxmax_idx_max_idxmax_nummax_nummbermax_valuemetadata_blockchain__module____name__new_blocknew_idxnoncenumorder_bypare""ntpartitionspathlibperform_hashpopprev_blockprev_hashprevious_hashprintprint_blocks_print_key_value_pairpy_blockpy_bytespy_bytes_rehashed__pyx_state__pyx_vtable____qualname____reduce____reduce_cython____reduce_ex____repr__resresolveresultsavescalarselectselfserialize_dictserialize_resserialize_size__set_name__setdefault__setstate____setstate_cython__sqlsqlalchemystmt__test__timestampvalidatevalues0000000000000000000000000000000000000000000000000000000000000000\200A\360\n\000\t\n\330\014\025\220^\2401\240D\250\t\260\021\260!\330\014\017\210w\220c\230\021\330\020\021\340\014\020\220\007\220x\230u\240A\240V\2502\250]\270$\270b\300\007\300q\310\001\340\014\020\220\001\220\021\340\010\017\210t\2201\200A\330\010\023\2201\340\010\020\220\001\220\033\230D\240\007\240q\330\010\020\220\001\220\037\240\004\240G\2501\330\010\020\220\001\220\033\230D\240\007\240q\330\010\020\220\001\320\021$\240D\250\001\330\010\020\220\001\220\032\2304\230q\330\010\020\220\001\220\032\2304\230q\340\010\017\210q\200A\330\010\013\2104\210q\330\014\022\220,\230a\330\021\022\360\010\000\t\036\230Y\240g\250Q\250a\330\010\037\230t\240:\250Q\250a\340\010\034\230I\240Q\330\014\020\220\001\330\014%\240Q\330\014\r\330\014\r\330\014\r\330\014\016\210g\220Q\220a\340\010\027\220t\230:\240Q\240a\330\010\013\2104\210s\220!\330\014\022\220,\230a\230q\330\010\014\320\014\035\230Q\200A\330\010\013\2104\210q\330\014\022\220,\230a\230q\340\r\021\220\030\230\030\240\026\240q\330\014\022\220#\220X\230Q\230c\240\027\250\001\250\022\2508\2609\270A\270R\270w\300b\310\006\310d\320RS\340\010\014\210I\220S\230\013\2401\240A\330\014\020\320\020 \240\001\240\021\340\010\014\210K\220q\200A\330\010\013\2104\210r\220\022\2203\220d\230\"\230D\240\001\330\014\022\220*\230A\230Q\340\010\034\230D\240\014\250A\250Q\330\010\013\2106\220\023\220A\330\014\022\220*\230A\230Q\330\010\026\220i\230q\240\r\250Q\200A\360\022\000\t\014\2104\210t\2201\330\014\022\220,\230a\230q\330\010\013\2104\210z\230\021\230&\240\001\330\014\022\220)\2301""\230A\340\010\023\2204\220z\240\021\240!\330\010\025\220T\230\034\240Q\240d\250!\330\010\024\220J\230a\330\010\022\220$\220h\230b\240\001\340\010\034\230I\240Q\330\014\r\330\014%\240Q\330\014\r\330\014\r\330\014\r\330\014\016\210g\220Q\220a\340\010\027\220t\230:\240Q\240a\330\010\013\2104\210s\220!\330\014\022\220,\230a\230q\200A\330\010\014\210H\220H\230A\200A\360\010\000\t\n\330\014\034\320\034-\250Q\250d\260)\2701\270A\330\014\023\220=\240\002\240!\340\014\020\220\001\220\021\200A\330\010%\240T\250\033\260F\270!\340\010\016\210c\220\023\220D\230\013\2404\240q\330\014\021\220\021\220,\230c\240\021\330\014\024\220L\240\003\2401\330\014\036\230i\240q\250\001\330\014\021\220\021\220!\330\014\031\230\021\230!\200A\360\006\000\r\037\230a\330\014\033\2301\340\010\013\2108\2203\220a\330\014\022\220*\230A\230Q\340\010\014\210G\2205\230\001\230\024\230W\240A\240R\240u\250A\330\014\024\220D\230\007\230q\240\002\240!\2401\330\014\036\230i\240q\250\001\330\014\021\220\021\220!\330\014\023\2201\330\014\017\210t\2203\220a\330\020\021\200A\330\010\022\220!\360\006\000\r\027\220a\360\006\000\t\014\2108\2203\220a\330\014\030\230\001\340\014\027\220q\340\010\014\210G\2205\230\001\230\024\230W\240A\240R\240u\250A\330\014\017\210t\2203\220a\330\020\021\330\014\024\220D\230\007\230q\240\002\240!\2401\330\014\027\220q\330\014\024\220A\220[\240\005\240Q\330\014\024\220A\220_\240E\250\021\330\014\024\220A\220[\240\005\240Q\330\014\024\220A\320\025(\250\005\250Z\260w\270a\270q\330\014\024\220A\220Z\230u\240E\250\027\260\001\260\021\330\014\024\220A\220Z\230u\240E\250\027\260\001\260\021\330\014\023\2207\230!\2301\340\010\017\210q\200A\360\006\000\r!\240\001\330\014\026\220a\360\010\000\t\r\210G\2205\230\001\230\024\230W\240A\240R\240u\250A\330\014\024\220D\230\007\230q\240\002\240!\2401\330\014\027\220u\230H\240A\240U\250%\250w\260a\260q\330\014\025\220^\2401\240G\2501\250A\330\014 \240\005\240Q\240f\250B\250a\330\014\020\220\001\220\021\330\014\017\210y\230\003\2301\330\020\025\220Q\220h""\230a\230q\330\020\027\220q\330\014\017\210{\230'\240\021\330\020\023\220:\230V\2403\240e\2501\330\024\031\230\021\330\031!\240\021\240!\360\006\000\025\034\2301\330\014\031\230\021\340\010\017\210q\200A\360\006\000\t\020\210s\220'\230\021\230#\230U\240$\240a\240r\250\027\260\002\260!\330\r\021\220\030\230\030\240\026\240q\330\014\025\220T\230\030\240\021\240!\330\014\030\230\006\230g\240Q\340\010\022\220$\320\026)\250\021\250!\330\010\013\2104\210q\330\014\r\340\r\021\220\030\230\026\230v\240Q\330\014\017\210x\220q\230\003\2307\240!\2402\240Z\250q\200\001\330\004\n\210+\220Q"; + #else /* compression: none (3758 bytes) */ +const char* const bytes = "Blockchain already has a genesis block. Either it was created or loaded.Blockchain was already loadedCould not allocate hasmapCould not allocate vectorCould not mine block. No nonce foundCreate a genesis block first.\n\tData:\t\tData must be a stringDifficulty must be greater than 0Difficulty must be integer valueFailed to hash dataGenesis Block\n\tHash:\t\t: Hash mismatch. Hash of previous block does not match the saved one in the current block. Abort.: Hashes to not match. Abort.Index Index value is out of boundsMaximum number must be greater than 0\n\tPrev Hash:\tProvided index not foundPyBlock(\n\tIndex:\t\tThe parent directory of the provided database path does not existUTF-8\n).?disableenablegcisenabledno default __reduce__ due to non-trivial __cinit__\n\tnonce:\t\tsqlite:///src/dopt_pollublock_blockchain/blockchain.pyx\n\ttimestamp:\tBlockchainBlockchain.__reduce_cython__Blockchain.__setstate_cython__Blockchain._print_key_value_pairBlockchain.close_db_connectionsBlockchain.create_genesis_blockBlockchain.get_blockBlockchain.get_saving_entriesBlockchain.loadBlockchain.new_blockBlockchain.print_blocksBlockchain.saveBlockchain.validatePathPyBlockPyBlock.__reduce_cython__PyBlock.__setstate_cython__PyBlock.bytes_serializePyBlock.perform_hashPyBlock.serialize_dict__Pyx_PyDict_NextRefTIMEZONE_UTCascasyncio.coroutinesbatchbatch_sizebeginblockblocksbytes_serializeccline_in_tracebackclose_db_connectionsconconnconnectcontentscreate_allcreate_enginecreate_genesis_blockcurrent_time_tzcut_microsecondsdatadata_digestdata_strdatetimedbdb_pathdigestdigest_sizedisposedopt_basicsdopt_basics.datetimedopt_pollublock_blockchaindopt_pollublock_blockchain.blockchainencode__enter__entriesexecuteexists__exit__from_ptrfromhexfromtimestampfunc__func__genesis_donegenesis_prev_hashget_blockget_saving_entries__getstate__hashhexidxindexinsert_is_coroutineititemsload__main__maxmax_nummax_nummbermax_valuemetadata_blockchainmin_idx_min_idx__module____name__new_blocknew_idxnoncenum""order_byparentpartitionspathlibperform_hashpopprev_blockprev_hashprevious_hashprintprint_blocks_print_key_value_pairpy_blockpy_bytespy_bytes_rehashed__pyx_state__pyx_vtable____qualname____reduce____reduce_cython____reduce_ex____repr__resresolveresultsavescalarselectselfserialize_dictserialize_resserialize_size__set_name__setdefault__setstate____setstate_cython__sqlsqlalchemystmt__test__timestampvalidatevalues0000000000000000000000000000000000000000000000000000000000000000\200A\360\n\000\t\n\330\014\025\220^\2401\240D\250\t\260\021\260!\330\014\017\210w\220c\230\021\330\020\021\330\014\020\220\007\220x\230u\240A\240V\2502\250]\270$\270b\300\007\300q\310\001\340\014\020\220\001\220\021\340\010\017\210t\2201\200A\330\010\023\2201\340\010\020\220\001\220\033\230D\240\007\240q\330\010\020\220\001\220\037\240\004\240G\2501\330\010\020\220\001\220\033\230D\240\007\240q\330\010\020\220\001\320\021$\240D\250\001\330\010\020\220\001\220\032\2304\230q\330\010\020\220\001\220\032\2304\230q\340\010\017\210q\200A\330\010\013\2104\210q\330\014\022\220,\230a\330\021\022\360\010\000\t\036\230Y\240g\250Q\250a\330\010\037\230t\240:\250Q\250a\340\010\034\230I\240Q\330\014\020\220\001\330\014%\240Q\330\014\r\330\014\r\330\014\r\330\014\016\210g\220Q\220a\340\010\027\220t\230:\240Q\240a\330\010\013\2104\210s\220!\330\014\022\220,\230a\230q\330\010\014\320\014\035\230Q\200A\330\010\013\2104\210q\330\014\022\220,\230a\230q\340\r\021\220\030\230\030\240\026\240q\330\014\022\220#\220X\230Q\230c\240\027\250\001\250\022\2508\2609\270A\270R\270w\300b\310\006\310d\320RS\340\010\014\210I\220S\230\013\2401\240A\330\014\020\320\020 \240\001\240\021\340\010\014\210K\220q\200A\330\010\013\2104\210r\220\022\2203\220d\230\"\230D\240\001\330\014\022\220*\230A\230Q\340\010\034\230D\240\014\250A\250Q\330\010\013\2106\220\023\220A\330\014\022\220*\230A\230Q\330\010\026\220i\230q\240\r\250Q\200A\360\022\000\t\014\2104\210t\2201\330\014\022\220,\230a\230q\330\010\013\2104\210z\230\021\230&\240\001\330\014""\022\220)\2301\230A\340\010\023\2204\220z\240\021\240!\330\010\025\220T\230\034\240Q\240d\250!\330\010\024\220J\230a\330\010\022\220$\220h\230b\240\001\340\010\034\230I\240Q\330\014\r\330\014%\240Q\330\014\r\330\014\r\330\014\r\330\014\016\210g\220Q\220a\340\010\027\220t\230:\240Q\240a\330\010\013\2104\210s\220!\330\014\022\220,\230a\230q\340\010\017\210t\2201\200A\330\010\014\210H\220H\230A\200A\360\010\000\t\n\330\014\034\320\034-\250Q\250d\260)\2701\270A\330\014\023\220=\240\002\240!\340\014\020\220\001\220\021\200A\330\010%\240T\250\033\260F\270!\340\010\016\210c\220\023\220D\230\013\2404\240q\330\014\021\220\021\220,\230c\240\021\330\014\024\220L\240\003\2401\330\014\036\230i\240q\250\001\330\014\021\220\021\220!\330\014\031\230\021\230!\200A\360\006\000\r\037\230a\330\014\033\2301\340\010\013\2108\2203\220a\330\014\022\220*\230A\230Q\340\010\014\210G\2205\230\001\230\024\230W\240A\240R\240u\250A\330\014\024\220D\230\007\230q\240\002\240!\2401\330\014\036\230i\240q\250\001\330\014\021\220\021\220!\330\014\023\2201\330\014\017\210t\2203\220a\330\020\021\200A\330\010\022\220!\360\006\000\r\027\220a\360\006\000\t\014\2108\2203\220a\330\014\030\230\001\340\014\027\220q\340\010\014\210G\2205\230\001\230\024\230W\240A\240R\240u\250A\330\014\017\210t\2203\220a\330\020\021\330\014\024\220D\230\007\230q\240\002\240!\2401\330\014\027\220q\330\014\024\220A\220[\240\005\240Q\330\014\024\220A\220_\240E\250\021\330\014\024\220A\220[\240\005\240Q\330\014\024\220A\320\025(\250\005\250Z\260w\270a\270q\330\014\024\220A\220Z\230u\240E\250\027\260\001\260\021\330\014\024\220A\220Z\230u\240E\250\027\260\001\260\021\330\014\023\2207\230!\2301\340\010\017\210q\200A\360\006\000\r!\240\001\330\014\026\220a\360\010\000\t\r\210G\2205\230\001\230\024\230W\240A\240R\240u\250A\330\014\024\220D\230\007\230q\240\002\240!\2401\330\014\027\220u\230H\240A\240U\250%\250w\260a\260q\330\014\025\220^\2401\240G\2501\250A\330\014 \240\005\240Q\240f\250B\250a\330\014\020\220\001\220\021\330\014\017""\210y\230\003\2301\330\020\025\220Q\220h\230a\230q\330\020\027\220q\330\014\017\210{\230'\240\021\330\020\023\220:\230V\2403\240e\2501\330\024\031\230\021\330\031!\240\021\240!\360\006\000\025\034\2301\330\014\031\230\021\340\010\017\210q\200A\360\006\000\t\020\210s\220'\230\021\230#\230U\240$\240a\240r\250\027\260\002\260!\330\r\021\220\030\230\030\240\026\240q\330\014\025\220T\230\030\240\021\240!\330\014\030\230\006\230g\240Q\340\010\022\220$\320\026)\250\021\250!\330\010\013\2104\210q\330\014\r\340\r\021\220\030\230\026\230v\240Q\330\014\017\210x\220q\230\003\2307\240!\2402\240Z\250q\200\001\330\004\n\210+\220Q"; PyObject *data = NULL; CYTHON_UNUSED_VAR(__Pyx_DecompressString); #endif PyObject **stringtab = __pyx_mstate->__pyx_string_tab; Py_ssize_t pos = 0; - for (int i = 0; i < 172; i++) { + for (int i = 0; i < 173; i++) { Py_ssize_t bytes_length = index[i].length; PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL); if (likely(string) && i >= 36) PyUnicode_InternInPlace(&string); @@ -13670,7 +13729,7 @@ const char* const bytes = "Blockchain already has a genesis block. Either it was stringtab[i] = string; pos += bytes_length; } - for (int i = 172; i < 188; i++) { + for (int i = 173; i < 189; i++) { Py_ssize_t bytes_length = index[i].length; PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length); stringtab[i] = string; @@ -13681,14 +13740,14 @@ const char* const bytes = "Blockchain already has a genesis block. Either it was } } Py_XDECREF(data); - for (Py_ssize_t i = 0; i < 188; i++) { + for (Py_ssize_t i = 0; i < 189; i++) { if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { __PYX_ERR(0, 1, __pyx_L1_error) } } #if CYTHON_IMMORTAL_CONSTANTS { - PyObject **table = stringtab + 172; + PyObject **table = stringtab + 173; for (Py_ssize_t i=0; i<16; ++i) { #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); @@ -13772,52 +13831,52 @@ static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) { __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 457}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 459}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_it, __pyx_mstate->__pyx_n_u_block, __pyx_mstate->__pyx_n_u_py_block}; __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_pollublock_blockchain_b, __pyx_mstate->__pyx_n_u_print_key_value_pair, __pyx_mstate->__pyx_kp_b_iso88591_A_T_F_c_D_4q_c_L_1_iq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 467}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 469}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_max_num, __pyx_mstate->__pyx_n_u_block, __pyx_mstate->__pyx_n_u_max_nummber, __pyx_mstate->__pyx_n_u_idx, __pyx_mstate->__pyx_n_u_num, __pyx_mstate->__pyx_n_u_py_block}; __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_pollublock_blockchain_b, __pyx_mstate->__pyx_n_u_print_blocks, __pyx_mstate->__pyx_kp_b_iso88591_A_a_1_83a_AQ_G5_WARuA_D_q_1_iq_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 484}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 486}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_idx, __pyx_mstate->__pyx_n_u_block}; __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_pollublock_blockchain_b, __pyx_mstate->__pyx_n_u_get_block, __pyx_mstate->__pyx_kp_b_iso88591_A_4r_3d_D_AQ_D_AQ_6_A_AQ_iq_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 493}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 495}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_genesis_prev_hash, __pyx_mstate->__pyx_n_u_data_str, __pyx_mstate->__pyx_n_u_block, __pyx_mstate->__pyx_n_u_res}; __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_pollublock_blockchain_b, __pyx_mstate->__pyx_n_u_create_genesis_block, __pyx_mstate->__pyx_kp_b_iso88591_A_4q_a_YgQa_t_Qa_IQ_Q_gQa_t_Qa_4, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 516}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 518}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_data, __pyx_mstate->__pyx_n_u_prev_block, __pyx_mstate->__pyx_n_u_prev_hash, __pyx_mstate->__pyx_n_u_new_idx, __pyx_mstate->__pyx_n_u_data_str, __pyx_mstate->__pyx_n_u_data_digest, __pyx_mstate->__pyx_n_u_digest_size, __pyx_mstate->__pyx_n_u_block, __pyx_mstate->__pyx_n_u_res}; __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_pollublock_blockchain_b, __pyx_mstate->__pyx_n_u_new_block, __pyx_mstate->__pyx_kp_b_iso88591_A_4t1_aq_4z_1A_4z_T_Qd_Ja_hb_IQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 547}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 551}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_block, __pyx_mstate->__pyx_n_u_prev_block, __pyx_mstate->__pyx_n_u_idx, __pyx_mstate->__pyx_n_u_digest, __pyx_mstate->__pyx_n_u_digest_size, __pyx_mstate->__pyx_n_u_py_bytes, __pyx_mstate->__pyx_n_u_py_bytes_rehashed}; __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_pollublock_blockchain_b, __pyx_mstate->__pyx_n_u_validate, __pyx_mstate->__pyx_kp_b_iso88591_A_a_G5_WARuA_D_q_1_uHAU_waq_1G1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 575}; - PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_max_idx, __pyx_mstate->__pyx_n_u_entries, __pyx_mstate->__pyx_n_u_block, __pyx_mstate->__pyx_n_u_idx, __pyx_mstate->__pyx_n_u_max_idx_2, __pyx_mstate->__pyx_n_u_contents}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 579}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_min_idx, __pyx_mstate->__pyx_n_u_entries, __pyx_mstate->__pyx_n_u_block, __pyx_mstate->__pyx_n_u_idx, __pyx_mstate->__pyx_n_u_min_idx_2, __pyx_mstate->__pyx_n_u_contents}; __pyx_mstate_global->__pyx_codeobj_tab[11] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_pollublock_blockchain_b, __pyx_mstate->__pyx_n_u_get_saving_entries, __pyx_mstate->__pyx_kp_b_iso88591_A_a_83a_q_G5_WARuA_t3a_D_q_1_q_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[11])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 602}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 606}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_stmt, __pyx_mstate->__pyx_n_u_conn, __pyx_mstate->__pyx_n_u_result, __pyx_mstate->__pyx_n_u_max_value, __pyx_mstate->__pyx_n_u_entries, __pyx_mstate->__pyx_n_u_con}; __pyx_mstate_global->__pyx_codeobj_tab[12] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_pollublock_blockchain_b, __pyx_mstate->__pyx_n_u_save, __pyx_mstate->__pyx_kp_b_iso88591_A_s_U_ar_q_T_gQ_4q_vQ_xq_7_2Zq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[12])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 617}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 621}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[13] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_pollublock_blockchain_b, __pyx_mstate->__pyx_n_u_close_db_connections, __pyx_mstate->__pyx_kp_b_iso88591_A_HHA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[13])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 620}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 624}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_batch_size, __pyx_mstate->__pyx_n_u_con, __pyx_mstate->__pyx_n_u_res, __pyx_mstate->__pyx_n_u_batch}; __pyx_mstate_global->__pyx_codeobj_tab[14] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_dopt_pollublock_blockchain_b, __pyx_mstate->__pyx_n_u_load, __pyx_mstate->__pyx_kp_b_iso88591_A_4q_aq_q_XQc_89ARwb_dRS_IS_1A_K, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[14])) goto bad; } diff --git a/src/dopt_pollublock_blockchain/blockchain.pyx b/src/dopt_pollublock_blockchain/blockchain.pyx index 50f9840..f5886ea 100644 --- a/src/dopt_pollublock_blockchain/blockchain.pyx +++ b/src/dopt_pollublock_blockchain/blockchain.pyx @@ -431,7 +431,10 @@ cdef class Blockchain: # // Python public API def __len__(self): - return self._index + 1 + if self.genesis_done: + return self._index + 1 + else: + return 0 @property def difficulty(self): diff --git a/src/dopt_pollublock_blockchain/constants.py b/src/dopt_pollublock_blockchain/constants.py new file mode 100644 index 0000000..12c32bc --- /dev/null +++ b/src/dopt_pollublock_blockchain/constants.py @@ -0,0 +1,5 @@ +from __future__ import annotations + +from typing import Final + +BLOCKCHAIN_DIFFICULTY: Final[int] = 24 diff --git a/src/dopt_pollublock_blockchain/db.py b/src/dopt_pollublock_blockchain/db.py index 6f23d1c..712d222 100644 --- a/src/dopt_pollublock_blockchain/db.py +++ b/src/dopt_pollublock_blockchain/db.py @@ -1,8 +1,10 @@ from __future__ import annotations +import polars as pl import sqlalchemy as sql metadata_blockchain: sql.MetaData = sql.MetaData() +metadata_sensor_data: sql.MetaData = sql.MetaData() blocks = sql.Table( "blocks", @@ -14,3 +16,23 @@ blocks = sql.Table( sql.Column("hash", sql.String(64), nullable=False), sql.Column("data", sql.String(64), nullable=False), ) + +sensor_data = sql.Table( + "sensor_data", + metadata_sensor_data, + sql.Column("Index", sql.Integer, primary_key=True, autoincrement=True), + sql.Column("Datetime", sql.DateTime, nullable=False), + sql.Column("Temperature_(Celsius)", sql.Float, nullable=False), + sql.Column("Pressure_(Pa)", sql.Integer, nullable=False), + sql.Column("Air_Quantity_(Percent)", sql.Float, nullable=False), + sql.Column("Blockchain_Block_Number", sql.BigInteger, nullable=True), +) + +sensor_data_query_schema: dict[str, type[pl.DataType]] = { + "Index": pl.UInt64, + "Datetime": pl.Datetime, + "Temperature_(Celsius)": pl.Float32, + "Pressure_(Pa)": pl.Int32, + "Air_Quantity_(Percent)": pl.Float64, + "Blockchain_Block_Number": pl.UInt64, +}