From 61753f03d81c25283b29ab21766a256b488cd616 Mon Sep 17 00:00:00 2001 From: foefl Date: Fri, 12 Dec 2025 08:24:15 +0100 Subject: [PATCH] prepare hashing --- src/polluck_blockchain/placeholder_native.cpp | 1460 +++++++++++------ src/polluck_blockchain/placeholder_native.pyx | 29 +- 2 files changed, 1025 insertions(+), 464 deletions(-) diff --git a/src/polluck_blockchain/placeholder_native.cpp b/src/polluck_blockchain/placeholder_native.cpp index ee34eed..271d6ec 100644 --- a/src/polluck_blockchain/placeholder_native.cpp +++ b/src/polluck_blockchain/placeholder_native.cpp @@ -1553,8 +1553,8 @@ static const char* const __pyx_f[] = { /* #### Code section: numeric_typedefs ### */ -/* "polluck_blockchain/placeholder_native.pyx":21 - * from libc.stdint cimport uint64_t +/* "polluck_blockchain/placeholder_native.pyx":22 + * from cython.operator import postincrement, dereference * * ctypedef unsigned long ULong # <<<<<<<<<<<<<< * ctypedef unordered_map[uint64_t, Block*] BcHashmap @@ -1569,7 +1569,7 @@ struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock; struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain; struct __pyx_opt_args_18polluck_blockchain_18placeholder_native_7PyBlock_from_ptr; -/* "polluck_blockchain/placeholder_native.pyx":22 +/* "polluck_blockchain/placeholder_native.pyx":23 * * ctypedef unsigned long ULong * ctypedef unordered_map[uint64_t, Block*] BcHashmap # <<<<<<<<<<<<<< @@ -1578,7 +1578,7 @@ struct __pyx_opt_args_18polluck_blockchain_18placeholder_native_7PyBlock_from_pt */ typedef std::unordered_map __pyx_t_18polluck_blockchain_18placeholder_native_BcHashmap; -/* "polluck_blockchain/placeholder_native.pyx":81 +/* "polluck_blockchain/placeholder_native.pyx":82 * * @staticmethod * cdef PyBlock from_ptr(Block *block, bint owner=False): # <<<<<<<<<<<<<< @@ -1590,7 +1590,7 @@ struct __pyx_opt_args_18polluck_blockchain_18placeholder_native_7PyBlock_from_pt int owner; }; -/* "polluck_blockchain/placeholder_native.pyx":32 +/* "polluck_blockchain/placeholder_native.pyx":33 * * * cdef class PyBlock: # <<<<<<<<<<<<<< @@ -1605,7 +1605,7 @@ struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock { }; -/* "polluck_blockchain/placeholder_native.pyx":150 +/* "polluck_blockchain/placeholder_native.pyx":157 * * * cdef class Blockchain: # <<<<<<<<<<<<<< @@ -1623,7 +1623,7 @@ struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain { -/* "polluck_blockchain/placeholder_native.pyx":32 +/* "polluck_blockchain/placeholder_native.pyx":33 * * * cdef class PyBlock: # <<<<<<<<<<<<<< @@ -1637,7 +1637,7 @@ struct __pyx_vtabstruct_18polluck_blockchain_18placeholder_native_PyBlock { static struct __pyx_vtabstruct_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_vtabptr_18polluck_blockchain_18placeholder_native_PyBlock; -/* "polluck_blockchain/placeholder_native.pyx":150 +/* "polluck_blockchain/placeholder_native.pyx":157 * * * cdef class Blockchain: # <<<<<<<<<<<<<< @@ -1787,7 +1787,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject /* PyObjectGetAttrStrNoError.proto (used by GetBuiltinName) */ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); -/* GetBuiltinName.proto (used by GetModuleGlobalName) */ +/* GetBuiltinName.proto */ static PyObject *__Pyx_GetBuiltinName(PyObject *name); /* PyDictVersioning.proto (used by GetModuleGlobalName) */ @@ -2046,6 +2046,27 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject /* KeywordStringCheck.proto */ static CYTHON_INLINE int __Pyx_CheckKeywordStrings(const char* function_name, PyObject *kw); +/* PyObjectFormatSimple.proto */ +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + PyObject_Format(s, f)) +#elif CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_repr(s) :\ + likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_repr(s) :\ + PyObject_Format(s, f)) +#else + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + PyObject_Format(s, f)) +#endif + +/* JoinPyUnicode.export */ +static PyObject* __Pyx_PyUnicode_Join(PyObject** values, Py_ssize_t value_count, Py_ssize_t result_ulength, + Py_UCS4 max_char); + /* IncludeCppStringH.proto (used by decode_cpp_string) */ #include @@ -2087,9 +2108,6 @@ static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds); /* PyIndexError_Check.proto */ #define __Pyx_PyExc_IndexError_Check(obj) __Pyx_TypeCheck(obj, PyExc_IndexError) -/* PyRuntimeError_Check.proto */ -#define __Pyx_PyExc_RuntimeError_Check(obj) __Pyx_TypeCheck(obj, PyExc_RuntimeError) - /* MoveIfSupported.proto */ #if CYTHON_USE_CPP_STD_MOVE #include @@ -2098,6 +2116,9 @@ static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds); #define __PYX_STD_MOVE_IF_SUPPORTED(x) x #endif +/* PyRuntimeError_Check.proto */ +#define __Pyx_PyExc_RuntimeError_Check(obj) __Pyx_TypeCheck(obj, PyExc_RuntimeError) + /* AllocateExtensionType.proto */ static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final); @@ -2547,30 +2568,34 @@ int __pyx_module_is_main_polluck_blockchain__placeholder_native = 0; /* Implementation of "polluck_blockchain.placeholder_native" */ /* #### Code section: global_var ### */ +static PyObject *__pyx_builtin_print; /* #### Code section: string_decls ### */ /* #### Code section: decls ### */ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock___cinit__(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_nonce, PyObject *__pyx_v_data, PyObject *__pyx_v_previous_hash, PyObject *__pyx_v_from_ptr); /* proto */ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_2__init__(CYTHON_UNUSED struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */ static void __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4__dealloc__(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_6__repr__(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_8__str__(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_5index___get__(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_9timestamp___get__(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4data___get__(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_9prev_hash___get__(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_5nonce___get__(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4hash___get__(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static int __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain___cinit__(struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self); /* proto */ static int __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_2__init__(CYTHON_UNUSED struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */ static void __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_4__dealloc__(struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self); /* proto */ static Py_ssize_t __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_6__len__(struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_8print_key_value_pair(struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_12genesis_done___get__(struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_5index___get__(struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_8get_block(struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self, PyObject *__pyx_v_idx); /* proto */ -static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_10create_genesis_block(struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_12new_block(struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self, PyObject *__pyx_v_data); /* proto */ -static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_10get_block(struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self, PyObject *__pyx_v_idx); /* proto */ +static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_12create_genesis_block(struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_14new_block(struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self, PyObject *__pyx_v_data); /* proto */ +static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_16__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_18__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_tp_new_18polluck_blockchain_18placeholder_native_PyBlock(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_18polluck_blockchain_18placeholder_native_Blockchain(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ /* #### Code section: late_includes ### */ @@ -2601,8 +2626,8 @@ typedef struct { __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop; __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values; PyObject *__pyx_tuple[1]; - PyObject *__pyx_codeobj_tab[7]; - PyObject *__pyx_string_tab[80]; + PyObject *__pyx_codeobj_tab[8]; + PyObject *__pyx_string_tab[89]; PyObject *__pyx_number_tab[4]; /* #### Code section: module_state_contents ### */ /* CommonTypesMetaclass.module_state_decls */ @@ -2648,82 +2673,91 @@ static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_stati #define __pyx_kp_u_Could_not_allocate_hasmap __pyx_string_tab[1] #define __pyx_kp_u_Create_a_genesis_block_first __pyx_string_tab[2] #define __pyx_kp_u_Index_value_is_out_of_bounds __pyx_string_tab[3] -#define __pyx_kp_u_UTF_8 __pyx_string_tab[4] -#define __pyx_kp_u__2 __pyx_string_tab[5] -#define __pyx_kp_u_d __pyx_string_tab[6] -#define __pyx_kp_u_disable __pyx_string_tab[7] -#define __pyx_kp_u_enable __pyx_string_tab[8] -#define __pyx_kp_u_gc __pyx_string_tab[9] -#define __pyx_kp_u_isenabled __pyx_string_tab[10] -#define __pyx_kp_u_no_default___reduce___due_to_non __pyx_string_tab[11] -#define __pyx_kp_u_src_polluck_blockchain_placehold __pyx_string_tab[12] -#define __pyx_kp_u_stringsource __pyx_string_tab[13] -#define __pyx_n_u_Blockchain __pyx_string_tab[14] -#define __pyx_n_u_Blockchain___reduce_cython __pyx_string_tab[15] -#define __pyx_n_u_Blockchain___setstate_cython __pyx_string_tab[16] -#define __pyx_n_u_Blockchain_create_genesis_block __pyx_string_tab[17] -#define __pyx_n_u_Blockchain_get_block __pyx_string_tab[18] -#define __pyx_n_u_Blockchain_new_block __pyx_string_tab[19] -#define __pyx_n_u_PyBlock __pyx_string_tab[20] -#define __pyx_n_u_PyBlock___reduce_cython __pyx_string_tab[21] -#define __pyx_n_u_PyBlock___setstate_cython __pyx_string_tab[22] -#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[23] -#define __pyx_n_u_TIMEZONE_UTC __pyx_string_tab[24] -#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[25] -#define __pyx_n_u_block __pyx_string_tab[26] -#define __pyx_n_u_cline_in_traceback __pyx_string_tab[27] -#define __pyx_n_u_create_genesis_block __pyx_string_tab[28] -#define __pyx_n_u_data __pyx_string_tab[29] -#define __pyx_n_u_datetime __pyx_string_tab[30] -#define __pyx_n_u_dopt_basics __pyx_string_tab[31] -#define __pyx_n_u_dopt_basics_datetime __pyx_string_tab[32] -#define __pyx_n_u_encode __pyx_string_tab[33] -#define __pyx_n_u_from_ptr __pyx_string_tab[34] -#define __pyx_n_u_fromtimestamp __pyx_string_tab[35] -#define __pyx_n_u_func __pyx_string_tab[36] -#define __pyx_n_u_get_block __pyx_string_tab[37] -#define __pyx_n_u_getstate __pyx_string_tab[38] -#define __pyx_n_u_hashlib __pyx_string_tab[39] -#define __pyx_n_u_idx __pyx_string_tab[40] -#define __pyx_n_u_index __pyx_string_tab[41] -#define __pyx_n_u_is_coroutine __pyx_string_tab[42] -#define __pyx_n_u_items __pyx_string_tab[43] -#define __pyx_n_u_main __pyx_string_tab[44] -#define __pyx_n_u_module __pyx_string_tab[45] -#define __pyx_n_u_name __pyx_string_tab[46] -#define __pyx_n_u_new_block __pyx_string_tab[47] -#define __pyx_n_u_new_idx __pyx_string_tab[48] -#define __pyx_n_u_nonce __pyx_string_tab[49] -#define __pyx_n_u_pack __pyx_string_tab[50] -#define __pyx_n_u_polluck_blockchain_placeholder_n __pyx_string_tab[51] -#define __pyx_n_u_pop __pyx_string_tab[52] -#define __pyx_n_u_prev_block __pyx_string_tab[53] -#define __pyx_n_u_prev_hash __pyx_string_tab[54] -#define __pyx_n_u_previous_hash __pyx_string_tab[55] -#define __pyx_n_u_pyx_state __pyx_string_tab[56] -#define __pyx_n_u_pyx_vtable __pyx_string_tab[57] -#define __pyx_n_u_qualname __pyx_string_tab[58] -#define __pyx_n_u_reduce __pyx_string_tab[59] -#define __pyx_n_u_reduce_cython __pyx_string_tab[60] -#define __pyx_n_u_reduce_ex __pyx_string_tab[61] -#define __pyx_n_u_self __pyx_string_tab[62] -#define __pyx_n_u_set_name __pyx_string_tab[63] -#define __pyx_n_u_setdefault __pyx_string_tab[64] -#define __pyx_n_u_setstate __pyx_string_tab[65] -#define __pyx_n_u_setstate_cython __pyx_string_tab[66] -#define __pyx_n_u_struct __pyx_string_tab[67] -#define __pyx_n_u_test __pyx_string_tab[68] -#define __pyx_n_u_time __pyx_string_tab[69] -#define __pyx_n_u_timestamp __pyx_string_tab[70] -#define __pyx_n_u_values __pyx_string_tab[71] -#define __pyx_kp_b_ __pyx_string_tab[72] -#define __pyx_kp_b_0 __pyx_string_tab[73] -#define __pyx_kp_b_Genesis_Block __pyx_string_tab[74] -#define __pyx_kp_b_dummy_hash __pyx_string_tab[75] -#define __pyx_kp_b_iso88591_A_4r_3d_D_AQ_D_AQ_iq_Q __pyx_string_tab[76] -#define __pyx_kp_b_iso88591_A_4t1_aq_a_HBa_IQ_IQfD_4s_Ja_q_g __pyx_string_tab[77] -#define __pyx_kp_b_iso88591_A_IQ_IQfD_4s_Ja_7_1_waq_gQa_XX_J __pyx_string_tab[78] -#define __pyx_kp_b_iso88591_Q __pyx_string_tab[79] +#define __pyx_kp_u_PyBlock __pyx_string_tab[4] +#define __pyx_kp_u_UTF_8 __pyx_string_tab[5] +#define __pyx_kp_u__2 __pyx_string_tab[6] +#define __pyx_kp_u__3 __pyx_string_tab[7] +#define __pyx_kp_u_d __pyx_string_tab[8] +#define __pyx_kp_u_disable __pyx_string_tab[9] +#define __pyx_kp_u_enable __pyx_string_tab[10] +#define __pyx_kp_u_gc __pyx_string_tab[11] +#define __pyx_kp_u_isenabled __pyx_string_tab[12] +#define __pyx_kp_u_no_default___reduce___due_to_non __pyx_string_tab[13] +#define __pyx_kp_u_src_polluck_blockchain_placehold __pyx_string_tab[14] +#define __pyx_kp_u_stringsource __pyx_string_tab[15] +#define __pyx_n_u_Blockchain __pyx_string_tab[16] +#define __pyx_n_u_Blockchain___reduce_cython __pyx_string_tab[17] +#define __pyx_n_u_Blockchain___setstate_cython __pyx_string_tab[18] +#define __pyx_n_u_Blockchain_create_genesis_block __pyx_string_tab[19] +#define __pyx_n_u_Blockchain_get_block __pyx_string_tab[20] +#define __pyx_n_u_Blockchain_new_block __pyx_string_tab[21] +#define __pyx_n_u_Blockchain_print_key_value_pair __pyx_string_tab[22] +#define __pyx_n_u_PyBlock_2 __pyx_string_tab[23] +#define __pyx_n_u_PyBlock___reduce_cython __pyx_string_tab[24] +#define __pyx_n_u_PyBlock___setstate_cython __pyx_string_tab[25] +#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[26] +#define __pyx_n_u_TIMEZONE_UTC __pyx_string_tab[27] +#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[28] +#define __pyx_n_u_block __pyx_string_tab[29] +#define __pyx_n_u_cline_in_traceback __pyx_string_tab[30] +#define __pyx_n_u_create_genesis_block __pyx_string_tab[31] +#define __pyx_n_u_data __pyx_string_tab[32] +#define __pyx_n_u_datetime __pyx_string_tab[33] +#define __pyx_n_u_dopt_basics __pyx_string_tab[34] +#define __pyx_n_u_dopt_basics_datetime __pyx_string_tab[35] +#define __pyx_n_u_encode __pyx_string_tab[36] +#define __pyx_n_u_from_ptr __pyx_string_tab[37] +#define __pyx_n_u_fromtimestamp __pyx_string_tab[38] +#define __pyx_n_u_func __pyx_string_tab[39] +#define __pyx_n_u_get_block __pyx_string_tab[40] +#define __pyx_n_u_getstate __pyx_string_tab[41] +#define __pyx_n_u_hashlib __pyx_string_tab[42] +#define __pyx_n_u_idx __pyx_string_tab[43] +#define __pyx_n_u_index __pyx_string_tab[44] +#define __pyx_n_u_is_coroutine __pyx_string_tab[45] +#define __pyx_n_u_it __pyx_string_tab[46] +#define __pyx_n_u_items __pyx_string_tab[47] +#define __pyx_n_u_main __pyx_string_tab[48] +#define __pyx_n_u_module __pyx_string_tab[49] +#define __pyx_n_u_name __pyx_string_tab[50] +#define __pyx_n_u_new_block __pyx_string_tab[51] +#define __pyx_n_u_new_idx __pyx_string_tab[52] +#define __pyx_n_u_nonce __pyx_string_tab[53] +#define __pyx_n_u_pack __pyx_string_tab[54] +#define __pyx_n_u_polluck_blockchain_placeholder_n __pyx_string_tab[55] +#define __pyx_n_u_pop __pyx_string_tab[56] +#define __pyx_n_u_prev_block __pyx_string_tab[57] +#define __pyx_n_u_prev_hash __pyx_string_tab[58] +#define __pyx_n_u_previous_hash __pyx_string_tab[59] +#define __pyx_n_u_print __pyx_string_tab[60] +#define __pyx_n_u_print_key_value_pair __pyx_string_tab[61] +#define __pyx_n_u_py_block __pyx_string_tab[62] +#define __pyx_n_u_pyx_state __pyx_string_tab[63] +#define __pyx_n_u_pyx_vtable __pyx_string_tab[64] +#define __pyx_n_u_qualname __pyx_string_tab[65] +#define __pyx_n_u_reduce __pyx_string_tab[66] +#define __pyx_n_u_reduce_cython __pyx_string_tab[67] +#define __pyx_n_u_reduce_ex __pyx_string_tab[68] +#define __pyx_n_u_repr __pyx_string_tab[69] +#define __pyx_n_u_self __pyx_string_tab[70] +#define __pyx_n_u_set_name __pyx_string_tab[71] +#define __pyx_n_u_setdefault __pyx_string_tab[72] +#define __pyx_n_u_setstate __pyx_string_tab[73] +#define __pyx_n_u_setstate_cython __pyx_string_tab[74] +#define __pyx_n_u_struct __pyx_string_tab[75] +#define __pyx_n_u_test __pyx_string_tab[76] +#define __pyx_n_u_time __pyx_string_tab[77] +#define __pyx_n_u_timestamp __pyx_string_tab[78] +#define __pyx_n_u_values __pyx_string_tab[79] +#define __pyx_kp_b_ __pyx_string_tab[80] +#define __pyx_kp_b_0 __pyx_string_tab[81] +#define __pyx_kp_b_Genesis_Block __pyx_string_tab[82] +#define __pyx_kp_b_dummy_hash __pyx_string_tab[83] +#define __pyx_kp_b_iso88591_A_4r_3d_D_AQ_D_AQ_iq_Q __pyx_string_tab[84] +#define __pyx_kp_b_iso88591_A_4t1_aq_a_HBa_IQ_IQfD_4s_Ja_q_g __pyx_string_tab[85] +#define __pyx_kp_b_iso88591_A_IQ_IQfD_4s_Ja_7_1_waq_gQa_X_Ja __pyx_string_tab[86] +#define __pyx_kp_b_iso88591_A_T_a_c_D_t1_c_L_1_iq __pyx_string_tab[87] +#define __pyx_kp_b_iso88591_Q __pyx_string_tab[88] #define __pyx_int_0 __pyx_number_tab[0] #define __pyx_int_1 __pyx_number_tab[1] #define __pyx_int_12 __pyx_number_tab[2] @@ -2747,8 +2781,8 @@ static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain); Py_CLEAR(clear_module_state->__pyx_type_18polluck_blockchain_18placeholder_native_Blockchain); for (int i=0; i<1; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); } - for (int i=0; i<7; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } - for (int i=0; i<80; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } + for (int i=0; i<8; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<89; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } for (int i=0; i<4; ++i) { Py_CLEAR(clear_module_state->__pyx_number_tab[i]); } /* #### Code section: module_state_clear_contents ### */ /* CommonTypesMetaclass.module_state_clear */ @@ -2777,8 +2811,8 @@ static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void Py_VISIT(traverse_module_state->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain); Py_VISIT(traverse_module_state->__pyx_type_18polluck_blockchain_18placeholder_native_Blockchain); for (int i=0; i<1; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); } - for (int i=0; i<7; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } - for (int i=0; i<80; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } + for (int i=0; i<8; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<89; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } for (int i=0; i<4; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_number_tab[i]); } /* #### Code section: module_state_traverse_contents ### */ /* CommonTypesMetaclass.module_state_traverse */ @@ -3174,7 +3208,7 @@ static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_6libcpp_6s return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":24 +/* "polluck_blockchain/placeholder_native.pyx":25 * ctypedef unordered_map[uint64_t, Block*] BcHashmap * * cdef timestamp_to_datetime(double ts): # <<<<<<<<<<<<<< @@ -3197,7 +3231,7 @@ static PyObject *__pyx_f_18polluck_blockchain_18placeholder_native_timestamp_to_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("timestamp_to_datetime", 0); - /* "polluck_blockchain/placeholder_native.pyx":25 + /* "polluck_blockchain/placeholder_native.pyx":26 * * cdef timestamp_to_datetime(double ts): * return datetime.datetime.fromtimestamp(ts, dopt_basics.datetime.TIMEZONE_UTC) # <<<<<<<<<<<<<< @@ -3205,21 +3239,21 @@ static PyObject *__pyx_f_18polluck_blockchain_18placeholder_native_timestamp_to_ * */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 25, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_2 = __pyx_t_4; __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_ts); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 25, __pyx_L1_error) + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_ts); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_dopt_basics); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_dopt_basics); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 25, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_TIMEZONE_UTC); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 25, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_TIMEZONE_UTC); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_7 = 0; @@ -3230,14 +3264,14 @@ static PyObject *__pyx_f_18polluck_blockchain_18placeholder_native_timestamp_to_ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "polluck_blockchain/placeholder_native.pyx":24 + /* "polluck_blockchain/placeholder_native.pyx":25 * ctypedef unordered_map[uint64_t, Block*] BcHashmap * * cdef timestamp_to_datetime(double ts): # <<<<<<<<<<<<<< @@ -3261,7 +3295,7 @@ static PyObject *__pyx_f_18polluck_blockchain_18placeholder_native_timestamp_to_ return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":28 +/* "polluck_blockchain/placeholder_native.pyx":29 * * * cdef float_to_bytes(double num): # <<<<<<<<<<<<<< @@ -3282,7 +3316,7 @@ static PyObject *__pyx_f_18polluck_blockchain_18placeholder_native_float_to_byte int __pyx_clineno = 0; __Pyx_RefNannySetupContext("float_to_bytes", 0); - /* "polluck_blockchain/placeholder_native.pyx":29 + /* "polluck_blockchain/placeholder_native.pyx":30 * * cdef float_to_bytes(double num): * return struct.pack(">d", num) # <<<<<<<<<<<<<< @@ -3291,12 +3325,12 @@ static PyObject *__pyx_f_18polluck_blockchain_18placeholder_native_float_to_byte */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_struct); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 29, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_struct); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pack); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 29, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pack); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_num); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 29, __pyx_L1_error) + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_num); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = 1; #if CYTHON_UNPACK_METHODS @@ -3316,14 +3350,14 @@ static PyObject *__pyx_f_18polluck_blockchain_18placeholder_native_float_to_byte __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, 29, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "polluck_blockchain/placeholder_native.pyx":28 + /* "polluck_blockchain/placeholder_native.pyx":29 * * * cdef float_to_bytes(double num): # <<<<<<<<<<<<<< @@ -3345,7 +3379,7 @@ static PyObject *__pyx_f_18polluck_blockchain_18placeholder_native_float_to_byte return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":43 +/* "polluck_blockchain/placeholder_native.pyx":44 * bint ptr_owner * * def __cinit__(self, # <<<<<<<<<<<<<< @@ -3379,36 +3413,36 @@ static int __pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_1__cinit_ { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_index,&__pyx_mstate_global->__pyx_n_u_nonce,&__pyx_mstate_global->__pyx_n_u_data,&__pyx_mstate_global->__pyx_n_u_previous_hash,&__pyx_mstate_global->__pyx_n_u_from_ptr,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, 43, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 44, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 5: values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 43, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 44, __pyx_L3_error) CYTHON_FALLTHROUGH; case 4: values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 43, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 44, __pyx_L3_error) CYTHON_FALLTHROUGH; case 3: values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 43, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 44, __pyx_L3_error) CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 43, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 44, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 43, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 44, __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, "__cinit__", 0) < (0)) __PYX_ERR(0, 43, __pyx_L3_error) + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(0, 44, __pyx_L3_error) - /* "polluck_blockchain/placeholder_native.pyx":48 + /* "polluck_blockchain/placeholder_native.pyx":49 * data, * previous_hash, * from_ptr=False, # <<<<<<<<<<<<<< @@ -3417,23 +3451,23 @@ static int __pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_1__cinit_ */ if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_False)); for (Py_ssize_t i = __pyx_nargs; i < 4; i++) { - if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, i); __PYX_ERR(0, 43, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, i); __PYX_ERR(0, 44, __pyx_L3_error) } } } else { switch (__pyx_nargs) { case 5: values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 43, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 44, __pyx_L3_error) CYTHON_FALLTHROUGH; case 4: values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 43, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 44, __pyx_L3_error) values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 43, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 44, __pyx_L3_error) values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 43, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 44, __pyx_L3_error) values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 43, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 44, __pyx_L3_error) break; default: goto __pyx_L5_argtuple_error; } @@ -3447,7 +3481,7 @@ static int __pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_1__cinit_ } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, __pyx_nargs); __PYX_ERR(0, 43, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, __pyx_nargs); __PYX_ERR(0, 44, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3460,7 +3494,7 @@ static int __pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_1__cinit_ __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock___cinit__(((struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *)__pyx_v_self), __pyx_v_index, __pyx_v_nonce, __pyx_v_data, __pyx_v_previous_hash, __pyx_v_from_ptr); - /* "polluck_blockchain/placeholder_native.pyx":43 + /* "polluck_blockchain/placeholder_native.pyx":44 * bint ptr_owner * * def __cinit__(self, # <<<<<<<<<<<<<< @@ -3498,7 +3532,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock___cinit__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "polluck_blockchain/placeholder_native.pyx":50 + /* "polluck_blockchain/placeholder_native.pyx":51 * from_ptr=False, * ): * self.ptr_owner = False # <<<<<<<<<<<<<< @@ -3507,39 +3541,39 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock___cinit__ */ __pyx_v_self->ptr_owner = 0; - /* "polluck_blockchain/placeholder_native.pyx":51 + /* "polluck_blockchain/placeholder_native.pyx":52 * ): * self.ptr_owner = False * if not from_ptr: # <<<<<<<<<<<<<< * self.BlockC = new Block( * index, */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_from_ptr); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 51, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_from_ptr); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 52, __pyx_L1_error) __pyx_t_2 = (!__pyx_t_1); if (__pyx_t_2) { - /* "polluck_blockchain/placeholder_native.pyx":53 + /* "polluck_blockchain/placeholder_native.pyx":54 * if not from_ptr: * self.BlockC = new Block( * index, # <<<<<<<<<<<<<< * datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp(), * nonce, */ - __pyx_t_3 = __Pyx_PyLong_As_uint64_t(__pyx_v_index); if (unlikely((__pyx_t_3 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 53, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyLong_As_uint64_t(__pyx_v_index); if (unlikely((__pyx_t_3 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 54, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":54 + /* "polluck_blockchain/placeholder_native.pyx":55 * self.BlockC = new Block( * index, * datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp(), # <<<<<<<<<<<<<< * nonce, * data.encode("UTF-8"), */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 54, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_mstate_global->__pyx_tuple[0], NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 54, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_mstate_global->__pyx_tuple[0], NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_5 = __pyx_t_6; @@ -3550,22 +3584,22 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock___cinit__ __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_timestamp, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (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, 54, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } - __pyx_t_9 = __Pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 54, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "polluck_blockchain/placeholder_native.pyx":55 + /* "polluck_blockchain/placeholder_native.pyx":56 * index, * datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp(), * nonce, # <<<<<<<<<<<<<< * data.encode("UTF-8"), * previous_hash.encode("UTF-8"), */ - __pyx_t_10 = __Pyx_PyLong_As_uint64_t(__pyx_v_nonce); if (unlikely((__pyx_t_10 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 55, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyLong_As_uint64_t(__pyx_v_nonce); if (unlikely((__pyx_t_10 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 56, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":56 + /* "polluck_blockchain/placeholder_native.pyx":57 * datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp(), * nonce, * data.encode("UTF-8"), # <<<<<<<<<<<<<< @@ -3579,13 +3613,13 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock___cinit__ PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_UTF_8}; __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 56, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 57, __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, 56, __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, 57, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "polluck_blockchain/placeholder_native.pyx":57 + /* "polluck_blockchain/placeholder_native.pyx":58 * nonce, * data.encode("UTF-8"), * previous_hash.encode("UTF-8"), # <<<<<<<<<<<<<< @@ -3599,22 +3633,22 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock___cinit__ PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_UTF_8}; __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 57, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __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, 57, __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, 58, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "polluck_blockchain/placeholder_native.pyx":58 + /* "polluck_blockchain/placeholder_native.pyx":59 * data.encode("UTF-8"), * previous_hash.encode("UTF-8"), * "".encode("UTF-8"), # <<<<<<<<<<<<<< * ) * if self.BlockC == NULL: */ - __pyx_t_13 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_mstate_global->__pyx_kp_b_); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 58, __pyx_L1_error) + __pyx_t_13 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_mstate_global->__pyx_kp_b_); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":52 + /* "polluck_blockchain/placeholder_native.pyx":53 * self.ptr_owner = False * if not from_ptr: * self.BlockC = new Block( # <<<<<<<<<<<<<< @@ -3625,11 +3659,11 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock___cinit__ __pyx_t_14 = new ::Block(__pyx_t_3, __pyx_t_9, __pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 52, __pyx_L1_error) + __PYX_ERR(0, 53, __pyx_L1_error) } __pyx_v_self->BlockC = __pyx_t_14; - /* "polluck_blockchain/placeholder_native.pyx":60 + /* "polluck_blockchain/placeholder_native.pyx":61 * "".encode("UTF-8"), * ) * if self.BlockC == NULL: # <<<<<<<<<<<<<< @@ -3639,7 +3673,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock___cinit__ __pyx_t_2 = (__pyx_v_self->BlockC == NULL); if (unlikely(__pyx_t_2)) { - /* "polluck_blockchain/placeholder_native.pyx":61 + /* "polluck_blockchain/placeholder_native.pyx":62 * ) * if self.BlockC == NULL: * raise MemoryError("Allocation of block object failed") # <<<<<<<<<<<<<< @@ -3652,14 +3686,14 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock___cinit__ PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_Allocation_of_block_object_faile}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_MemoryError)), __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; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 61, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 62, __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, 61, __pyx_L1_error) + __PYX_ERR(0, 62, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":60 + /* "polluck_blockchain/placeholder_native.pyx":61 * "".encode("UTF-8"), * ) * if self.BlockC == NULL: # <<<<<<<<<<<<<< @@ -3668,7 +3702,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock___cinit__ */ } - /* "polluck_blockchain/placeholder_native.pyx":63 + /* "polluck_blockchain/placeholder_native.pyx":64 * raise MemoryError("Allocation of block object failed") * * self.ptr_owner = True # <<<<<<<<<<<<<< @@ -3677,7 +3711,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock___cinit__ */ __pyx_v_self->ptr_owner = 1; - /* "polluck_blockchain/placeholder_native.pyx":51 + /* "polluck_blockchain/placeholder_native.pyx":52 * ): * self.ptr_owner = False * if not from_ptr: # <<<<<<<<<<<<<< @@ -3686,7 +3720,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock___cinit__ */ } - /* "polluck_blockchain/placeholder_native.pyx":43 + /* "polluck_blockchain/placeholder_native.pyx":44 * bint ptr_owner * * def __cinit__(self, # <<<<<<<<<<<<<< @@ -3709,7 +3743,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock___cinit__ return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":65 +/* "polluck_blockchain/placeholder_native.pyx":66 * self.ptr_owner = True * * def __init__(self, *args, **kwargs): # <<<<<<<<<<<<<< @@ -3757,7 +3791,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_2__init__ return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":75 +/* "polluck_blockchain/placeholder_native.pyx":76 * # self._hash = "".encode("UTF-8") * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -3782,7 +3816,7 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4__deall int __pyx_t_1; int __pyx_t_2; - /* "polluck_blockchain/placeholder_native.pyx":76 + /* "polluck_blockchain/placeholder_native.pyx":77 * * def __dealloc__(self): * if self.BlockC is not NULL and self.ptr_owner is True: # <<<<<<<<<<<<<< @@ -3800,7 +3834,7 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4__deall __pyx_L4_bool_binop_done:; if (__pyx_t_1) { - /* "polluck_blockchain/placeholder_native.pyx":77 + /* "polluck_blockchain/placeholder_native.pyx":78 * def __dealloc__(self): * if self.BlockC is not NULL and self.ptr_owner is True: * del self.BlockC # <<<<<<<<<<<<<< @@ -3809,7 +3843,7 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4__deall */ delete __pyx_v_self->BlockC; - /* "polluck_blockchain/placeholder_native.pyx":78 + /* "polluck_blockchain/placeholder_native.pyx":79 * if self.BlockC is not NULL and self.ptr_owner is True: * del self.BlockC * self.BlockC = NULL # <<<<<<<<<<<<<< @@ -3818,7 +3852,7 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4__deall */ __pyx_v_self->BlockC = NULL; - /* "polluck_blockchain/placeholder_native.pyx":76 + /* "polluck_blockchain/placeholder_native.pyx":77 * * def __dealloc__(self): * if self.BlockC is not NULL and self.ptr_owner is True: # <<<<<<<<<<<<<< @@ -3827,7 +3861,7 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4__deall */ } - /* "polluck_blockchain/placeholder_native.pyx":75 + /* "polluck_blockchain/placeholder_native.pyx":76 * # self._hash = "".encode("UTF-8") * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -3838,7 +3872,7 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4__deall /* function exit code */ } -/* "polluck_blockchain/placeholder_native.pyx":80 +/* "polluck_blockchain/placeholder_native.pyx":81 * self.BlockC = NULL * * @staticmethod # <<<<<<<<<<<<<< @@ -3848,7 +3882,7 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4__deall static struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_f_18polluck_blockchain_18placeholder_native_7PyBlock_from_ptr(::Block *__pyx_v_block, struct __pyx_opt_args_18polluck_blockchain_18placeholder_native_7PyBlock_from_ptr *__pyx_optional_args) { - /* "polluck_blockchain/placeholder_native.pyx":81 + /* "polluck_blockchain/placeholder_native.pyx":82 * * @staticmethod * cdef PyBlock from_ptr(Block *block, bint owner=False): # <<<<<<<<<<<<<< @@ -3874,77 +3908,77 @@ static struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx } } - /* "polluck_blockchain/placeholder_native.pyx":84 + /* "polluck_blockchain/placeholder_native.pyx":85 * cdef PyBlock py_block = PyBlock.__new__( * PyBlock, * block.index, # <<<<<<<<<<<<<< * block.nonce, * block.data, */ - __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_block->index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_block->index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - /* "polluck_blockchain/placeholder_native.pyx":85 + /* "polluck_blockchain/placeholder_native.pyx":86 * PyBlock, * block.index, * block.nonce, # <<<<<<<<<<<<<< * block.data, * block.prev_hash, */ - __pyx_t_2 = __Pyx_PyLong_From_uint64_t(__pyx_v_block->nonce); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyLong_From_uint64_t(__pyx_v_block->nonce); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - /* "polluck_blockchain/placeholder_native.pyx":86 + /* "polluck_blockchain/placeholder_native.pyx":87 * block.index, * block.nonce, * block.data, # <<<<<<<<<<<<<< * block.prev_hash, * True, */ - __pyx_t_3 = __pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string(__pyx_v_block->data); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_3 = __pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string(__pyx_v_block->data); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - /* "polluck_blockchain/placeholder_native.pyx":87 + /* "polluck_blockchain/placeholder_native.pyx":88 * block.nonce, * block.data, * block.prev_hash, # <<<<<<<<<<<<<< * True, * ) */ - __pyx_t_4 = __pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string(__pyx_v_block->prev_hash); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_t_4 = __pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string(__pyx_v_block->prev_hash); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - /* "polluck_blockchain/placeholder_native.pyx":82 + /* "polluck_blockchain/placeholder_native.pyx":83 * @staticmethod * cdef PyBlock from_ptr(Block *block, bint owner=False): * cdef PyBlock py_block = PyBlock.__new__( # <<<<<<<<<<<<<< * PyBlock, * block.index, */ - __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 82, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_1); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 82, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 83, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_2); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 82, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 83, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_3); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 82, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 83, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_4); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4) != (0)) __PYX_ERR(0, 82, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4) != (0)) __PYX_ERR(0, 83, __pyx_L1_error); __Pyx_INCREF(Py_True); __Pyx_GIVEREF(Py_True); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 4, Py_True) != (0)) __PYX_ERR(0, 82, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 4, Py_True) != (0)) __PYX_ERR(0, 83, __pyx_L1_error); __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; - __pyx_t_4 = ((PyObject *)__pyx_tp_new_18polluck_blockchain_18placeholder_native_PyBlock(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_18polluck_blockchain_18placeholder_native_PyBlock), __pyx_t_5, NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error) + __pyx_t_4 = ((PyObject *)__pyx_tp_new_18polluck_blockchain_18placeholder_native_PyBlock(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_18polluck_blockchain_18placeholder_native_PyBlock), __pyx_t_5, NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF((PyObject *)__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_py_block = ((struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *)__pyx_t_4); __pyx_t_4 = 0; - /* "polluck_blockchain/placeholder_native.pyx":90 + /* "polluck_blockchain/placeholder_native.pyx":91 * True, * ) * py_block.BlockC = block # <<<<<<<<<<<<<< @@ -3953,7 +3987,7 @@ static struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx */ __pyx_v_py_block->BlockC = __pyx_v_block; - /* "polluck_blockchain/placeholder_native.pyx":91 + /* "polluck_blockchain/placeholder_native.pyx":92 * ) * py_block.BlockC = block * py_block.ptr_owner = owner # <<<<<<<<<<<<<< @@ -3962,19 +3996,19 @@ static struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx */ __pyx_v_py_block->ptr_owner = __pyx_v_owner; - /* "polluck_blockchain/placeholder_native.pyx":93 + /* "polluck_blockchain/placeholder_native.pyx":94 * py_block.ptr_owner = owner * * return py_block # <<<<<<<<<<<<<< * - * # cpdef _perform_hash(self): + * def __repr__(self): */ __Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_py_block); __pyx_r = __pyx_v_py_block; goto __pyx_L0; - /* "polluck_blockchain/placeholder_native.pyx":80 + /* "polluck_blockchain/placeholder_native.pyx":81 * self.BlockC = NULL * * @staticmethod # <<<<<<<<<<<<<< @@ -3998,7 +4032,187 @@ static struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":112 +/* "polluck_blockchain/placeholder_native.pyx":96 + * return py_block + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return f"PyBlock({self.index, self.timestamp, self.nonce, self.data})" + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_7__repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_7__repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_6__repr__(((struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_6__repr__(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6[3]; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "polluck_blockchain/placeholder_native.pyx":97 + * + * def __repr__(self): + * return f"PyBlock({self.index, self.timestamp, self.nonce, self.data})" # <<<<<<<<<<<<<< + * + * def __str__(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_timestamp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_nonce); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 97, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 97, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 97, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4) != (0)) __PYX_ERR(0, 97, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_PyBlock; + __pyx_t_6[1] = __pyx_t_4; + __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u__2; + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, 8 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4)); + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "polluck_blockchain/placeholder_native.pyx":96 + * return py_block + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return f"PyBlock({self.index, self.timestamp, self.nonce, self.data})" + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("polluck_blockchain.placeholder_native.PyBlock.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "polluck_blockchain/placeholder_native.pyx":99 + * return f"PyBlock({self.index, self.timestamp, self.nonce, self.data})" + * + * def __str__(self): # <<<<<<<<<<<<<< + * return self.__repr__() + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_9__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_9__str__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_8__str__(((struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_8__str__(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "polluck_blockchain/placeholder_native.pyx":100 + * + * def __str__(self): + * return self.__repr__() # <<<<<<<<<<<<<< + * + * # cpdef _perform_hash(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_repr, __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, 100, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "polluck_blockchain/placeholder_native.pyx":99 + * return f"PyBlock({self.index, self.timestamp, self.nonce, self.data})" + * + * def __str__(self): # <<<<<<<<<<<<<< + * return self.__repr__() + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("polluck_blockchain.placeholder_native.PyBlock.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "polluck_blockchain/placeholder_native.pyx":119 * * # Python public API * @property # <<<<<<<<<<<<<< @@ -4030,7 +4244,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_5in int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "polluck_blockchain/placeholder_native.pyx":114 + /* "polluck_blockchain/placeholder_native.pyx":121 * @property * def index(self): * return self.BlockC.index # <<<<<<<<<<<<<< @@ -4038,13 +4252,13 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_5in * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->BlockC->index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->BlockC->index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "polluck_blockchain/placeholder_native.pyx":112 + /* "polluck_blockchain/placeholder_native.pyx":119 * * # Python public API * @property # <<<<<<<<<<<<<< @@ -4063,7 +4277,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_5in return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":116 +/* "polluck_blockchain/placeholder_native.pyx":123 * return self.BlockC.index * * @property # <<<<<<<<<<<<<< @@ -4095,7 +4309,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_9ti int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "polluck_blockchain/placeholder_native.pyx":118 + /* "polluck_blockchain/placeholder_native.pyx":125 * @property * def timestamp(self): * return timestamp_to_datetime(self.BlockC.timestamp) # <<<<<<<<<<<<<< @@ -4103,13 +4317,13 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_9ti * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_18polluck_blockchain_18placeholder_native_timestamp_to_datetime(__pyx_v_self->BlockC->timestamp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_1 = __pyx_f_18polluck_blockchain_18placeholder_native_timestamp_to_datetime(__pyx_v_self->BlockC->timestamp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "polluck_blockchain/placeholder_native.pyx":116 + /* "polluck_blockchain/placeholder_native.pyx":123 * return self.BlockC.index * * @property # <<<<<<<<<<<<<< @@ -4128,7 +4342,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_9ti return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":120 +/* "polluck_blockchain/placeholder_native.pyx":127 * return timestamp_to_datetime(self.BlockC.timestamp) * * @property # <<<<<<<<<<<<<< @@ -4160,7 +4374,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4da int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "polluck_blockchain/placeholder_native.pyx":122 + /* "polluck_blockchain/placeholder_native.pyx":129 * @property * def data(self): * return self.BlockC.data.decode("UTF-8") # <<<<<<<<<<<<<< @@ -4168,13 +4382,13 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4da * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_decode_cpp_string(__pyx_v_self->BlockC->data, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error) + __pyx_t_1 = __Pyx_decode_cpp_string(__pyx_v_self->BlockC->data, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "polluck_blockchain/placeholder_native.pyx":120 + /* "polluck_blockchain/placeholder_native.pyx":127 * return timestamp_to_datetime(self.BlockC.timestamp) * * @property # <<<<<<<<<<<<<< @@ -4193,7 +4407,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4da return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":124 +/* "polluck_blockchain/placeholder_native.pyx":131 * return self.BlockC.data.decode("UTF-8") * * @property # <<<<<<<<<<<<<< @@ -4225,7 +4439,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_9pr int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "polluck_blockchain/placeholder_native.pyx":126 + /* "polluck_blockchain/placeholder_native.pyx":133 * @property * def prev_hash(self): * return self.BlockC.prev_hash.decode("UTF-8") # <<<<<<<<<<<<<< @@ -4233,13 +4447,13 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_9pr * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_decode_cpp_string(__pyx_v_self->BlockC->prev_hash, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error) + __pyx_t_1 = __Pyx_decode_cpp_string(__pyx_v_self->BlockC->prev_hash, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "polluck_blockchain/placeholder_native.pyx":124 + /* "polluck_blockchain/placeholder_native.pyx":131 * return self.BlockC.data.decode("UTF-8") * * @property # <<<<<<<<<<<<<< @@ -4258,7 +4472,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_9pr return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":128 +/* "polluck_blockchain/placeholder_native.pyx":135 * return self.BlockC.prev_hash.decode("UTF-8") * * @property # <<<<<<<<<<<<<< @@ -4290,7 +4504,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_5no int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "polluck_blockchain/placeholder_native.pyx":130 + /* "polluck_blockchain/placeholder_native.pyx":137 * @property * def nonce(self): * return self.BlockC.nonce # <<<<<<<<<<<<<< @@ -4298,13 +4512,13 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_5no * # @nonce.setter */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->BlockC->nonce); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->BlockC->nonce); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 137, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "polluck_blockchain/placeholder_native.pyx":128 + /* "polluck_blockchain/placeholder_native.pyx":135 * return self.BlockC.prev_hash.decode("UTF-8") * * @property # <<<<<<<<<<<<<< @@ -4323,7 +4537,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_5no return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":136 +/* "polluck_blockchain/placeholder_native.pyx":143 * # self._nonce = value * * @property # <<<<<<<<<<<<<< @@ -4355,7 +4569,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4ha int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "polluck_blockchain/placeholder_native.pyx":138 + /* "polluck_blockchain/placeholder_native.pyx":145 * @property * def hash(self): * return self.BlockC.hash.decode("UTF-8") # <<<<<<<<<<<<<< @@ -4363,13 +4577,13 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4ha * # @hash.setter */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_decode_cpp_string(__pyx_v_self->BlockC->hash, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error) + __pyx_t_1 = __Pyx_decode_cpp_string(__pyx_v_self->BlockC->hash, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "polluck_blockchain/placeholder_native.pyx":136 + /* "polluck_blockchain/placeholder_native.pyx":143 * # self._nonce = value * * @property # <<<<<<<<<<<<<< @@ -4395,15 +4609,15 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4ha */ /* Python wrapper */ -static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_7__reduce_cython__(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_11__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -static PyMethodDef __pyx_mdef_18polluck_blockchain_18placeholder_native_7PyBlock_7__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_7__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_7__reduce_cython__(PyObject *__pyx_v_self, +static PyMethodDef __pyx_mdef_18polluck_blockchain_18placeholder_native_7PyBlock_11__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_11__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_11__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -4429,14 +4643,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;} - __pyx_r = __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_6__reduce_cython__(((struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *)__pyx_v_self)); + __pyx_r = __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_10__reduce_cython__(((struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self) { +static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; @@ -4476,15 +4690,15 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_6__ */ /* Python wrapper */ -static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_9__setstate_cython__(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_13__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -static PyMethodDef __pyx_mdef_18polluck_blockchain_18placeholder_native_7PyBlock_9__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_9__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_9__setstate_cython__(PyObject *__pyx_v_self, +static PyMethodDef __pyx_mdef_18polluck_blockchain_18placeholder_native_7PyBlock_13__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_13__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_13__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -4550,7 +4764,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_8__setstate_cython__(((struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *)__pyx_v_self), __pyx_v___pyx_state); + __pyx_r = __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_12__setstate_cython__(((struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *)__pyx_v_self), __pyx_v___pyx_state); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { @@ -4560,7 +4774,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; @@ -4592,7 +4806,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_8__ return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":156 +/* "polluck_blockchain/placeholder_native.pyx":163 * cdef bint _genesis_done * * def __cinit__(self): # <<<<<<<<<<<<<< @@ -4638,7 +4852,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain___cin int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "polluck_blockchain/placeholder_native.pyx":157 + /* "polluck_blockchain/placeholder_native.pyx":164 * * def __cinit__(self): * self._difficulty = 1 # <<<<<<<<<<<<<< @@ -4647,7 +4861,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain___cin */ __pyx_v_self->_difficulty = 1; - /* "polluck_blockchain/placeholder_native.pyx":158 + /* "polluck_blockchain/placeholder_native.pyx":165 * def __cinit__(self): * self._difficulty = 1 * self._index = 0 # <<<<<<<<<<<<<< @@ -4656,7 +4870,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain___cin */ __pyx_v_self->_index = ((uint64_t)0); - /* "polluck_blockchain/placeholder_native.pyx":159 + /* "polluck_blockchain/placeholder_native.pyx":166 * self._difficulty = 1 * self._index = 0 * self._genesis_done = 0 # <<<<<<<<<<<<<< @@ -4665,7 +4879,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain___cin */ __pyx_v_self->_genesis_done = 0; - /* "polluck_blockchain/placeholder_native.pyx":160 + /* "polluck_blockchain/placeholder_native.pyx":167 * self._index = 0 * self._genesis_done = 0 * self._chain = new unordered_map[uint64_t, Block*]() # <<<<<<<<<<<<<< @@ -4676,11 +4890,11 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain___cin __pyx_t_1 = new std::unordered_map (); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 160, __pyx_L1_error) + __PYX_ERR(0, 167, __pyx_L1_error) } __pyx_v_self->_chain = __pyx_t_1; - /* "polluck_blockchain/placeholder_native.pyx":161 + /* "polluck_blockchain/placeholder_native.pyx":168 * self._genesis_done = 0 * self._chain = new unordered_map[uint64_t, Block*]() * if self._chain is NULL: # <<<<<<<<<<<<<< @@ -4690,7 +4904,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain___cin __pyx_t_2 = (__pyx_v_self->_chain == NULL); if (unlikely(__pyx_t_2)) { - /* "polluck_blockchain/placeholder_native.pyx":162 + /* "polluck_blockchain/placeholder_native.pyx":169 * self._chain = new unordered_map[uint64_t, Block*]() * if self._chain is NULL: * raise MemoryError("Could not allocate hasmap") # <<<<<<<<<<<<<< @@ -4703,14 +4917,14 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain___cin PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Could_not_allocate_hasmap}; __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_MemoryError)), __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, 162, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 169, __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, 162, __pyx_L1_error) + __PYX_ERR(0, 169, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":161 + /* "polluck_blockchain/placeholder_native.pyx":168 * self._genesis_done = 0 * self._chain = new unordered_map[uint64_t, Block*]() * if self._chain is NULL: # <<<<<<<<<<<<<< @@ -4719,7 +4933,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain___cin */ } - /* "polluck_blockchain/placeholder_native.pyx":156 + /* "polluck_blockchain/placeholder_native.pyx":163 * cdef bint _genesis_done * * def __cinit__(self): # <<<<<<<<<<<<<< @@ -4740,7 +4954,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain___cin return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":164 +/* "polluck_blockchain/placeholder_native.pyx":171 * raise MemoryError("Could not allocate hasmap") * * def __init__(self, *args, **kwargs): # <<<<<<<<<<<<<< @@ -4788,12 +5002,12 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_2__in return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":167 - * pass - * +/* "polluck_blockchain/placeholder_native.pyx":176 + * # TODO add entries of map + * # ownership is typically not transferred from the Blockchain extension class * def __dealloc__(self): # <<<<<<<<<<<<<< + * cdef BcHashmap.iterator it = self._chain.begin() * if self._chain is not NULL: - * del self._chain */ /* Python wrapper */ @@ -4810,29 +5024,69 @@ static void __pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_5__d } static void __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_4__dealloc__(struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self) { + std::unordered_map ::iterator __pyx_v_it; int __pyx_t_1; - /* "polluck_blockchain/placeholder_native.pyx":168 - * + /* "polluck_blockchain/placeholder_native.pyx":177 + * # ownership is typically not transferred from the Blockchain extension class * def __dealloc__(self): + * cdef BcHashmap.iterator it = self._chain.begin() # <<<<<<<<<<<<<< + * if self._chain is not NULL: + * while it != self._chain.end(): +*/ + __pyx_v_it = __pyx_v_self->_chain->begin(); + + /* "polluck_blockchain/placeholder_native.pyx":178 + * def __dealloc__(self): + * cdef BcHashmap.iterator it = self._chain.begin() * if self._chain is not NULL: # <<<<<<<<<<<<<< - * del self._chain - * self._chain = NULL + * while it != self._chain.end(): + * del dereference(it).second */ __pyx_t_1 = (__pyx_v_self->_chain != NULL); if (__pyx_t_1) { - /* "polluck_blockchain/placeholder_native.pyx":169 - * def __dealloc__(self): + /* "polluck_blockchain/placeholder_native.pyx":179 + * cdef BcHashmap.iterator it = self._chain.begin() * if self._chain is not NULL: + * while it != self._chain.end(): # <<<<<<<<<<<<<< + * del dereference(it).second + * postincrement(it) +*/ + while (1) { + __pyx_t_1 = (__pyx_v_it != __pyx_v_self->_chain->end()); + if (!__pyx_t_1) break; + + /* "polluck_blockchain/placeholder_native.pyx":180 + * if self._chain is not NULL: + * while it != self._chain.end(): + * del dereference(it).second # <<<<<<<<<<<<<< + * postincrement(it) + * +*/ + delete (*__pyx_v_it).second; + + /* "polluck_blockchain/placeholder_native.pyx":181 + * while it != self._chain.end(): + * del dereference(it).second + * postincrement(it) # <<<<<<<<<<<<<< + * + * del self._chain +*/ + (void)((__pyx_v_it++)); + } + + /* "polluck_blockchain/placeholder_native.pyx":183 + * postincrement(it) + * * del self._chain # <<<<<<<<<<<<<< * self._chain = NULL * */ delete __pyx_v_self->_chain; - /* "polluck_blockchain/placeholder_native.pyx":170 - * if self._chain is not NULL: + /* "polluck_blockchain/placeholder_native.pyx":184 + * * del self._chain * self._chain = NULL # <<<<<<<<<<<<<< * @@ -4840,27 +5094,27 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_4__d */ __pyx_v_self->_chain = NULL; - /* "polluck_blockchain/placeholder_native.pyx":168 - * + /* "polluck_blockchain/placeholder_native.pyx":178 * def __dealloc__(self): + * cdef BcHashmap.iterator it = self._chain.begin() * if self._chain is not NULL: # <<<<<<<<<<<<<< - * del self._chain - * self._chain = NULL + * while it != self._chain.end(): + * del dereference(it).second */ } - /* "polluck_blockchain/placeholder_native.pyx":167 - * pass - * + /* "polluck_blockchain/placeholder_native.pyx":176 + * # TODO add entries of map + * # ownership is typically not transferred from the Blockchain extension class * def __dealloc__(self): # <<<<<<<<<<<<<< + * cdef BcHashmap.iterator it = self._chain.begin() * if self._chain is not NULL: - * del self._chain */ /* function exit code */ } -/* "polluck_blockchain/placeholder_native.pyx":172 +/* "polluck_blockchain/placeholder_native.pyx":186 * self._chain = NULL * * def __len__(self): # <<<<<<<<<<<<<< @@ -4886,17 +5140,17 @@ static Py_ssize_t __pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchai static Py_ssize_t __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_6__len__(struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self) { Py_ssize_t __pyx_r; - /* "polluck_blockchain/placeholder_native.pyx":173 + /* "polluck_blockchain/placeholder_native.pyx":187 * * def __len__(self): * return self._index + 1 # <<<<<<<<<<<<<< * - * @property + * def print_key_value_pair(self): */ __pyx_r = (__pyx_v_self->_index + 1); goto __pyx_L0; - /* "polluck_blockchain/placeholder_native.pyx":172 + /* "polluck_blockchain/placeholder_native.pyx":186 * self._chain = NULL * * def __len__(self): # <<<<<<<<<<<<<< @@ -4909,9 +5163,191 @@ static Py_ssize_t __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchai return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":175 +/* "polluck_blockchain/placeholder_native.pyx":189 * return self._index + 1 * + * def print_key_value_pair(self): # <<<<<<<<<<<<<< + * cdef BcHashmap.iterator it = self._chain.begin() + * cdef Block *block +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_9print_key_value_pair(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_18polluck_blockchain_18placeholder_native_10Blockchain_9print_key_value_pair = {"print_key_value_pair", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_9print_key_value_pair, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_9print_key_value_pair(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("print_key_value_pair (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("print_key_value_pair", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("print_key_value_pair", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_8print_key_value_pair(((struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_8print_key_value_pair(struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self) { + std::unordered_map ::iterator __pyx_v_it; + ::Block *__pyx_v_block; + struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_py_block = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + ::Block *__pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("print_key_value_pair", 0); + + /* "polluck_blockchain/placeholder_native.pyx":190 + * + * def print_key_value_pair(self): + * cdef BcHashmap.iterator it = self._chain.begin() # <<<<<<<<<<<<<< + * cdef Block *block + * while it != self._chain.end(): +*/ + __pyx_v_it = __pyx_v_self->_chain->begin(); + + /* "polluck_blockchain/placeholder_native.pyx":192 + * cdef BcHashmap.iterator it = self._chain.begin() + * cdef Block *block + * while it != self._chain.end(): # <<<<<<<<<<<<<< + * print(dereference(it).first) + * block = dereference(it).second +*/ + while (1) { + __pyx_t_1 = (__pyx_v_it != __pyx_v_self->_chain->end()); + if (!__pyx_t_1) break; + + /* "polluck_blockchain/placeholder_native.pyx":193 + * cdef Block *block + * while it != self._chain.end(): + * print(dereference(it).first) # <<<<<<<<<<<<<< + * block = dereference(it).second + * 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, 193, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4}; + __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, 193, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "polluck_blockchain/placeholder_native.pyx":194 + * while it != self._chain.end(): + * print(dereference(it).first) + * block = dereference(it).second # <<<<<<<<<<<<<< + * py_block = PyBlock.from_ptr(block) + * print(py_block) +*/ + __pyx_t_6 = (*__pyx_v_it).second; + __pyx_v_block = __pyx_t_6; + + /* "polluck_blockchain/placeholder_native.pyx":195 + * 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_18polluck_blockchain_18placeholder_native_PyBlock->from_ptr(__pyx_v_block, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 195, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_py_block, ((struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *)__pyx_t_2)); + __pyx_t_2 = 0; + + /* "polluck_blockchain/placeholder_native.pyx":196 + * block = dereference(it).second + * py_block = PyBlock.from_ptr(block) + * print(py_block) # <<<<<<<<<<<<<< + * postincrement(it) + * +*/ + __pyx_t_4 = NULL; + __pyx_t_5 = 1; + { + 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, 196, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "polluck_blockchain/placeholder_native.pyx":197 + * py_block = PyBlock.from_ptr(block) + * print(py_block) + * postincrement(it) # <<<<<<<<<<<<<< + * + * @property +*/ + (void)((__pyx_v_it++)); + } + + /* "polluck_blockchain/placeholder_native.pyx":189 + * return self._index + 1 + * + * def print_key_value_pair(self): # <<<<<<<<<<<<<< + * cdef BcHashmap.iterator it = self._chain.begin() + * cdef Block *block +*/ + + /* 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); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("polluck_blockchain.placeholder_native.Blockchain.print_key_value_pair", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_py_block); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "polluck_blockchain/placeholder_native.pyx":199 + * postincrement(it) + * * @property # <<<<<<<<<<<<<< * def genesis_done(self): * return self._genesis_done @@ -4941,7 +5377,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "polluck_blockchain/placeholder_native.pyx":177 + /* "polluck_blockchain/placeholder_native.pyx":201 * @property * def genesis_done(self): * return self._genesis_done # <<<<<<<<<<<<<< @@ -4949,14 +5385,14 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_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, 177, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->_genesis_done); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "polluck_blockchain/placeholder_native.pyx":175 - * return self._index + 1 + /* "polluck_blockchain/placeholder_native.pyx":199 + * postincrement(it) * * @property # <<<<<<<<<<<<<< * def genesis_done(self): @@ -4974,7 +5410,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":179 +/* "polluck_blockchain/placeholder_native.pyx":203 * return self._genesis_done * * @property # <<<<<<<<<<<<<< @@ -5006,7 +5442,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "polluck_blockchain/placeholder_native.pyx":181 + /* "polluck_blockchain/placeholder_native.pyx":205 * @property * def index(self): * return self._index # <<<<<<<<<<<<<< @@ -5014,13 +5450,13 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain * # TODO error handling */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "polluck_blockchain/placeholder_native.pyx":179 + /* "polluck_blockchain/placeholder_native.pyx":203 * return self._genesis_done * * @property # <<<<<<<<<<<<<< @@ -5039,7 +5475,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":184 +/* "polluck_blockchain/placeholder_native.pyx":208 * * # TODO error handling * cdef Block* get_block_c(self, uint64_t idx): # <<<<<<<<<<<<<< @@ -5050,7 +5486,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain static ::Block *__pyx_f_18polluck_blockchain_18placeholder_native_10Blockchain_get_block_c(struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self, uint64_t __pyx_v_idx) { ::Block *__pyx_r; - /* "polluck_blockchain/placeholder_native.pyx":185 + /* "polluck_blockchain/placeholder_native.pyx":209 * # TODO error handling * cdef Block* get_block_c(self, uint64_t idx): * return self._chain[0][idx] # <<<<<<<<<<<<<< @@ -5060,7 +5496,7 @@ static ::Block *__pyx_f_18polluck_blockchain_18placeholder_native_10Blockchain_g __pyx_r = ((__pyx_v_self->_chain[0])[__pyx_v_idx]); goto __pyx_L0; - /* "polluck_blockchain/placeholder_native.pyx":184 + /* "polluck_blockchain/placeholder_native.pyx":208 * * # TODO error handling * cdef Block* get_block_c(self, uint64_t idx): # <<<<<<<<<<<<<< @@ -5073,7 +5509,7 @@ static ::Block *__pyx_f_18polluck_blockchain_18placeholder_native_10Blockchain_g return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":187 +/* "polluck_blockchain/placeholder_native.pyx":211 * return self._chain[0][idx] * * def get_block(self, idx): # <<<<<<<<<<<<<< @@ -5082,15 +5518,15 @@ static ::Block *__pyx_f_18polluck_blockchain_18placeholder_native_10Blockchain_g */ /* Python wrapper */ -static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_9get_block(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_11get_block(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -static PyMethodDef __pyx_mdef_18polluck_blockchain_18placeholder_native_10Blockchain_9get_block = {"get_block", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_9get_block, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_9get_block(PyObject *__pyx_v_self, +static PyMethodDef __pyx_mdef_18polluck_blockchain_18placeholder_native_10Blockchain_11get_block = {"get_block", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_11get_block, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_11get_block(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -5120,32 +5556,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, 187, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 211, __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, 187, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 211, __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, 187, __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, 211, __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, 187, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_block", 1, 1, 1, i); __PYX_ERR(0, 211, __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, 187, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 211, __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, 187, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_block", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 211, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -5156,7 +5592,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_8get_block(((struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *)__pyx_v_self), __pyx_v_idx); + __pyx_r = __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_10get_block(((struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *)__pyx_v_self), __pyx_v_idx); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { @@ -5166,7 +5602,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_8get_block(struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self, PyObject *__pyx_v_idx) { +static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_10get_block(struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self, PyObject *__pyx_v_idx) { ::Block *__pyx_v_block; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -5183,32 +5619,32 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_block", 0); - /* "polluck_blockchain/placeholder_native.pyx":188 + /* "polluck_blockchain/placeholder_native.pyx":212 * * 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, 188, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 188, __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, 212, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 212, __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, 188, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __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, 188, __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, 212, __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, 188, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 212, __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)) { - /* "polluck_blockchain/placeholder_native.pyx":189 + /* "polluck_blockchain/placeholder_native.pyx":213 * def get_block(self, idx): * if idx < 0 or idx > self._index: * raise IndexError("Index value is out of bounds") # <<<<<<<<<<<<<< @@ -5221,14 +5657,14 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_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, 189, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 213, __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, 189, __pyx_L1_error) + __PYX_ERR(0, 213, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":188 + /* "polluck_blockchain/placeholder_native.pyx":212 * * def get_block(self, idx): * if idx < 0 or idx > self._index: # <<<<<<<<<<<<<< @@ -5237,18 +5673,18 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain */ } - /* "polluck_blockchain/placeholder_native.pyx":191 + /* "polluck_blockchain/placeholder_native.pyx":215 * raise IndexError("Index value is out of bounds") * * cdef Block *block = self.get_block_c(idx) # <<<<<<<<<<<<<< * return PyBlock.from_ptr(block, owner=False) * */ - __pyx_t_6 = __Pyx_PyLong_As_uint64_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 191, __pyx_L1_error) - __pyx_t_7 = ((struct __pyx_vtabstruct_18polluck_blockchain_18placeholder_native_Blockchain *)__pyx_v_self->__pyx_vtab)->get_block_c(__pyx_v_self, __pyx_t_6); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 191, __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, 215, __pyx_L1_error) + __pyx_t_7 = ((struct __pyx_vtabstruct_18polluck_blockchain_18placeholder_native_Blockchain *)__pyx_v_self->__pyx_vtab)->get_block_c(__pyx_v_self, __pyx_t_6); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L1_error) __pyx_v_block = __pyx_t_7; - /* "polluck_blockchain/placeholder_native.pyx":192 + /* "polluck_blockchain/placeholder_native.pyx":216 * * cdef Block *block = self.get_block_c(idx) * return PyBlock.from_ptr(block, owner=False) # <<<<<<<<<<<<<< @@ -5258,13 +5694,13 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain __Pyx_XDECREF(__pyx_r); __pyx_t_8.__pyx_n = 1; __pyx_t_8.owner = 0; - __pyx_t_4 = ((PyObject *)__pyx_vtabptr_18polluck_blockchain_18placeholder_native_PyBlock->from_ptr(__pyx_v_block, &__pyx_t_8)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 192, __pyx_L1_error) + __pyx_t_4 = ((PyObject *)__pyx_vtabptr_18polluck_blockchain_18placeholder_native_PyBlock->from_ptr(__pyx_v_block, &__pyx_t_8)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0; - /* "polluck_blockchain/placeholder_native.pyx":187 + /* "polluck_blockchain/placeholder_native.pyx":211 * return self._chain[0][idx] * * def get_block(self, idx): # <<<<<<<<<<<<<< @@ -5284,7 +5720,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":194 +/* "polluck_blockchain/placeholder_native.pyx":218 * return PyBlock.from_ptr(block, owner=False) * * cdef void add_block(self, Block *block): # <<<<<<<<<<<<<< @@ -5294,7 +5730,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain static void __pyx_f_18polluck_blockchain_18placeholder_native_10Blockchain_add_block(struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self, ::Block *__pyx_v_block) { - /* "polluck_blockchain/placeholder_native.pyx":195 + /* "polluck_blockchain/placeholder_native.pyx":219 * * cdef void add_block(self, Block *block): * self._chain[0][block.index] = block # <<<<<<<<<<<<<< @@ -5303,7 +5739,7 @@ static void __pyx_f_18polluck_blockchain_18placeholder_native_10Blockchain_add_b */ ((__pyx_v_self->_chain[0])[__pyx_v_block->index]) = __pyx_v_block; - /* "polluck_blockchain/placeholder_native.pyx":196 + /* "polluck_blockchain/placeholder_native.pyx":220 * cdef void add_block(self, Block *block): * self._chain[0][block.index] = block * if self._genesis_done: # <<<<<<<<<<<<<< @@ -5312,7 +5748,7 @@ static void __pyx_f_18polluck_blockchain_18placeholder_native_10Blockchain_add_b */ if (__pyx_v_self->_genesis_done) { - /* "polluck_blockchain/placeholder_native.pyx":197 + /* "polluck_blockchain/placeholder_native.pyx":221 * self._chain[0][block.index] = block * if self._genesis_done: * self._index += 1 # <<<<<<<<<<<<<< @@ -5321,7 +5757,7 @@ static void __pyx_f_18polluck_blockchain_18placeholder_native_10Blockchain_add_b */ __pyx_v_self->_index = (__pyx_v_self->_index + 1); - /* "polluck_blockchain/placeholder_native.pyx":196 + /* "polluck_blockchain/placeholder_native.pyx":220 * cdef void add_block(self, Block *block): * self._chain[0][block.index] = block * if self._genesis_done: # <<<<<<<<<<<<<< @@ -5330,7 +5766,7 @@ static void __pyx_f_18polluck_blockchain_18placeholder_native_10Blockchain_add_b */ } - /* "polluck_blockchain/placeholder_native.pyx":194 + /* "polluck_blockchain/placeholder_native.pyx":218 * return PyBlock.from_ptr(block, owner=False) * * cdef void add_block(self, Block *block): # <<<<<<<<<<<<<< @@ -5341,7 +5777,7 @@ static void __pyx_f_18polluck_blockchain_18placeholder_native_10Blockchain_add_b /* function exit code */ } -/* "polluck_blockchain/placeholder_native.pyx":199 +/* "polluck_blockchain/placeholder_native.pyx":223 * self._index += 1 * * def create_genesis_block(self): # <<<<<<<<<<<<<< @@ -5350,15 +5786,15 @@ static void __pyx_f_18polluck_blockchain_18placeholder_native_10Blockchain_add_b */ /* Python wrapper */ -static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_11create_genesis_block(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_13create_genesis_block(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -static PyMethodDef __pyx_mdef_18polluck_blockchain_18placeholder_native_10Blockchain_11create_genesis_block = {"create_genesis_block", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_11create_genesis_block, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_11create_genesis_block(PyObject *__pyx_v_self, +static PyMethodDef __pyx_mdef_18polluck_blockchain_18placeholder_native_10Blockchain_13create_genesis_block = {"create_genesis_block", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_13create_genesis_block, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_13create_genesis_block(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -5384,14 +5820,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("create_genesis_block", __pyx_kwds); return NULL;} - __pyx_r = __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_10create_genesis_block(((struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *)__pyx_v_self)); + __pyx_r = __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_12create_genesis_block(((struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_10create_genesis_block(struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self) { +static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_12create_genesis_block(struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self) { ::Block *__pyx_v_block; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -5410,19 +5846,19 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain int __pyx_clineno = 0; __Pyx_RefNannySetupContext("create_genesis_block", 0); - /* "polluck_blockchain/placeholder_native.pyx":202 + /* "polluck_blockchain/placeholder_native.pyx":226 * cdef Block *block = new Block( * self._index, * datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp(), # <<<<<<<<<<<<<< * 0, * "Genesis Block".encode("UTF-8"), */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 202, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[0], NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[0], NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_2 = __pyx_t_3; @@ -5433,40 +5869,40 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_timestamp, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (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, 202, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } - __pyx_t_6 = __Pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 202, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "polluck_blockchain/placeholder_native.pyx":204 + /* "polluck_blockchain/placeholder_native.pyx":228 * datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp(), * 0, * "Genesis Block".encode("UTF-8"), # <<<<<<<<<<<<<< * "0".encode("UTF-8"), * "".encode("UTF-8"), */ - __pyx_t_7 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_mstate_global->__pyx_kp_b_Genesis_Block); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 204, __pyx_L1_error) + __pyx_t_7 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_mstate_global->__pyx_kp_b_Genesis_Block); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 228, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":205 + /* "polluck_blockchain/placeholder_native.pyx":229 * 0, * "Genesis Block".encode("UTF-8"), * "0".encode("UTF-8"), # <<<<<<<<<<<<<< * "".encode("UTF-8"), * ) */ - __pyx_t_8 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_mstate_global->__pyx_kp_b_0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_t_8 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_mstate_global->__pyx_kp_b_0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 229, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":206 + /* "polluck_blockchain/placeholder_native.pyx":230 * "Genesis Block".encode("UTF-8"), * "0".encode("UTF-8"), * "".encode("UTF-8"), # <<<<<<<<<<<<<< * ) - * block.hash = "dummy hash".encode("UTF-8") + * block.hash = "dummy hash".encode("UTF-8") */ - __pyx_t_9 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_mstate_global->__pyx_kp_b_); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 206, __pyx_L1_error) + __pyx_t_9 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_mstate_global->__pyx_kp_b_); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 230, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":200 + /* "polluck_blockchain/placeholder_native.pyx":224 * * def create_genesis_block(self): * cdef Block *block = new Block( # <<<<<<<<<<<<<< @@ -5477,39 +5913,39 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain __pyx_t_10 = new ::Block(__pyx_v_self->_index, __pyx_t_6, 0, __pyx_t_7, __pyx_t_8, __pyx_t_9); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 200, __pyx_L1_error) + __PYX_ERR(0, 224, __pyx_L1_error) } __pyx_v_block = __pyx_t_10; - /* "polluck_blockchain/placeholder_native.pyx":208 + /* "polluck_blockchain/placeholder_native.pyx":232 * "".encode("UTF-8"), * ) - * block.hash = "dummy hash".encode("UTF-8") # <<<<<<<<<<<<<< + * block.hash = "dummy hash".encode("UTF-8") # <<<<<<<<<<<<<< * self.add_block(block) - * self._genesis_done = 1 + * self._genesis_done = True */ - __pyx_t_9 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_mstate_global->__pyx_kp_b_dummy_hash); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 208, __pyx_L1_error) - __pyx_v_block->hash = ((std::string)__pyx_t_9); + __pyx_t_9 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_mstate_global->__pyx_kp_b_dummy_hash); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 232, __pyx_L1_error) + __pyx_v_block->hash = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_9); - /* "polluck_blockchain/placeholder_native.pyx":209 + /* "polluck_blockchain/placeholder_native.pyx":233 * ) - * block.hash = "dummy hash".encode("UTF-8") + * block.hash = "dummy hash".encode("UTF-8") * self.add_block(block) # <<<<<<<<<<<<<< - * self._genesis_done = 1 + * self._genesis_done = True * */ - ((struct __pyx_vtabstruct_18polluck_blockchain_18placeholder_native_Blockchain *)__pyx_v_self->__pyx_vtab)->add_block(__pyx_v_self, __pyx_v_block); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 209, __pyx_L1_error) + ((struct __pyx_vtabstruct_18polluck_blockchain_18placeholder_native_Blockchain *)__pyx_v_self->__pyx_vtab)->add_block(__pyx_v_self, __pyx_v_block); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 233, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":210 - * block.hash = "dummy hash".encode("UTF-8") + /* "polluck_blockchain/placeholder_native.pyx":234 + * block.hash = "dummy hash".encode("UTF-8") * self.add_block(block) - * self._genesis_done = 1 # <<<<<<<<<<<<<< + * self._genesis_done = True # <<<<<<<<<<<<<< * * def new_block(self, data): */ __pyx_v_self->_genesis_done = 1; - /* "polluck_blockchain/placeholder_native.pyx":199 + /* "polluck_blockchain/placeholder_native.pyx":223 * self._index += 1 * * def create_genesis_block(self): # <<<<<<<<<<<<<< @@ -5533,8 +5969,8 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":212 - * self._genesis_done = 1 +/* "polluck_blockchain/placeholder_native.pyx":236 + * self._genesis_done = True * * def new_block(self, data): # <<<<<<<<<<<<<< * if not self._genesis_done: @@ -5542,15 +5978,15 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain */ /* Python wrapper */ -static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_13new_block(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_15new_block(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -static PyMethodDef __pyx_mdef_18polluck_blockchain_18placeholder_native_10Blockchain_13new_block = {"new_block", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_13new_block, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_13new_block(PyObject *__pyx_v_self, +static PyMethodDef __pyx_mdef_18polluck_blockchain_18placeholder_native_10Blockchain_15new_block = {"new_block", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_15new_block, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_15new_block(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -5580,32 +6016,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, 212, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 236, __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, 212, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 236, __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, 212, __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, 236, __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, 212, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("new_block", 1, 1, 1, i); __PYX_ERR(0, 236, __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, 212, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 236, __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, 212, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("new_block", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 236, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -5616,7 +6052,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_12new_block(((struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *)__pyx_v_self), __pyx_v_data); + __pyx_r = __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_14new_block(((struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *)__pyx_v_self), __pyx_v_data); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { @@ -5626,7 +6062,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_12new_block(struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self, PyObject *__pyx_v_data) { +static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_14new_block(struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self, PyObject *__pyx_v_data) { ::Block *__pyx_v_prev_block; std::string __pyx_v_prev_hash; uint64_t __pyx_v_new_idx; @@ -5648,7 +6084,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain int __pyx_clineno = 0; __Pyx_RefNannySetupContext("new_block", 0); - /* "polluck_blockchain/placeholder_native.pyx":213 + /* "polluck_blockchain/placeholder_native.pyx":237 * * def new_block(self, data): * if not self._genesis_done: # <<<<<<<<<<<<<< @@ -5658,7 +6094,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain __pyx_t_1 = (!__pyx_v_self->_genesis_done); if (unlikely(__pyx_t_1)) { - /* "polluck_blockchain/placeholder_native.pyx":214 + /* "polluck_blockchain/placeholder_native.pyx":238 * def new_block(self, data): * if not self._genesis_done: * raise RuntimeError("Create a genesis block first.") # <<<<<<<<<<<<<< @@ -5671,14 +6107,14 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_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, 214, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 238, __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, 214, __pyx_L1_error) + __PYX_ERR(0, 238, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":213 + /* "polluck_blockchain/placeholder_native.pyx":237 * * def new_block(self, data): * if not self._genesis_done: # <<<<<<<<<<<<<< @@ -5687,17 +6123,17 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain */ } - /* "polluck_blockchain/placeholder_native.pyx":216 + /* "polluck_blockchain/placeholder_native.pyx":240 * raise RuntimeError("Create a genesis block first.") * * cdef Block *prev_block = self.get_block_c(self._index) # <<<<<<<<<<<<<< * cdef string prev_hash = prev_block.prev_hash * cdef uint64_t new_idx = self._index + 1 */ - __pyx_t_5 = ((struct __pyx_vtabstruct_18polluck_blockchain_18placeholder_native_Blockchain *)__pyx_v_self->__pyx_vtab)->get_block_c(__pyx_v_self, __pyx_v_self->_index); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L1_error) + __pyx_t_5 = ((struct __pyx_vtabstruct_18polluck_blockchain_18placeholder_native_Blockchain *)__pyx_v_self->__pyx_vtab)->get_block_c(__pyx_v_self, __pyx_v_self->_index); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 240, __pyx_L1_error) __pyx_v_prev_block = __pyx_t_5; - /* "polluck_blockchain/placeholder_native.pyx":217 + /* "polluck_blockchain/placeholder_native.pyx":241 * * cdef Block *prev_block = self.get_block_c(self._index) * cdef string prev_hash = prev_block.prev_hash # <<<<<<<<<<<<<< @@ -5707,7 +6143,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain __pyx_t_6 = __pyx_v_prev_block->prev_hash; __pyx_v_prev_hash = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_6); - /* "polluck_blockchain/placeholder_native.pyx":218 + /* "polluck_blockchain/placeholder_native.pyx":242 * cdef Block *prev_block = self.get_block_c(self._index) * cdef string prev_hash = prev_block.prev_hash * cdef uint64_t new_idx = self._index + 1 # <<<<<<<<<<<<<< @@ -5716,19 +6152,19 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain */ __pyx_v_new_idx = (__pyx_v_self->_index + 1); - /* "polluck_blockchain/placeholder_native.pyx":222 + /* "polluck_blockchain/placeholder_native.pyx":246 * cdef Block *block = new Block( * new_idx, * datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp(), # <<<<<<<<<<<<<< * 0, * data.encode("UTF-8"), */ - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 222, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 246, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 222, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 246, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_mstate_global->__pyx_tuple[0], NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 222, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_mstate_global->__pyx_tuple[0], NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 246, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_3 = __pyx_t_7; @@ -5739,13 +6175,13 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_timestamp, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 246, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } - __pyx_t_9 = __Pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 222, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 246, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "polluck_blockchain/placeholder_native.pyx":224 + /* "polluck_blockchain/placeholder_native.pyx":248 * datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp(), * 0, * data.encode("UTF-8"), # <<<<<<<<<<<<<< @@ -5759,22 +6195,22 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_UTF_8}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 248, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } - __pyx_t_6 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 224, __pyx_L1_error) + __pyx_t_6 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 248, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "polluck_blockchain/placeholder_native.pyx":226 + /* "polluck_blockchain/placeholder_native.pyx":250 * data.encode("UTF-8"), * prev_hash, * "".encode("UTF-8"), # <<<<<<<<<<<<<< * ) * self.add_block(block) */ - __pyx_t_10 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_mstate_global->__pyx_kp_b_); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L1_error) + __pyx_t_10 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_mstate_global->__pyx_kp_b_); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 250, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":220 + /* "polluck_blockchain/placeholder_native.pyx":244 * cdef uint64_t new_idx = self._index + 1 * * cdef Block *block = new Block( # <<<<<<<<<<<<<< @@ -5785,21 +6221,21 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain __pyx_t_5 = new ::Block(__pyx_v_new_idx, __pyx_t_9, 0, __pyx_t_6, __pyx_v_prev_hash, __pyx_t_10); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 220, __pyx_L1_error) + __PYX_ERR(0, 244, __pyx_L1_error) } __pyx_v_block = __pyx_t_5; - /* "polluck_blockchain/placeholder_native.pyx":228 + /* "polluck_blockchain/placeholder_native.pyx":252 * "".encode("UTF-8"), * ) * self.add_block(block) # <<<<<<<<<<<<<< * * # def __init__( */ - ((struct __pyx_vtabstruct_18polluck_blockchain_18placeholder_native_Blockchain *)__pyx_v_self->__pyx_vtab)->add_block(__pyx_v_self, __pyx_v_block); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 228, __pyx_L1_error) + ((struct __pyx_vtabstruct_18polluck_blockchain_18placeholder_native_Blockchain *)__pyx_v_self->__pyx_vtab)->add_block(__pyx_v_self, __pyx_v_block); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 252, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":212 - * self._genesis_done = 1 + /* "polluck_blockchain/placeholder_native.pyx":236 + * self._genesis_done = True * * def new_block(self, data): # <<<<<<<<<<<<<< * if not self._genesis_done: @@ -5829,15 +6265,15 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain */ /* Python wrapper */ -static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_15__reduce_cython__(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_17__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -static PyMethodDef __pyx_mdef_18polluck_blockchain_18placeholder_native_10Blockchain_15__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_15__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_15__reduce_cython__(PyObject *__pyx_v_self, +static PyMethodDef __pyx_mdef_18polluck_blockchain_18placeholder_native_10Blockchain_17__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_17__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_17__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -5863,14 +6299,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;} - __pyx_r = __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_14__reduce_cython__(((struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *)__pyx_v_self)); + __pyx_r = __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_16__reduce_cython__(((struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self) { +static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_16__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; @@ -5910,15 +6346,15 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain */ /* Python wrapper */ -static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_17__setstate_cython__(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_19__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -static PyMethodDef __pyx_mdef_18polluck_blockchain_18placeholder_native_10Blockchain_17__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_17__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_17__setstate_cython__(PyObject *__pyx_v_self, +static PyMethodDef __pyx_mdef_18polluck_blockchain_18placeholder_native_10Blockchain_19__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_19__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_19__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -5984,7 +6420,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_16__setstate_cython__(((struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *)__pyx_v_self), __pyx_v___pyx_state); + __pyx_r = __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_18__setstate_cython__(((struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *)__pyx_v_self), __pyx_v___pyx_state); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { @@ -5994,7 +6430,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_18__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; @@ -6097,8 +6533,8 @@ static PyObject *__pyx_getprop_18polluck_blockchain_18placeholder_native_7PyBloc } static PyMethodDef __pyx_methods_18polluck_blockchain_18placeholder_native_PyBlock[] = { - {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_7__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_9__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_11__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_13__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; @@ -6114,6 +6550,8 @@ static struct PyGetSetDef __pyx_getsets_18polluck_blockchain_18placeholder_nativ #if CYTHON_USE_TYPE_SPECS static PyType_Slot __pyx_type_18polluck_blockchain_18placeholder_native_PyBlock_slots[] = { {Py_tp_dealloc, (void *)__pyx_tp_dealloc_18polluck_blockchain_18placeholder_native_PyBlock}, + {Py_tp_repr, (void *)__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_7__repr__}, + {Py_tp_str, (void *)__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_9__str__}, {Py_tp_methods, (void *)__pyx_methods_18polluck_blockchain_18placeholder_native_PyBlock}, {Py_tp_getset, (void *)__pyx_getsets_18polluck_blockchain_18placeholder_native_PyBlock}, {Py_tp_init, (void *)__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_3__init__}, @@ -6139,13 +6577,13 @@ static PyTypeObject __pyx_type_18polluck_blockchain_18placeholder_native_PyBlock 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_as_async*/ - 0, /*tp_repr*/ + __pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_7__repr__, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - 0, /*tp_str*/ + __pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_9__str__, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ @@ -6256,11 +6694,12 @@ static PyObject *__pyx_getprop_18polluck_blockchain_18placeholder_native_10Block } static PyMethodDef __pyx_methods_18polluck_blockchain_18placeholder_native_Blockchain[] = { - {"get_block", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_9get_block, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"create_genesis_block", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_11create_genesis_block, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"new_block", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_13new_block, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_15__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_17__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"print_key_value_pair", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_9print_key_value_pair, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"get_block", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_11get_block, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"create_genesis_block", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_13create_genesis_block, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"new_block", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_15new_block, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_17__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_10Blockchain_19__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; @@ -6437,15 +6876,15 @@ static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { __pyx_vtabptr_18polluck_blockchain_18placeholder_native_PyBlock = &__pyx_vtable_18polluck_blockchain_18placeholder_native_PyBlock; __pyx_vtable_18polluck_blockchain_18placeholder_native_PyBlock.from_ptr = (struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *(*)(::Block *, struct __pyx_opt_args_18polluck_blockchain_18placeholder_native_7PyBlock_from_ptr *__pyx_optional_args))__pyx_f_18polluck_blockchain_18placeholder_native_7PyBlock_from_ptr; #if CYTHON_USE_TYPE_SPECS - __pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_PyBlock = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_18polluck_blockchain_18placeholder_native_PyBlock_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_PyBlock)) __PYX_ERR(0, 32, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_18polluck_blockchain_18placeholder_native_PyBlock_spec, __pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_PyBlock) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_PyBlock = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_18polluck_blockchain_18placeholder_native_PyBlock_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_PyBlock)) __PYX_ERR(0, 33, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_18polluck_blockchain_18placeholder_native_PyBlock_spec, __pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_PyBlock) < (0)) __PYX_ERR(0, 33, __pyx_L1_error) #else __pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_PyBlock = &__pyx_type_18polluck_blockchain_18placeholder_native_PyBlock; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_PyBlock) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_PyBlock) < (0)) __PYX_ERR(0, 33, __pyx_L1_error) #endif #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_PyBlock); @@ -6455,23 +6894,23 @@ static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { __pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_PyBlock->tp_getattro = PyObject_GenericGetAttr; } #endif - if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_PyBlock, __pyx_vtabptr_18polluck_blockchain_18placeholder_native_PyBlock) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) - if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_PyBlock) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_PyBlock, (PyObject *) __pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_PyBlock) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_PyBlock) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) + if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_PyBlock, __pyx_vtabptr_18polluck_blockchain_18placeholder_native_PyBlock) < (0)) __PYX_ERR(0, 33, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_PyBlock) < (0)) __PYX_ERR(0, 33, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_PyBlock_2, (PyObject *) __pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_PyBlock) < (0)) __PYX_ERR(0, 33, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_PyBlock) < (0)) __PYX_ERR(0, 33, __pyx_L1_error) __pyx_vtabptr_18polluck_blockchain_18placeholder_native_Blockchain = &__pyx_vtable_18polluck_blockchain_18placeholder_native_Blockchain; __pyx_vtable_18polluck_blockchain_18placeholder_native_Blockchain.get_block_c = (::Block *(*)(struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *, uint64_t))__pyx_f_18polluck_blockchain_18placeholder_native_10Blockchain_get_block_c; __pyx_vtable_18polluck_blockchain_18placeholder_native_Blockchain.add_block = (void (*)(struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain *, ::Block *))__pyx_f_18polluck_blockchain_18placeholder_native_10Blockchain_add_block; #if CYTHON_USE_TYPE_SPECS - __pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_18polluck_blockchain_18placeholder_native_Blockchain_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain)) __PYX_ERR(0, 150, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_18polluck_blockchain_18placeholder_native_Blockchain_spec, __pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain) < (0)) __PYX_ERR(0, 150, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_18polluck_blockchain_18placeholder_native_Blockchain_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain)) __PYX_ERR(0, 157, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_18polluck_blockchain_18placeholder_native_Blockchain_spec, __pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain) < (0)) __PYX_ERR(0, 157, __pyx_L1_error) #else __pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain = &__pyx_type_18polluck_blockchain_18placeholder_native_Blockchain; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain) < (0)) __PYX_ERR(0, 150, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain) < (0)) __PYX_ERR(0, 157, __pyx_L1_error) #endif #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain); @@ -6481,10 +6920,10 @@ static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { __pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain->tp_getattro = PyObject_GenericGetAttr; } #endif - if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain, __pyx_vtabptr_18polluck_blockchain_18placeholder_native_Blockchain) < (0)) __PYX_ERR(0, 150, __pyx_L1_error) - if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain) < (0)) __PYX_ERR(0, 150, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Blockchain, (PyObject *) __pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain) < (0)) __PYX_ERR(0, 150, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain) < (0)) __PYX_ERR(0, 150, __pyx_L1_error) + if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain, __pyx_vtabptr_18polluck_blockchain_18placeholder_native_Blockchain) < (0)) __PYX_ERR(0, 157, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain) < (0)) __PYX_ERR(0, 157, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Blockchain, (PyObject *) __pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain) < (0)) __PYX_ERR(0, 157, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain) < (0)) __PYX_ERR(0, 157, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -6855,7 +7294,7 @@ __Pyx_RefNannySetupContext("PyInit_placeholder_native", 0); * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_18polluck_blockchain_18placeholder_native_7PyBlock_7__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PyBlock___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_polluck_blockchain_placeholder_n, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_18polluck_blockchain_18placeholder_native_7PyBlock_11__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PyBlock___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_polluck_blockchain_placeholder_n, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); @@ -6869,7 +7308,7 @@ __Pyx_RefNannySetupContext("PyInit_placeholder_native", 0); * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_18polluck_blockchain_18placeholder_native_7PyBlock_9__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PyBlock___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_polluck_blockchain_placeholder_n, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_18polluck_blockchain_18placeholder_native_7PyBlock_13__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PyBlock___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_polluck_blockchain_placeholder_n, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); @@ -6877,49 +7316,64 @@ __Pyx_RefNannySetupContext("PyInit_placeholder_native", 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; - /* "polluck_blockchain/placeholder_native.pyx":187 + /* "polluck_blockchain/placeholder_native.pyx":189 + * return self._index + 1 + * + * def print_key_value_pair(self): # <<<<<<<<<<<<<< + * cdef BcHashmap.iterator it = self._chain.begin() + * cdef Block *block +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_18polluck_blockchain_18placeholder_native_10Blockchain_9print_key_value_pair, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain_print_key_value_pair, NULL, __pyx_mstate_global->__pyx_n_u_polluck_blockchain_placeholder_n, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 189, __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_18polluck_blockchain_18placeholder_native_Blockchain, __pyx_mstate_global->__pyx_n_u_print_key_value_pair, __pyx_t_2) < (0)) __PYX_ERR(0, 189, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "polluck_blockchain/placeholder_native.pyx":211 * return self._chain[0][idx] * * 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_18polluck_blockchain_18placeholder_native_10Blockchain_9get_block, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain_get_block, NULL, __pyx_mstate_global->__pyx_n_u_polluck_blockchain_placeholder_n, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 187, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_18polluck_blockchain_18placeholder_native_10Blockchain_11get_block, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain_get_block, NULL, __pyx_mstate_global->__pyx_n_u_polluck_blockchain_placeholder_n, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 211, __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_18polluck_blockchain_18placeholder_native_Blockchain, __pyx_mstate_global->__pyx_n_u_get_block, __pyx_t_2) < (0)) __PYX_ERR(0, 187, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain, __pyx_mstate_global->__pyx_n_u_get_block, __pyx_t_2) < (0)) __PYX_ERR(0, 211, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "polluck_blockchain/placeholder_native.pyx":199 + /* "polluck_blockchain/placeholder_native.pyx":223 * self._index += 1 * * def create_genesis_block(self): # <<<<<<<<<<<<<< * cdef Block *block = new Block( * self._index, */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_18polluck_blockchain_18placeholder_native_10Blockchain_11create_genesis_block, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain_create_genesis_block, NULL, __pyx_mstate_global->__pyx_n_u_polluck_blockchain_placeholder_n, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 199, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_18polluck_blockchain_18placeholder_native_10Blockchain_13create_genesis_block, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain_create_genesis_block, NULL, __pyx_mstate_global->__pyx_n_u_polluck_blockchain_placeholder_n, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 223, __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_18polluck_blockchain_18placeholder_native_Blockchain, __pyx_mstate_global->__pyx_n_u_create_genesis_block, __pyx_t_2) < (0)) __PYX_ERR(0, 199, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain, __pyx_mstate_global->__pyx_n_u_create_genesis_block, __pyx_t_2) < (0)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "polluck_blockchain/placeholder_native.pyx":212 - * self._genesis_done = 1 + /* "polluck_blockchain/placeholder_native.pyx":236 + * self._genesis_done = True * * def new_block(self, data): # <<<<<<<<<<<<<< * if not self._genesis_done: * raise RuntimeError("Create a genesis block first.") */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_18polluck_blockchain_18placeholder_native_10Blockchain_13new_block, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain_new_block, NULL, __pyx_mstate_global->__pyx_n_u_polluck_blockchain_placeholder_n, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_18polluck_blockchain_18placeholder_native_10Blockchain_15new_block, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain_new_block, NULL, __pyx_mstate_global->__pyx_n_u_polluck_blockchain_placeholder_n, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 236, __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_18polluck_blockchain_18placeholder_native_Blockchain, __pyx_mstate_global->__pyx_n_u_new_block, __pyx_t_2) < (0)) __PYX_ERR(0, 212, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain, __pyx_mstate_global->__pyx_n_u_new_block, __pyx_t_2) < (0)) __PYX_ERR(0, 236, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "(tree fragment)":1 @@ -6927,7 +7381,7 @@ __Pyx_RefNannySetupContext("PyInit_placeholder_native", 0); * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_18polluck_blockchain_18placeholder_native_10Blockchain_15__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_polluck_blockchain_placeholder_n, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_18polluck_blockchain_18placeholder_native_10Blockchain_17__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_polluck_blockchain_placeholder_n, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); @@ -6941,7 +7395,7 @@ __Pyx_RefNannySetupContext("PyInit_placeholder_native", 0); * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_18polluck_blockchain_18placeholder_native_10Blockchain_17__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_polluck_blockchain_placeholder_n, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_18polluck_blockchain_18placeholder_native_10Blockchain_19__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Blockchain___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_polluck_blockchain_placeholder_n, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); @@ -6995,6 +7449,7 @@ __Pyx_RefNannySetupContext("PyInit_placeholder_native", 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, 193, __pyx_L1_error) /* Cached unbound methods */ __pyx_mstate->__pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type; @@ -7004,6 +7459,8 @@ static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) { __pyx_mstate->__pyx_umethod_PyDict_Type_values.type = (PyObject*)&PyDict_Type; __pyx_mstate->__pyx_umethod_PyDict_Type_values.method_name = &__pyx_mstate->__pyx_n_u_values; return 0; + __pyx_L1_error:; + return -1; } /* #### Code section: cached_constants ### */ @@ -7012,14 +7469,14 @@ static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "polluck_blockchain/placeholder_native.pyx":54 + /* "polluck_blockchain/placeholder_native.pyx":55 * self.BlockC = new Block( * index, * datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp(), # <<<<<<<<<<<<<< * nonce, * data.encode("UTF-8"), */ - __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(6, __pyx_mstate_global->__pyx_int_2025, __pyx_mstate_global->__pyx_int_12, __pyx_mstate_global->__pyx_int_1, __pyx_mstate_global->__pyx_int_12, __pyx_mstate_global->__pyx_int_0, __pyx_mstate_global->__pyx_int_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(0, 54, __pyx_L1_error) + __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(6, __pyx_mstate_global->__pyx_int_2025, __pyx_mstate_global->__pyx_int_12, __pyx_mstate_global->__pyx_int_1, __pyx_mstate_global->__pyx_int_12, __pyx_mstate_global->__pyx_int_0, __pyx_mstate_global->__pyx_int_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]); #if CYTHON_IMMORTAL_CONSTANTS @@ -7045,34 +7502,34 @@ 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: 7; } index[] = {{33},{25},{29},{28},{5},{1},{2},{7},{6},{2},{9},{50},{45},{14},{10},{28},{30},{31},{20},{20},{7},{25},{27},{20},{12},{18},{5},{18},{20},{4},{8},{11},{20},{6},{8},{13},{8},{9},{12},{7},{3},{5},{13},{5},{8},{10},{8},{9},{7},{5},{4},{37},{3},{10},{9},{13},{11},{14},{12},{10},{17},{13},{4},{12},{10},{12},{19},{6},{8},{4},{9},{6},{0},{1},{13},{10},{52},{117},{101},{9}}; - #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (809 bytes) */ -const char* const cstring = "BZh91AY&SY\240\321\327G\000\000I\377\373l\337\365\216t\037\354\305\277\363\367T\277\377\377\340@@@@@@@@@@@\000@\002\335k\000(HjhMM\244\312yM\244\317T\323M\032\006&\200\320\000\000\000zF\020\364\231<\220\211 z\231\036\210\001\240\000\000\006\200\003A\240\r\000\001\240\016\032\0322h\321\243M\014\214\206\020\006@\014\203M\000\0002\006@\022\232D\304ODi2b\217\324\325\037\251\224\014\232h\320\000\000\000\000\031\223G\245>@:\374]^O'Y\306\020s\261\t!2\254p\"3v9\004-,\031\204P\202\022\264\034\305\035\334\021\022-\217\271\311\277\024\215\205\\k\362c\212\223 \320AF\023C)v\272\351\210\233wdT\2514\207\300\006\241\222\201D0R\023\026\220bL\320\330E\2061\267\034\014v\033\363\341:\031\002q\201\256\224svG\004+\215\230\356\325\312[j\021\235\246\333\314\rp\340\355J\356\306-z\215\225\202b\272\306\260\027\334\350\005,?\323\351\270\n\022a)\205\221\2675^\303!8x\371\226\314\213>\237\360\361\333\373\030\313\333\\\300\300A,l\235\216\335\003\260\212J\031\220I\337\311$P0\212\0313Q\032+\037h\245\247\021h\336f|\263\315\265^*\240*\030\243qq\t+\347\260a\210\264d\306)\031\026@\244\252\222I\"\207\215\3426\231D\254\021WE\250\347\210[\023h\315\215\037U\021\025E\004i\020\023\207\0079\354\244\242\245\215\271\027\213\345\315l\016\031\254O\030\370<\304\305\254\205\344\017Q-\310\272\"\245\364(\315\263\r\211P\020\201xr\260\262\202\205c(\340\316)\"8ad\325\221>\305\366HB\2602\253I\223\\j3\262\247L\347\367\230\354\004\215\324\311\230d330\314Y\036@#M\347\252QF\313\312\245[\024 `f\031\345\212,)\321\252\215\251\305\223\303<\253\201\217&fz\313\225\317\270\220\265\356\274\302b2\222\261\0014-\023\037\303\305\212q\210\305E\367\014\2700+b6\265\317\300\257\020\232w\270c\3102m([i\250Sv\266\035\350\242\2022\232\220\311\253.\226\207\350r\2359/AT\320\215/dS\204Q\006\323\014\020T\217e\272\3528\206}jj\277[""\343q\320\276TV6\232b\003\334\"U8\320(\027\332\025\t\036G\0022O\036\301\231\006-}Z\301.\030\212\224\302\265\003\256\340\223\n\352\025X\214\342\224\245bD\221\205.\004\021X\033\222!\210\211,\316\242\342{;J\207wz\037*\370\236D\311\n\363\023=^\225\221oL\206\002\233\205\333\023\354$\225K\341\267m?s\355\026\351\225?F\317\315\211\r\310\205\341K\313\322\275\n\247?\274\\Y\006k\177\321\360\213\266^h\331\274\364\272\257\rI\240g\272C\016\251\035\266\206V\353\022\366U\352\306\327\352gH\342Ua\0074\250\363/\374]\311\024\341B@\000S\371p"; + PyObject *data = __Pyx_DecompressString(cstring, 893, 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 (711 bytes) */ -const char* const cstring = "x\332}SMo\0231\020UD%\242\222B[!8\000\322\266\342\0044\245\242\022\034PQ\372\001\244\022\205\240\026U\250\222\345\330\336\304\324ko\326\3364\271\365\230\243\217{\334\343\036s\344gp\334c\177\n\343\3354\rJ\305a\327\3173\236\361\233\231\347\206\020\212`\303\225\364\224\357\265as\356\251\366/F\214\347c.\030\335S\261\240\236T\306\303\345Q\346u\261\016p\270\0271\267\301^\207I\246\271\236\004\373<\322\246\336\224\224\r\274>\0261\363\300\245bS\244W\261\244\372\344\370\343\306\273\017;\224r\215\333\2021\351\376\035\302u\211\250T\036e>\216\205\361\020\212\030\215\tC\310\243\220\311( \"7L\304\373\034\013\360\022.\271AHGd3TB\304\344\034\025,H\027s\271\031\nLXW\t\312\"$\241\306>\253\207\303\301{\r\361\262\243U\034\021\266\263;=~\203\352\323k\311\320t\225D\350\037\237fF\033(\3756/)\232\202&-)\311\314\270;\314\314\331$\273(m\337\206\2733\313<\211\033\307\034\003\347\034\300\267\317\211AGl`\2763\377\270\371\345\340\347\327\243\003tr\274\207\365P\022\256\352DE0\n\016\344\3126\t\200\210Kd\"\350T\033\203\345\026\376\024\033\014\0373<`T\205P\001\326\234\350\031X\277v3I\024\314.R\001\nM\344Vg\005\256A\210\220\037K\202\320\264\005\005,\313@\240\250\256\340mN\007\334\t\007\301\325S\252\334\260@#\024@\257\\\241\201\242\261`\016I\034\300:m\237\003\220\000\004BX\010\245\314\013\242>/\210P\205a\304\372\345\241\0029*\016p\025\353b\203\020\210\006M\210:\3307N\246\216A/\306\242dq#\324\271\261M\rP\027LN\370\305\374&\354\001M\264>3Ut\313\204A\2641\314\026\031\350&\374\241\253\323\316\026\257L\277\3764y\206\205Hh\034\004C\367P\273\227\215\274zo\264=\212\354\252}ci\262\236\354\247\225\274\266j_$\215\244uU}\n\373Z\326\310Zy\365\221\345I/]\312Z\3271\306n\271\223\257\022\234\364\256\252k\351\303\364l\2742~>\306y\325K\027\2635\267,\244\237\263\335\014\273D\315\264\225\327\226\362\332C\333LZ\211\237\356gw\262\355L\217\327\307\207\277q\341Y\266wm/\251\024\370\376\250c[\026\002k\243C\213m\317]:\311\261l+\377\313\362$y\233\256\245@\355\301\350\302E\316\344Z\032\235\332\323\344,{<\256\214W\362\353\324\000""\376\324\236%?\322\255\313J\276\2608zi[\177\001\357N\367|"; - PyObject *data = __Pyx_DecompressString(cstring, 711, 1); + #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (786 bytes) */ +const char* const cstring = "x\332}SKo\0231\020VT\004\021\244@\240\242B<\264\251@\342\325\024D%8 P\037<\212x\005\265\022B\225,\307v\022S\257\275Y{Cr\343\230\243\217>\356q\2179\36238\356\261?\205\361f\233\026\245\342\260\353\3173\343\36173\2377\204P\004\033\256d\240:A\0336\007\201j\377`\304\004\035\314\005\243[*\0214\220\312\004x\032\312\202\036\326!\216\266b\34678\3502\3114\327\345\341\016\217\265i\356H\312\206\301\000\213\204\005\340R\211)\322\253DR\375e\264\351#\357\355\355\276Y}~\377\325KJ\271\306m\301\230\364\377.\341z\212\250T\001e\035\234\010\023 \0243\232\020\206P@!\245Q\300H\256\232\230\0178\026\340%\\r\203\220\216\311Z\244\204H\310\001*\350\220\036\346r-\022\230\260\236\022\224\305HB\261\003\326\214F\303\027\032\316\313\256VIL\330\313\315Y\3701j\316\256%#\323S\022\241\177|\232\031m\240\007\247yI\321\035T\366fJ\346\204\273\313\314\234M\262\237s\266\010\030\032t\300F\250\350%\2120\217\313\376\225\313<\307c\307\034A\357\034\302\267\315\211A\237\330\320|e\235\335\235\217\257\277\177\376\364\032\355\355na=\222\204\253&Q1\214\214\003\367i\027\005@\304%214\262\215\301rJy\024\033\014\0373p\033\256uX\275\t\373Z\266\221\265\362\3525\313]?]\314ZGg\214}\342#\0379\354\372\207\325F\272\224\356O\352\223;\023\234W\203\364|\326\360\313\231\364]\266\231a\237h'm\345\265\305\274\266dw\\\313u\322\355l![\317\364de\362\3767.<\227\3559\333w\225\002_\034wm\313\302\301\332\370\275\305\266\357/-s\\\266\225\377e\271\341\236\245""\215\024\250]\032\377\364'O\344Z\034\177\263\373\351rV\311\352\371Qb\000\177j\267\\Q\325\335t7[\236\234\235@\350\3051\261W\355\266;\347\214\317U\267u(\224\244u\177\363\207t\301\333n;\236\366\263\312\324\331\310k\327]\3355~U\3623\347\307\017m\353/t\0371\325"; + PyObject *data = __Pyx_DecompressString(cstring, 786, 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 (1272 bytes) */ -const char* const bytes = "Allocation of block object failedCould not allocate hasmapCreate a genesis block first.Index value is out of boundsUTF-8?>ddisableenablegcisenabledno default __reduce__ due to non-trivial __cinit__src/polluck_blockchain/placeholder_native.pyxBlockchainBlockchain.__reduce_cython__Blockchain.__setstate_cython__Blockchain.create_genesis_blockBlockchain.get_blockBlockchain.new_blockPyBlockPyBlock.__reduce_cython__PyBlock.__setstate_cython____Pyx_PyDict_NextRefTIMEZONE_UTCasyncio.coroutinesblockcline_in_tracebackcreate_genesis_blockdatadatetimedopt_basicsdopt_basics.datetimeencodefrom_ptrfromtimestamp__func__get_block__getstate__hashlibidxindex_is_coroutineitems__main____module____name__new_blocknew_idxnoncepackpolluck_blockchain.placeholder_nativepopprev_blockprev_hashprevious_hash__pyx_state__pyx_vtable____qualname____reduce____reduce_cython____reduce_ex__self__set_name__setdefault__setstate____setstate_cython__struct__test__timetimestampvalues0Genesis Blockdummy hash\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\026\220i\230q\240\r\250Q\200A\330\010\013\2104\210t\2201\330\014\022\220,\230a\230q\340\010!\240\024\240\\\260\021\260$\260a\330\010 \240\n\250!\330\010 \240\004\240H\250B\250a\340\010\034\230I\240Q\330\014\r\330\014\024\220I\230Q\230f\240D\250\003\2504\250s\260\"\260J\270a\330\014\r\330\014\020\220\007\220q\230\001\330\014\r\330\014\016\210g\220Q\220a\340\010\014\210J\220a\220q\200A\330\010\034\230I\240Q\330\014\020\220\001\330\014\024\220I\230Q\230f\240D\250\003\2504\250s\260\"\260J\270a\330\014\r\330\014\033\2307\240!\2401\330\014\017\210w\220a\220q\330\014\016\210g\220Q\220a\340\010\r\210X\220X\230\\\250\027\260\001\260\021\330\010\014\210J\220a\220q\330\010\014\320\014\035\230V\2401\200\001\330\004\n\210+\220Q"; + #else /* compression: none (1422 bytes) */ +const char* const bytes = "Allocation of block object failedCould not allocate hasmapCreate a genesis block first.Index value is out of boundsPyBlock(UTF-8)?>ddisableenablegcisenabledno default __reduce__ due to non-trivial __cinit__src/polluck_blockchain/placeholder_native.pyxBlockchainBlockchain.__reduce_cython__Blockchain.__setstate_cython__Blockchain.create_genesis_blockBlockchain.get_blockBlockchain.new_blockBlockchain.print_key_value_pairPyBlockPyBlock.__reduce_cython__PyBlock.__setstate_cython____Pyx_PyDict_NextRefTIMEZONE_UTCasyncio.coroutinesblockcline_in_tracebackcreate_genesis_blockdatadatetimedopt_basicsdopt_basics.datetimeencodefrom_ptrfromtimestamp__func__get_block__getstate__hashlibidxindex_is_coroutineititems__main____module____name__new_blocknew_idxnoncepackpolluck_blockchain.placeholder_nativepopprev_blockprev_hashprevious_hashprintprint_key_value_pairpy_block__pyx_state__pyx_vtable____qualname____reduce____reduce_cython____reduce_ex____repr__self__set_name__setdefault__setstate____setstate_cython__struct__test__timetimestampvalues0Genesis Blockdummy hash\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\026\220i\230q\240\r\250Q\200A\330\010\013\2104\210t\2201\330\014\022\220,\230a\230q\340\010!\240\024\240\\\260\021\260$\260a\330\010 \240\n\250!\330\010 \240\004\240H\250B\250a\340\010\034\230I\240Q\330\014\r\330\014\024\220I\230Q\230f\240D\250\003\2504\250s\260\"\260J\270a\330\014\r\330\014\020\220\007\220q\230\001\330\014\r\330\014\016\210g\220Q\220a\340\010\014\210J\220a\220q\200A\330\010\034\230I\240Q\330\014\020\220\001\330\014\024\220I\230Q\230f\240D\250\003\2504\250s\260\"\260J\270a\330\014\r\330\014\033\2307\240!\2401\330\014\017\210w\220a\220q\330\014\016\210g\220Q\220a\340\010\r\210X\220\\\240\027\250\001\250\021\330\010\014\210J\220a\220q\330\010\014\320\014\035\230Q\200A\330\010%\240T\250\027\260\006\260a\340\010\016\210c\220\023\220D\230\007\230t\2401\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!\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 < 72; i++) { + for (int i = 0; i < 80; i++) { Py_ssize_t bytes_length = index[i].length; PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL); - if (likely(string) && i >= 14) PyUnicode_InternInPlace(&string); + if (likely(string) && i >= 16) PyUnicode_InternInPlace(&string); if (unlikely(!string)) { Py_XDECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) @@ -7080,7 +7537,7 @@ const char* const bytes = "Allocation of block object failedCould not allocate h stringtab[i] = string; pos += bytes_length; } - for (int i = 72; i < 80; i++) { + for (int i = 80; i < 89; i++) { Py_ssize_t bytes_length = index[i].length; PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length); stringtab[i] = string; @@ -7091,15 +7548,15 @@ const char* const bytes = "Allocation of block object failedCould not allocate h } } Py_XDECREF(data); - for (Py_ssize_t i = 0; i < 80; i++) { + for (Py_ssize_t i = 0; i < 89; i++) { if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { __PYX_ERR(0, 1, __pyx_L1_error) } } #if CYTHON_IMMORTAL_CONSTANTS { - PyObject **table = stringtab + 72; - for (Py_ssize_t i=0; i<8; ++i) { + PyObject **table = stringtab + 80; + for (Py_ssize_t i=0; i<9; ++i) { #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); #else @@ -7168,29 +7625,34 @@ static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) { __pyx_mstate_global->__pyx_codeobj_tab[1] = __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[1])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 187}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 189}; + 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[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_polluck_blockchain_placehold, __pyx_mstate->__pyx_n_u_print_key_value_pair, __pyx_mstate->__pyx_kp_b_iso88591_A_T_a_c_D_t1_c_L_1_iq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 211}; 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[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_polluck_blockchain_placehold, __pyx_mstate->__pyx_n_u_get_block, __pyx_mstate->__pyx_kp_b_iso88591_A_4r_3d_D_AQ_D_AQ_iq_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad; + __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_polluck_blockchain_placehold, __pyx_mstate->__pyx_n_u_get_block, __pyx_mstate->__pyx_kp_b_iso88591_A_4r_3d_D_AQ_D_AQ_iq_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 199}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 223}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_block}; - __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_polluck_blockchain_placehold, __pyx_mstate->__pyx_n_u_create_genesis_block, __pyx_mstate->__pyx_kp_b_iso88591_A_IQ_IQfD_4s_Ja_7_1_waq_gQa_XX_J, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad; + __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_polluck_blockchain_placehold, __pyx_mstate->__pyx_n_u_create_genesis_block, __pyx_mstate->__pyx_kp_b_iso88591_A_IQ_IQfD_4s_Ja_7_1_waq_gQa_X_Ja, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 212}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 236}; 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_block}; - __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_polluck_blockchain_placehold, __pyx_mstate->__pyx_n_u_new_block, __pyx_mstate->__pyx_kp_b_iso88591_A_4t1_aq_a_HBa_IQ_IQfD_4s_Ja_q_g, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad; + __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_polluck_blockchain_placehold, __pyx_mstate->__pyx_n_u_new_block, __pyx_mstate->__pyx_kp_b_iso88591_A_4t1_aq_a_HBa_IQ_IQfD_4s_Ja_q_g, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; - __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad; + __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state}; - __pyx_mstate_global->__pyx_codeobj_tab[6] = __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[6])) goto bad; + __pyx_mstate_global->__pyx_codeobj_tab[7] = __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[7])) goto bad; } Py_DECREF(tuple_dedup_map); return 0; @@ -7408,7 +7870,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, P #endif } -/* GetBuiltinName (used by GetModuleGlobalName) */ +/* GetBuiltinName */ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_mstate_global->__pyx_b, name); if (unlikely(!result) && !PyErr_Occurred()) { @@ -8673,6 +9135,84 @@ static int __Pyx_CheckKeywordStrings( #endif } +/* JoinPyUnicode */ +static PyObject* __Pyx_PyUnicode_Join(PyObject** values, Py_ssize_t value_count, Py_ssize_t result_ulength, + Py_UCS4 max_char) { +#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + PyObject *result_uval; + int result_ukind, kind_shift; + Py_ssize_t i, char_pos; + void *result_udata; + if (max_char > 1114111) max_char = 1114111; + result_uval = PyUnicode_New(result_ulength, max_char); + if (unlikely(!result_uval)) return NULL; + result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND; + kind_shift = (result_ukind == PyUnicode_4BYTE_KIND) ? 2 : result_ukind - 1; + result_udata = PyUnicode_DATA(result_uval); + assert(kind_shift == 2 || kind_shift == 1 || kind_shift == 0); + if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - result_ulength < 0)) + goto overflow; + char_pos = 0; + for (i=0; i < value_count; i++) { + int ukind; + Py_ssize_t ulength; + void *udata; + PyObject *uval = values[i]; + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_PyUnicode_READY(uval) == (-1)) + goto bad; + #endif + ulength = __Pyx_PyUnicode_GET_LENGTH(uval); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(ulength < 0)) goto bad; + #endif + if (unlikely(!ulength)) + continue; + if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - ulength < char_pos)) + goto overflow; + ukind = __Pyx_PyUnicode_KIND(uval); + udata = __Pyx_PyUnicode_DATA(uval); + if (ukind == result_ukind) { + memcpy((char *)result_udata + (char_pos << kind_shift), udata, (size_t) (ulength << kind_shift)); + } else { + #if PY_VERSION_HEX >= 0x030d0000 + if (unlikely(PyUnicode_CopyCharacters(result_uval, char_pos, uval, 0, ulength) < 0)) goto bad; + #elif CYTHON_COMPILING_IN_CPYTHON || defined(_PyUnicode_FastCopyCharacters) + _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength); + #else + Py_ssize_t j; + for (j=0; j < ulength; j++) { + Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j); + __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar); + } + #endif + } + char_pos += ulength; + } + return result_uval; +overflow: + PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string"); +bad: + Py_DECREF(result_uval); + return NULL; +#else + Py_ssize_t i; + PyObject *result = NULL; + PyObject *value_tuple = PyTuple_New(value_count); + if (unlikely(!value_tuple)) return NULL; + CYTHON_UNUSED_VAR(max_char); + CYTHON_UNUSED_VAR(result_ulength); + for (i=0; i__pyx_empty_unicode, value_tuple); +bad: + Py_DECREF(value_tuple); + return result; +#endif +} + /* decode_c_bytes (used by decode_cpp_string) */ static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes( const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop, @@ -11673,7 +12213,7 @@ __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp) result = name; name = NULL; } else { - result = __Pyx_NewRef(__pyx_mstate_global->__pyx_kp_u__2); + result = __Pyx_NewRef(__pyx_mstate_global->__pyx_kp_u__3); } goto done; } diff --git a/src/polluck_blockchain/placeholder_native.pyx b/src/polluck_blockchain/placeholder_native.pyx index 0f12a00..f6ec72a 100644 --- a/src/polluck_blockchain/placeholder_native.pyx +++ b/src/polluck_blockchain/placeholder_native.pyx @@ -17,6 +17,7 @@ from polluck_blockchain.block cimport Block from libcpp.unordered_map cimport unordered_map from libcpp.string cimport string from libc.stdint cimport uint64_t +from cython.operator import postincrement, dereference ctypedef unsigned long ULong ctypedef unordered_map[uint64_t, Block*] BcHashmap @@ -92,6 +93,12 @@ cdef class PyBlock: return py_block + def __repr__(self): + return f"PyBlock({self.index, self.timestamp, self.nonce, self.data})" + + def __str__(self): + return self.__repr__() + # cpdef _perform_hash(self): # parts = bytearray() # parts.extend(self._index.to_bytes(8, "big")) @@ -164,15 +171,29 @@ cdef class Blockchain: def __init__(self, *args, **kwargs): pass - # TODO add entries of map - # ownership is typically not transferred from the Blockchain extension class def __dealloc__(self): + # ownership is typically not transferred from the Blockchain extension class + cdef BcHashmap.iterator it = self._chain.begin() if self._chain is not NULL: + while it != self._chain.end(): + del dereference(it).second + postincrement(it) + del self._chain self._chain = NULL def __len__(self): return self._index + 1 + + def print_key_value_pair(self): + cdef BcHashmap.iterator it = self._chain.begin() + cdef Block *block + while it != self._chain.end(): + print(dereference(it).first) + block = dereference(it).second + py_block = PyBlock.from_ptr(block) + print(py_block) + postincrement(it) @property def genesis_done(self): @@ -207,9 +228,9 @@ cdef class Blockchain: "0".encode("UTF-8"), "".encode("UTF-8"), ) - block.hash = "dummy hash".encode("UTF-8") + block.hash = "dummy hash".encode("UTF-8") self.add_block(block) - self._genesis_done = 1 + self._genesis_done = True def new_block(self, data): if not self._genesis_done: