diff --git a/src/polluck_blockchain/block.hpp b/src/polluck_blockchain/block.hpp index 3234b92..e11cef9 100644 --- a/src/polluck_blockchain/block.hpp +++ b/src/polluck_blockchain/block.hpp @@ -11,6 +11,6 @@ struct Block { std::string hash; Block() : index(0), timestamp(0), nonce(0), data(), prev_hash(), hash() {} - Block(uint64_t idx, double ts, uint64_t n, const std::string& d, const std::string& pre_h, const std::string& h) + Block(uint64_t idx, uint64_t ts, uint64_t n, const std::string& d, const std::string& pre_h, const std::string& h) : index(idx), timestamp(ts), nonce(n), data(d), prev_hash(pre_h), hash(h) {} }; diff --git a/src/polluck_blockchain/block.pxd b/src/polluck_blockchain/block.pxd index 9b58cb3..608700e 100644 --- a/src/polluck_blockchain/block.pxd +++ b/src/polluck_blockchain/block.pxd @@ -4,7 +4,7 @@ from libc cimport stdint cdef extern from "block.hpp" namespace "": cdef cppclass Block: stdint.uint64_t index - double timestamp + stdint.uint64_t timestamp stdint.uint64_t nonce string data string prev_hash diff --git a/src/polluck_blockchain/placeholder_native.cpp b/src/polluck_blockchain/placeholder_native.cpp index 271d6ec..adce004 100644 --- a/src/polluck_blockchain/placeholder_native.cpp +++ b/src/polluck_blockchain/placeholder_native.cpp @@ -1171,6 +1171,7 @@ static int __Pyx_init_co_variables(void) { #endif #include +#include #ifdef _OPENMP #include #endif /* _OPENMP */ @@ -1553,8 +1554,8 @@ static const char* const __pyx_f[] = { /* #### Code section: numeric_typedefs ### */ -/* "polluck_blockchain/placeholder_native.pyx":22 - * from cython.operator import postincrement, dereference +/* "polluck_blockchain/placeholder_native.pyx":25 + * * * ctypedef unsigned long ULong # <<<<<<<<<<<<<< * ctypedef unordered_map[uint64_t, Block*] BcHashmap @@ -1567,18 +1568,31 @@ typedef unsigned long __pyx_t_18polluck_blockchain_18placeholder_native_ULong; /*--- Type declarations ---*/ struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock; struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain; +struct __pyx_t_18polluck_blockchain_18placeholder_native_SerializeResult; struct __pyx_opt_args_18polluck_blockchain_18placeholder_native_7PyBlock_from_ptr; -/* "polluck_blockchain/placeholder_native.pyx":23 +/* "polluck_blockchain/placeholder_native.pyx":26 * * ctypedef unsigned long ULong * ctypedef unordered_map[uint64_t, Block*] BcHashmap # <<<<<<<<<<<<<< * - * cdef timestamp_to_datetime(double ts): + * cdef timestamp_to_datetime(uint64_t ts): */ typedef std::unordered_map __pyx_t_18polluck_blockchain_18placeholder_native_BcHashmap; -/* "polluck_blockchain/placeholder_native.pyx":82 +/* "polluck_blockchain/placeholder_native.pyx":51 + * out[7] = v & 0xFF + * + * cdef struct SerializeResult: # <<<<<<<<<<<<<< + * unsigned char *ptr + * size_t size +*/ +struct __pyx_t_18polluck_blockchain_18placeholder_native_SerializeResult { + unsigned char *ptr; + size_t size; +}; + +/* "polluck_blockchain/placeholder_native.pyx":97 * * @staticmethod * cdef PyBlock from_ptr(Block *block, bint owner=False): # <<<<<<<<<<<<<< @@ -1590,8 +1604,8 @@ struct __pyx_opt_args_18polluck_blockchain_18placeholder_native_7PyBlock_from_pt int owner; }; -/* "polluck_blockchain/placeholder_native.pyx":33 - * +/* "polluck_blockchain/placeholder_native.pyx":55 + * size_t size * * cdef class PyBlock: # <<<<<<<<<<<<<< * cdef: @@ -1605,7 +1619,7 @@ struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock { }; -/* "polluck_blockchain/placeholder_native.pyx":157 +/* "polluck_blockchain/placeholder_native.pyx":225 * * * cdef class Blockchain: # <<<<<<<<<<<<<< @@ -1623,8 +1637,8 @@ struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain { -/* "polluck_blockchain/placeholder_native.pyx":33 - * +/* "polluck_blockchain/placeholder_native.pyx":55 + * size_t size * * cdef class PyBlock: # <<<<<<<<<<<<<< * cdef: @@ -1633,11 +1647,12 @@ struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain { struct __pyx_vtabstruct_18polluck_blockchain_18placeholder_native_PyBlock { struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *(*from_ptr)(::Block *, struct __pyx_opt_args_18polluck_blockchain_18placeholder_native_7PyBlock_from_ptr *__pyx_optional_args); + struct __pyx_t_18polluck_blockchain_18placeholder_native_SerializeResult (*bytes_serialize_c)(struct __pyx_obj_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":157 +/* "polluck_blockchain/placeholder_native.pyx":225 * * * cdef class Blockchain: # <<<<<<<<<<<<<< @@ -2037,12 +2052,6 @@ static CYTHON_INLINE int __Pyx_ParseKeywords( static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); -/* PyMemoryError_Check.proto */ -#define __Pyx_PyExc_MemoryError_Check(obj) __Pyx_TypeCheck(obj, PyExc_MemoryError) - -/* RaiseException.export */ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); - /* KeywordStringCheck.proto */ static CYTHON_INLINE int __Pyx_CheckKeywordStrings(const char* function_name, PyObject *kw); @@ -2102,9 +2111,47 @@ static CYTHON_INLINE PyObject* __Pyx_decode_cpp_string( /* RejectKeywords.export */ static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds); +/* GetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); +#endif + +/* SwapException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); +#endif + +/* GetTopmostException.proto (used by SaveResetException) */ +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE +static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); +#endif + +/* SaveResetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +#else +#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) +#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) +#endif + /* PyTypeError_Check.proto */ #define __Pyx_PyExc_TypeError_Check(obj) __Pyx_TypeCheck(obj, PyExc_TypeError) +/* RaiseException.export */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); + +/* PyMemoryError_Check.proto */ +#define __Pyx_PyExc_MemoryError_Check(obj) __Pyx_TypeCheck(obj, PyExc_MemoryError) + /* PyIndexError_Check.proto */ #define __Pyx_PyExc_IndexError_Check(obj) __Pyx_TypeCheck(obj, PyExc_IndexError) @@ -2395,9 +2442,6 @@ static void __Pyx_CppExn2PyErr() { } #endif -/* CIntFromPy.proto */ -static CYTHON_INLINE uint64_t __Pyx_PyLong_As_uint64_t(PyObject *); - /* PyObjectVectorCallKwBuilder.proto (used by CIntToPy) */ CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n); #if CYTHON_VECTORCALL @@ -2419,6 +2463,9 @@ static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, P /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value); +/* CIntFromPy.proto */ +static CYTHON_INLINE uint64_t __Pyx_PyLong_As_uint64_t(PyObject *); + /* FormatTypeName.proto */ #if CYTHON_COMPILING_IN_LIMITED_API typedef PyObject *__Pyx_TypeName; @@ -2532,6 +2579,7 @@ static int __Pyx_State_RemoveModule(void*); #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." 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); /* proto*/ +static struct __pyx_t_18polluck_blockchain_18placeholder_native_SerializeResult __pyx_f_18polluck_blockchain_18placeholder_native_7PyBlock_bytes_serialize_c(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self); /* proto*/ 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); /* proto*/ 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); /* proto*/ @@ -2553,8 +2601,11 @@ static void __pyx_f_18polluck_blockchain_18placeholder_native_10Blockchain_add_b /* Module declarations from "libcpp.unordered_map" */ +/* Module declarations from "libc.stdlib" */ + /* Module declarations from "polluck_blockchain.placeholder_native" */ -static PyObject *__pyx_f_18polluck_blockchain_18placeholder_native_timestamp_to_datetime(double); /*proto*/ +static PyObject *__pyx_f_18polluck_blockchain_18placeholder_native_timestamp_to_datetime(uint64_t); /*proto*/ +static int __pyx_f_18polluck_blockchain_18placeholder_native_serialize_uint64(unsigned char *, unsigned PY_LONG_LONG); /*proto*/ static std::string __pyx_convert_string_from_py_6libcpp_6string_std__in_string(PyObject *); /*proto*/ static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string(std::string const &); /*proto*/ static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string(std::string const &); /*proto*/ @@ -2582,8 +2633,9 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4da 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_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 PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_10bytes_serialize(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_12__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_14__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 */ @@ -2626,8 +2678,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[8]; - PyObject *__pyx_string_tab[89]; + PyObject *__pyx_codeobj_tab[9]; + PyObject *__pyx_string_tab[92]; PyObject *__pyx_number_tab[4]; /* #### Code section: module_state_contents ### */ /* CommonTypesMetaclass.module_state_decls */ @@ -2669,36 +2721,36 @@ static __pyx_mstatetype __pyx_mstate_global_static = static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_static; #endif /* #### Code section: constant_name_defines ### */ -#define __pyx_kp_u_Allocation_of_block_object_faile __pyx_string_tab[0] -#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_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_kp_u_Could_not_allocate_hasmap __pyx_string_tab[0] +#define __pyx_kp_u_Create_a_genesis_block_first __pyx_string_tab[1] +#define __pyx_kp_u_Index_value_is_out_of_bounds __pyx_string_tab[2] +#define __pyx_kp_u_PyBlock __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__3 __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_Blockchain_print_key_value_pair __pyx_string_tab[20] +#define __pyx_n_u_PyBlock_2 __pyx_string_tab[21] +#define __pyx_n_u_PyBlock___reduce_cython __pyx_string_tab[22] +#define __pyx_n_u_PyBlock___setstate_cython __pyx_string_tab[23] +#define __pyx_n_u_PyBlock_bytes_serialize __pyx_string_tab[24] +#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[25] +#define __pyx_n_u_TIMEZONE_UTC __pyx_string_tab[26] +#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[27] +#define __pyx_n_u_block __pyx_string_tab[28] +#define __pyx_n_u_bytes_serialize __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] @@ -2723,14 +2775,14 @@ static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_stati #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_polluck_blockchain_placeholder_n __pyx_string_tab[54] +#define __pyx_n_u_pop __pyx_string_tab[55] +#define __pyx_n_u_prev_block __pyx_string_tab[56] +#define __pyx_n_u_prev_hash __pyx_string_tab[57] +#define __pyx_n_u_previous_hash __pyx_string_tab[58] +#define __pyx_n_u_print __pyx_string_tab[59] +#define __pyx_n_u_print_key_value_pair __pyx_string_tab[60] +#define __pyx_n_u_ptr __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] @@ -2740,24 +2792,27 @@ static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_stati #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_n_u_serialize_res __pyx_string_tab[71] +#define __pyx_n_u_set_name __pyx_string_tab[72] +#define __pyx_n_u_setdefault __pyx_string_tab[73] +#define __pyx_n_u_setstate __pyx_string_tab[74] +#define __pyx_n_u_setstate_cython __pyx_string_tab[75] +#define __pyx_n_u_size __pyx_string_tab[76] +#define __pyx_n_u_struct __pyx_string_tab[77] +#define __pyx_n_u_test __pyx_string_tab[78] +#define __pyx_n_u_time __pyx_string_tab[79] +#define __pyx_n_u_timestamp __pyx_string_tab[80] +#define __pyx_n_u_values __pyx_string_tab[81] +#define __pyx_kp_b_ __pyx_string_tab[82] +#define __pyx_kp_b_0 __pyx_string_tab[83] +#define __pyx_kp_b_Genesis_Block __pyx_string_tab[84] +#define __pyx_kp_b_dummy_hash __pyx_string_tab[85] +#define __pyx_kp_b_iso88591_A_4r_3d_D_AQ_D_AQ_iq_Q __pyx_string_tab[86] +#define __pyx_kp_b_iso88591_A_4t1_aq_a_HBa_IQ_q_Ct3b_q_gQa_J __pyx_string_tab[87] +#define __pyx_kp_b_iso88591_A_D_2_Bm1_a __pyx_string_tab[88] +#define __pyx_kp_b_iso88591_A_IQ_q_Ct3b_7_1_waq_gQa_X_Jaq_Q __pyx_string_tab[89] +#define __pyx_kp_b_iso88591_A_T_a_c_D_t1_c_L_1_iq __pyx_string_tab[90] +#define __pyx_kp_b_iso88591_Q __pyx_string_tab[91] #define __pyx_int_0 __pyx_number_tab[0] #define __pyx_int_1 __pyx_number_tab[1] #define __pyx_int_12 __pyx_number_tab[2] @@ -2781,8 +2836,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<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<9; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<92; ++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 */ @@ -2811,8 +2866,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<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<9; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<92; ++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 */ @@ -3208,15 +3263,15 @@ static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_6libcpp_6s return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":25 +/* "polluck_blockchain/placeholder_native.pyx":28 * ctypedef unordered_map[uint64_t, Block*] BcHashmap * - * cdef timestamp_to_datetime(double ts): # <<<<<<<<<<<<<< - * return datetime.datetime.fromtimestamp(ts, dopt_basics.datetime.TIMEZONE_UTC) + * cdef timestamp_to_datetime(uint64_t ts): # <<<<<<<<<<<<<< + * return datetime.datetime.fromtimestamp(float(ts), dopt_basics.datetime.TIMEZONE_UTC) * */ -static PyObject *__pyx_f_18polluck_blockchain_18placeholder_native_timestamp_to_datetime(double __pyx_v_ts) { +static PyObject *__pyx_f_18polluck_blockchain_18placeholder_native_timestamp_to_datetime(uint64_t __pyx_v_ts) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3231,29 +3286,29 @@ 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":26 + /* "polluck_blockchain/placeholder_native.pyx":29 * - * cdef timestamp_to_datetime(double ts): - * return datetime.datetime.fromtimestamp(ts, dopt_basics.datetime.TIMEZONE_UTC) # <<<<<<<<<<<<<< + * cdef timestamp_to_datetime(uint64_t ts): + * return datetime.datetime.fromtimestamp(float(ts), dopt_basics.datetime.TIMEZONE_UTC) # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); - __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_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 29, __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, 26, __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, 29, __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, 26, __pyx_L1_error) + __pyx_t_3 = PyFloat_FromDouble(((double)__pyx_v_ts)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 29, __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, 26, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_dopt_basics); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 29, __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, 26, __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, 29, __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, 26, __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, 29, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_7 = 0; @@ -3264,18 +3319,18 @@ 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, 26, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __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":25 + /* "polluck_blockchain/placeholder_native.pyx":28 * ctypedef unordered_map[uint64_t, Block*] BcHashmap * - * cdef timestamp_to_datetime(double ts): # <<<<<<<<<<<<<< - * return datetime.datetime.fromtimestamp(ts, dopt_basics.datetime.TIMEZONE_UTC) + * cdef timestamp_to_datetime(uint64_t ts): # <<<<<<<<<<<<<< + * return datetime.datetime.fromtimestamp(float(ts), dopt_basics.datetime.TIMEZONE_UTC) * */ @@ -3295,91 +3350,163 @@ static PyObject *__pyx_f_18polluck_blockchain_18placeholder_native_timestamp_to_ return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":29 - * - * - * cdef float_to_bytes(double num): # <<<<<<<<<<<<<< - * return struct.pack(">d", num) +/* "polluck_blockchain/placeholder_native.pyx":35 + * # return struct.pack(">d", num) * + * cdef int serialize_uint32(unsigned char* out, unsigned int v) except -1 nogil: # <<<<<<<<<<<<<< + * out[0] = (v >> 24) & 0xFF + * out[1] = (v >> 16) & 0xFF */ -static PyObject *__pyx_f_18polluck_blockchain_18placeholder_native_float_to_bytes(double __pyx_v_num) { - 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; - size_t __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("float_to_bytes", 0); +static int __pyx_f_18polluck_blockchain_18placeholder_native_serialize_uint32(unsigned char *__pyx_v_out, unsigned int __pyx_v_v) { + int __pyx_r; - /* "polluck_blockchain/placeholder_native.pyx":30 - * - * cdef float_to_bytes(double num): - * return struct.pack(">d", num) # <<<<<<<<<<<<<< + /* "polluck_blockchain/placeholder_native.pyx":36 * + * cdef int serialize_uint32(unsigned char* out, unsigned int v) except -1 nogil: + * out[0] = (v >> 24) & 0xFF # <<<<<<<<<<<<<< + * out[1] = (v >> 16) & 0xFF + * out[2] = (v >> 8) & 0xFF +*/ + (__pyx_v_out[0]) = ((__pyx_v_v >> 24) & 0xFF); + + /* "polluck_blockchain/placeholder_native.pyx":37 + * cdef int serialize_uint32(unsigned char* out, unsigned int v) except -1 nogil: + * out[0] = (v >> 24) & 0xFF + * out[1] = (v >> 16) & 0xFF # <<<<<<<<<<<<<< + * out[2] = (v >> 8) & 0xFF + * out[3] = v & 0xFF +*/ + (__pyx_v_out[1]) = ((__pyx_v_v >> 16) & 0xFF); + + /* "polluck_blockchain/placeholder_native.pyx":38 + * out[0] = (v >> 24) & 0xFF + * out[1] = (v >> 16) & 0xFF + * out[2] = (v >> 8) & 0xFF # <<<<<<<<<<<<<< + * out[3] = v & 0xFF * */ - __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, 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, 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, 30, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = 1; - #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); - assert(__pyx_t_2); - PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx__function); - __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); - __pyx_t_5 = 0; - } - #endif - { - PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_d, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); - __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, 30, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + (__pyx_v_out[2]) = ((__pyx_v_v >> 8) & 0xFF); - /* "polluck_blockchain/placeholder_native.pyx":29 + /* "polluck_blockchain/placeholder_native.pyx":39 + * out[1] = (v >> 16) & 0xFF + * out[2] = (v >> 8) & 0xFF + * out[3] = v & 0xFF # <<<<<<<<<<<<<< * + * cdef int serialize_uint64(unsigned char* out, unsigned long long v) except -1 nogil: +*/ + (__pyx_v_out[3]) = (__pyx_v_v & 0xFF); + + /* "polluck_blockchain/placeholder_native.pyx":35 + * # return struct.pack(">d", num) * - * cdef float_to_bytes(double num): # <<<<<<<<<<<<<< - * return struct.pack(">d", num) - * + * cdef int serialize_uint32(unsigned char* out, unsigned int v) except -1 nogil: # <<<<<<<<<<<<<< + * out[0] = (v >> 24) & 0xFF + * out[1] = (v >> 16) & 0xFF */ /* 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_AddTraceback("polluck_blockchain.placeholder_native.float_to_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":44 +/* "polluck_blockchain/placeholder_native.pyx":41 + * out[3] = v & 0xFF + * + * cdef int serialize_uint64(unsigned char* out, unsigned long long v) except -1 nogil: # <<<<<<<<<<<<<< + * out[0] = (v >> 56) & 0xFF + * out[1] = (v >> 48) & 0xFF +*/ + +static int __pyx_f_18polluck_blockchain_18placeholder_native_serialize_uint64(unsigned char *__pyx_v_out, unsigned PY_LONG_LONG __pyx_v_v) { + int __pyx_r; + + /* "polluck_blockchain/placeholder_native.pyx":42 + * + * cdef int serialize_uint64(unsigned char* out, unsigned long long v) except -1 nogil: + * out[0] = (v >> 56) & 0xFF # <<<<<<<<<<<<<< + * out[1] = (v >> 48) & 0xFF + * out[2] = (v >> 40) & 0xFF +*/ + (__pyx_v_out[0]) = ((__pyx_v_v >> 56) & 0xFF); + + /* "polluck_blockchain/placeholder_native.pyx":43 + * cdef int serialize_uint64(unsigned char* out, unsigned long long v) except -1 nogil: + * out[0] = (v >> 56) & 0xFF + * out[1] = (v >> 48) & 0xFF # <<<<<<<<<<<<<< + * out[2] = (v >> 40) & 0xFF + * out[3] = (v >> 32) & 0xFF +*/ + (__pyx_v_out[1]) = ((__pyx_v_v >> 48) & 0xFF); + + /* "polluck_blockchain/placeholder_native.pyx":44 + * out[0] = (v >> 56) & 0xFF + * out[1] = (v >> 48) & 0xFF + * out[2] = (v >> 40) & 0xFF # <<<<<<<<<<<<<< + * out[3] = (v >> 32) & 0xFF + * out[4] = (v >> 24) & 0xFF +*/ + (__pyx_v_out[2]) = ((__pyx_v_v >> 40) & 0xFF); + + /* "polluck_blockchain/placeholder_native.pyx":45 + * out[1] = (v >> 48) & 0xFF + * out[2] = (v >> 40) & 0xFF + * out[3] = (v >> 32) & 0xFF # <<<<<<<<<<<<<< + * out[4] = (v >> 24) & 0xFF + * out[5] = (v >> 16) & 0xFF +*/ + (__pyx_v_out[3]) = ((__pyx_v_v >> 32) & 0xFF); + + /* "polluck_blockchain/placeholder_native.pyx":46 + * out[2] = (v >> 40) & 0xFF + * out[3] = (v >> 32) & 0xFF + * out[4] = (v >> 24) & 0xFF # <<<<<<<<<<<<<< + * out[5] = (v >> 16) & 0xFF + * out[6] = (v >> 8) & 0xFF +*/ + (__pyx_v_out[4]) = ((__pyx_v_v >> 24) & 0xFF); + + /* "polluck_blockchain/placeholder_native.pyx":47 + * out[3] = (v >> 32) & 0xFF + * out[4] = (v >> 24) & 0xFF + * out[5] = (v >> 16) & 0xFF # <<<<<<<<<<<<<< + * out[6] = (v >> 8) & 0xFF + * out[7] = v & 0xFF +*/ + (__pyx_v_out[5]) = ((__pyx_v_v >> 16) & 0xFF); + + /* "polluck_blockchain/placeholder_native.pyx":48 + * out[4] = (v >> 24) & 0xFF + * out[5] = (v >> 16) & 0xFF + * out[6] = (v >> 8) & 0xFF # <<<<<<<<<<<<<< + * out[7] = v & 0xFF + * +*/ + (__pyx_v_out[6]) = ((__pyx_v_v >> 8) & 0xFF); + + /* "polluck_blockchain/placeholder_native.pyx":49 + * out[5] = (v >> 16) & 0xFF + * out[6] = (v >> 8) & 0xFF + * out[7] = v & 0xFF # <<<<<<<<<<<<<< + * + * cdef struct SerializeResult: +*/ + (__pyx_v_out[7]) = (__pyx_v_v & 0xFF); + + /* "polluck_blockchain/placeholder_native.pyx":41 + * out[3] = v & 0xFF + * + * cdef int serialize_uint64(unsigned char* out, unsigned long long v) except -1 nogil: # <<<<<<<<<<<<<< + * out[0] = (v >> 56) & 0xFF + * out[1] = (v >> 48) & 0xFF +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "polluck_blockchain/placeholder_native.pyx":66 * bint ptr_owner * * def __cinit__(self, # <<<<<<<<<<<<<< @@ -3413,36 +3540,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, 44, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 66, __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, 44, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 66, __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, 44, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 66, __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, 44, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 66, __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, 44, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 66, __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, 44, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 66, __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, 44, __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, 66, __pyx_L3_error) - /* "polluck_blockchain/placeholder_native.pyx":49 + /* "polluck_blockchain/placeholder_native.pyx":71 * data, * previous_hash, * from_ptr=False, # <<<<<<<<<<<<<< @@ -3451,23 +3578,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, 44, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, i); __PYX_ERR(0, 66, __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, 44, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 66, __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, 44, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 66, __pyx_L3_error) values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 44, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 66, __pyx_L3_error) values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 44, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 66, __pyx_L3_error) values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 44, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 66, __pyx_L3_error) break; default: goto __pyx_L5_argtuple_error; } @@ -3481,7 +3608,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, 44, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, __pyx_nargs); __PYX_ERR(0, 66, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3494,7 +3621,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":44 + /* "polluck_blockchain/placeholder_native.pyx":66 * bint ptr_owner * * def __cinit__(self, # <<<<<<<<<<<<<< @@ -3532,7 +3659,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock___cinit__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "polluck_blockchain/placeholder_native.pyx":51 + /* "polluck_blockchain/placeholder_native.pyx":73 * from_ptr=False, * ): * self.ptr_owner = False # <<<<<<<<<<<<<< @@ -3541,39 +3668,39 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock___cinit__ */ __pyx_v_self->ptr_owner = 0; - /* "polluck_blockchain/placeholder_native.pyx":52 + /* "polluck_blockchain/placeholder_native.pyx":74 * ): * 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, 52, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_from_ptr); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 74, __pyx_L1_error) __pyx_t_2 = (!__pyx_t_1); if (__pyx_t_2) { - /* "polluck_blockchain/placeholder_native.pyx":54 + /* "polluck_blockchain/placeholder_native.pyx":76 * if not from_ptr: * self.BlockC = new Block( * index, # <<<<<<<<<<<<<< - * datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp(), + * int(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, 54, __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, 76, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":55 + /* "polluck_blockchain/placeholder_native.pyx":77 * self.BlockC = new Block( * index, - * datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp(), # <<<<<<<<<<<<<< + * int(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, 55, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 77, __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, 55, __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, 77, __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, 55, __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, 77, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_5 = __pyx_t_6; @@ -3584,126 +3711,118 @@ 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, 55, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 77, __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, 55, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyNumber_Int(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 77, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_9 = __Pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 77, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "polluck_blockchain/placeholder_native.pyx":56 + /* "polluck_blockchain/placeholder_native.pyx":78 * index, - * datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp(), + * int(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, 56, __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, 78, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":57 - * datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp(), + /* "polluck_blockchain/placeholder_native.pyx":79 + * int(datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp()), * nonce, * data.encode("UTF-8"), # <<<<<<<<<<<<<< * previous_hash.encode("UTF-8"), * "".encode("UTF-8"), */ - __pyx_t_6 = __pyx_v_data; - __Pyx_INCREF(__pyx_t_6); + __pyx_t_4 = __pyx_v_data; + __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0; { - 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) - __Pyx_GOTREF(__pyx_t_4); + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_UTF_8}; + __pyx_t_6 = __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_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); } - __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; + __pyx_t_11 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_6); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "polluck_blockchain/placeholder_native.pyx":58 + /* "polluck_blockchain/placeholder_native.pyx":80 * nonce, * data.encode("UTF-8"), * previous_hash.encode("UTF-8"), # <<<<<<<<<<<<<< * "".encode("UTF-8"), * ) */ - __pyx_t_6 = __pyx_v_previous_hash; - __Pyx_INCREF(__pyx_t_6); + __pyx_t_4 = __pyx_v_previous_hash; + __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0; { - 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, 58, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_UTF_8}; + __pyx_t_6 = __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_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 80, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); } - __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; + __pyx_t_12 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_6); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 80, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "polluck_blockchain/placeholder_native.pyx":59 + /* "polluck_blockchain/placeholder_native.pyx":81 * 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, 59, __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, 81, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":53 + /* "polluck_blockchain/placeholder_native.pyx":75 * self.ptr_owner = False * if not from_ptr: * self.BlockC = new Block( # <<<<<<<<<<<<<< * index, - * datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp(), + * int(datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp()), */ try { __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, 53, __pyx_L1_error) + __PYX_ERR(0, 75, __pyx_L1_error) } __pyx_v_self->BlockC = __pyx_t_14; - /* "polluck_blockchain/placeholder_native.pyx":61 + /* "polluck_blockchain/placeholder_native.pyx":83 * "".encode("UTF-8"), * ) * if self.BlockC == NULL: # <<<<<<<<<<<<<< - * raise MemoryError("Allocation of block object failed") + * raise MemoryError() * */ __pyx_t_2 = (__pyx_v_self->BlockC == NULL); if (unlikely(__pyx_t_2)) { - /* "polluck_blockchain/placeholder_native.pyx":62 + /* "polluck_blockchain/placeholder_native.pyx":84 * ) * if self.BlockC == NULL: - * raise MemoryError("Allocation of block object failed") # <<<<<<<<<<<<<< + * raise MemoryError() # <<<<<<<<<<<<<< * * self.ptr_owner = True */ - __pyx_t_6 = NULL; - __pyx_t_8 = 1; - { - 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, 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, 62, __pyx_L1_error) + PyErr_NoMemory(); __PYX_ERR(0, 84, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":61 + /* "polluck_blockchain/placeholder_native.pyx":83 * "".encode("UTF-8"), * ) * if self.BlockC == NULL: # <<<<<<<<<<<<<< - * raise MemoryError("Allocation of block object failed") + * raise MemoryError() * */ } - /* "polluck_blockchain/placeholder_native.pyx":64 - * raise MemoryError("Allocation of block object failed") + /* "polluck_blockchain/placeholder_native.pyx":86 + * raise MemoryError() * * self.ptr_owner = True # <<<<<<<<<<<<<< * @@ -3711,7 +3830,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock___cinit__ */ __pyx_v_self->ptr_owner = 1; - /* "polluck_blockchain/placeholder_native.pyx":52 + /* "polluck_blockchain/placeholder_native.pyx":74 * ): * self.ptr_owner = False * if not from_ptr: # <<<<<<<<<<<<<< @@ -3720,7 +3839,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock___cinit__ */ } - /* "polluck_blockchain/placeholder_native.pyx":44 + /* "polluck_blockchain/placeholder_native.pyx":66 * bint ptr_owner * * def __cinit__(self, # <<<<<<<<<<<<<< @@ -3743,12 +3862,12 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock___cinit__ return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":66 +/* "polluck_blockchain/placeholder_native.pyx":88 * self.ptr_owner = True * * def __init__(self, *args, **kwargs): # <<<<<<<<<<<<<< * pass - * # self._index = index + * */ /* Python wrapper */ @@ -3791,8 +3910,8 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_2__init__ return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":76 - * # self._hash = "".encode("UTF-8") +/* "polluck_blockchain/placeholder_native.pyx":91 + * pass * * def __dealloc__(self): # <<<<<<<<<<<<<< * if self.BlockC is not NULL and self.ptr_owner is True: @@ -3816,7 +3935,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":77 + /* "polluck_blockchain/placeholder_native.pyx":92 * * def __dealloc__(self): * if self.BlockC is not NULL and self.ptr_owner is True: # <<<<<<<<<<<<<< @@ -3834,7 +3953,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":78 + /* "polluck_blockchain/placeholder_native.pyx":93 * def __dealloc__(self): * if self.BlockC is not NULL and self.ptr_owner is True: * del self.BlockC # <<<<<<<<<<<<<< @@ -3843,7 +3962,7 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4__deall */ delete __pyx_v_self->BlockC; - /* "polluck_blockchain/placeholder_native.pyx":79 + /* "polluck_blockchain/placeholder_native.pyx":94 * if self.BlockC is not NULL and self.ptr_owner is True: * del self.BlockC * self.BlockC = NULL # <<<<<<<<<<<<<< @@ -3852,7 +3971,7 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4__deall */ __pyx_v_self->BlockC = NULL; - /* "polluck_blockchain/placeholder_native.pyx":77 + /* "polluck_blockchain/placeholder_native.pyx":92 * * def __dealloc__(self): * if self.BlockC is not NULL and self.ptr_owner is True: # <<<<<<<<<<<<<< @@ -3861,8 +3980,8 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4__deall */ } - /* "polluck_blockchain/placeholder_native.pyx":76 - * # self._hash = "".encode("UTF-8") + /* "polluck_blockchain/placeholder_native.pyx":91 + * pass * * def __dealloc__(self): # <<<<<<<<<<<<<< * if self.BlockC is not NULL and self.ptr_owner is True: @@ -3872,7 +3991,7 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4__deall /* function exit code */ } -/* "polluck_blockchain/placeholder_native.pyx":81 +/* "polluck_blockchain/placeholder_native.pyx":96 * self.BlockC = NULL * * @staticmethod # <<<<<<<<<<<<<< @@ -3882,7 +4001,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":82 + /* "polluck_blockchain/placeholder_native.pyx":97 * * @staticmethod * cdef PyBlock from_ptr(Block *block, bint owner=False): # <<<<<<<<<<<<<< @@ -3908,77 +4027,77 @@ static struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx } } - /* "polluck_blockchain/placeholder_native.pyx":85 + /* "polluck_blockchain/placeholder_native.pyx":100 * 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, 85, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_block->index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - /* "polluck_blockchain/placeholder_native.pyx":86 + /* "polluck_blockchain/placeholder_native.pyx":101 * 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, 86, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyLong_From_uint64_t(__pyx_v_block->nonce); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - /* "polluck_blockchain/placeholder_native.pyx":87 + /* "polluck_blockchain/placeholder_native.pyx":102 * 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, 87, __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, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - /* "polluck_blockchain/placeholder_native.pyx":88 + /* "polluck_blockchain/placeholder_native.pyx":103 * 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, 88, __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, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - /* "polluck_blockchain/placeholder_native.pyx":83 + /* "polluck_blockchain/placeholder_native.pyx":98 * @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, 83, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 98, __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, 83, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 98, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_2); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 83, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 98, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_3); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 83, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 98, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_4); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4) != (0)) __PYX_ERR(0, 83, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4) != (0)) __PYX_ERR(0, 98, __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, 83, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 4, Py_True) != (0)) __PYX_ERR(0, 98, __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, 83, __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, 98, __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":91 + /* "polluck_blockchain/placeholder_native.pyx":106 * True, * ) * py_block.BlockC = block # <<<<<<<<<<<<<< @@ -3987,7 +4106,7 @@ static struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx */ __pyx_v_py_block->BlockC = __pyx_v_block; - /* "polluck_blockchain/placeholder_native.pyx":92 + /* "polluck_blockchain/placeholder_native.pyx":107 * ) * py_block.BlockC = block * py_block.ptr_owner = owner # <<<<<<<<<<<<<< @@ -3996,7 +4115,7 @@ static struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx */ __pyx_v_py_block->ptr_owner = __pyx_v_owner; - /* "polluck_blockchain/placeholder_native.pyx":94 + /* "polluck_blockchain/placeholder_native.pyx":109 * py_block.ptr_owner = owner * * return py_block # <<<<<<<<<<<<<< @@ -4008,7 +4127,7 @@ static struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx __pyx_r = __pyx_v_py_block; goto __pyx_L0; - /* "polluck_blockchain/placeholder_native.pyx":81 + /* "polluck_blockchain/placeholder_native.pyx":96 * self.BlockC = NULL * * @staticmethod # <<<<<<<<<<<<<< @@ -4032,7 +4151,7 @@ static struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":96 +/* "polluck_blockchain/placeholder_native.pyx":111 * return py_block * * def __repr__(self): # <<<<<<<<<<<<<< @@ -4069,7 +4188,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_6__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__repr__", 0); - /* "polluck_blockchain/placeholder_native.pyx":97 + /* "polluck_blockchain/placeholder_native.pyx":112 * * def __repr__(self): * return f"PyBlock({self.index, self.timestamp, self.nonce, self.data})" # <<<<<<<<<<<<<< @@ -4077,43 +4196,43 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_6__ * 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_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __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_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_timestamp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __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_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_nonce); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 112, __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_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 112, __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_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 112, __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); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 112, __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); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 112, __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); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 112, __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); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4) != (0)) __PYX_ERR(0, 112, __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_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 112, __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) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 112, __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 + /* "polluck_blockchain/placeholder_native.pyx":111 * return py_block * * def __repr__(self): # <<<<<<<<<<<<<< @@ -4136,7 +4255,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_6__ return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":99 +/* "polluck_blockchain/placeholder_native.pyx":114 * return f"PyBlock({self.index, self.timestamp, self.nonce, self.data})" * * def __str__(self): # <<<<<<<<<<<<<< @@ -4170,7 +4289,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_8__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "polluck_blockchain/placeholder_native.pyx":100 + /* "polluck_blockchain/placeholder_native.pyx":115 * * def __str__(self): * return self.__repr__() # <<<<<<<<<<<<<< @@ -4185,14 +4304,14 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_8__ 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) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 115, __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 + /* "polluck_blockchain/placeholder_native.pyx":114 * return f"PyBlock({self.index, self.timestamp, self.nonce, self.data})" * * def __str__(self): # <<<<<<<<<<<<<< @@ -4212,7 +4331,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_8__ return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":119 +/* "polluck_blockchain/placeholder_native.pyx":134 * * # Python public API * @property # <<<<<<<<<<<<<< @@ -4244,7 +4363,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_5in int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "polluck_blockchain/placeholder_native.pyx":121 + /* "polluck_blockchain/placeholder_native.pyx":136 * @property * def index(self): * return self.BlockC.index # <<<<<<<<<<<<<< @@ -4252,13 +4371,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, 121, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->BlockC->index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __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":119 + /* "polluck_blockchain/placeholder_native.pyx":134 * * # Python public API * @property # <<<<<<<<<<<<<< @@ -4277,7 +4396,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_5in return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":123 +/* "polluck_blockchain/placeholder_native.pyx":138 * return self.BlockC.index * * @property # <<<<<<<<<<<<<< @@ -4309,7 +4428,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_9ti int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "polluck_blockchain/placeholder_native.pyx":125 + /* "polluck_blockchain/placeholder_native.pyx":140 * @property * def timestamp(self): * return timestamp_to_datetime(self.BlockC.timestamp) # <<<<<<<<<<<<<< @@ -4317,13 +4436,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, 125, __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, 140, __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":123 + /* "polluck_blockchain/placeholder_native.pyx":138 * return self.BlockC.index * * @property # <<<<<<<<<<<<<< @@ -4342,7 +4461,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_9ti return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":127 +/* "polluck_blockchain/placeholder_native.pyx":142 * return timestamp_to_datetime(self.BlockC.timestamp) * * @property # <<<<<<<<<<<<<< @@ -4374,7 +4493,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4da int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "polluck_blockchain/placeholder_native.pyx":129 + /* "polluck_blockchain/placeholder_native.pyx":144 * @property * def data(self): * return self.BlockC.data.decode("UTF-8") # <<<<<<<<<<<<<< @@ -4382,13 +4501,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, 129, __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, 144, __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":127 + /* "polluck_blockchain/placeholder_native.pyx":142 * return timestamp_to_datetime(self.BlockC.timestamp) * * @property # <<<<<<<<<<<<<< @@ -4407,7 +4526,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4da return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":131 +/* "polluck_blockchain/placeholder_native.pyx":146 * return self.BlockC.data.decode("UTF-8") * * @property # <<<<<<<<<<<<<< @@ -4439,7 +4558,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_9pr int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "polluck_blockchain/placeholder_native.pyx":133 + /* "polluck_blockchain/placeholder_native.pyx":148 * @property * def prev_hash(self): * return self.BlockC.prev_hash.decode("UTF-8") # <<<<<<<<<<<<<< @@ -4447,13 +4566,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, 133, __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, 148, __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":131 + /* "polluck_blockchain/placeholder_native.pyx":146 * return self.BlockC.data.decode("UTF-8") * * @property # <<<<<<<<<<<<<< @@ -4472,7 +4591,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_9pr return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":135 +/* "polluck_blockchain/placeholder_native.pyx":150 * return self.BlockC.prev_hash.decode("UTF-8") * * @property # <<<<<<<<<<<<<< @@ -4504,7 +4623,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_5no int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "polluck_blockchain/placeholder_native.pyx":137 + /* "polluck_blockchain/placeholder_native.pyx":152 * @property * def nonce(self): * return self.BlockC.nonce # <<<<<<<<<<<<<< @@ -4512,13 +4631,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, 137, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->BlockC->nonce); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 152, __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":135 + /* "polluck_blockchain/placeholder_native.pyx":150 * return self.BlockC.prev_hash.decode("UTF-8") * * @property # <<<<<<<<<<<<<< @@ -4537,7 +4656,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_5no return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":143 +/* "polluck_blockchain/placeholder_native.pyx":158 * # self._nonce = value * * @property # <<<<<<<<<<<<<< @@ -4569,21 +4688,21 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4ha int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "polluck_blockchain/placeholder_native.pyx":145 + /* "polluck_blockchain/placeholder_native.pyx":160 * @property * def hash(self): * return self.BlockC.hash.decode("UTF-8") # <<<<<<<<<<<<<< * - * # @hash.setter + * cdef SerializeResult bytes_serialize_c(self): */ __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, 145, __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, 160, __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":143 + /* "polluck_blockchain/placeholder_native.pyx":158 * # self._nonce = value * * @property # <<<<<<<<<<<<<< @@ -4602,6 +4721,370 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4ha return __pyx_r; } +/* "polluck_blockchain/placeholder_native.pyx":162 + * return self.BlockC.hash.decode("UTF-8") + * + * cdef SerializeResult bytes_serialize_c(self): # <<<<<<<<<<<<<< + * cdef: + * size_t total_len +*/ + +static struct __pyx_t_18polluck_blockchain_18placeholder_native_SerializeResult __pyx_f_18polluck_blockchain_18placeholder_native_7PyBlock_bytes_serialize_c(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self) { + size_t __pyx_v_total_len; + unsigned char *__pyx_v_buf; + size_t __pyx_v_pos; + struct __pyx_t_18polluck_blockchain_18placeholder_native_SerializeResult __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + struct __pyx_t_18polluck_blockchain_18placeholder_native_SerializeResult __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "polluck_blockchain/placeholder_native.pyx":166 + * size_t total_len + * unsigned char* buf + * size_t pos = 0 # <<<<<<<<<<<<<< + * + * # test: prev_hash + size of index (64bit) +*/ + __pyx_v_pos = 0; + + /* "polluck_blockchain/placeholder_native.pyx":172 + * total_len = ( + * (8 * 3) + + * self.BlockC.data.size() + # <<<<<<<<<<<<<< + * self.BlockC.prev_hash.size() + * ) +*/ + __pyx_v_total_len = ((((size_t)0x18) + __pyx_v_self->BlockC->data.size()) + __pyx_v_self->BlockC->prev_hash.size()); + + /* "polluck_blockchain/placeholder_native.pyx":175 + * self.BlockC.prev_hash.size() + * ) + * buf = malloc(total_len * sizeof(unsigned char)) # <<<<<<<<<<<<<< + * + * if buf == NULL: +*/ + __pyx_v_buf = ((unsigned char *)malloc((__pyx_v_total_len * (sizeof(unsigned char))))); + + /* "polluck_blockchain/placeholder_native.pyx":177 + * buf = malloc(total_len * sizeof(unsigned char)) + * + * if buf == NULL: # <<<<<<<<<<<<<< + * raise MemoryError() + * +*/ + __pyx_t_1 = (__pyx_v_buf == NULL); + if (unlikely(__pyx_t_1)) { + + /* "polluck_blockchain/placeholder_native.pyx":178 + * + * if buf == NULL: + * raise MemoryError() # <<<<<<<<<<<<<< + * + * serialize_uint64(buf + pos, self.BlockC.index) +*/ + PyErr_NoMemory(); __PYX_ERR(0, 178, __pyx_L1_error) + + /* "polluck_blockchain/placeholder_native.pyx":177 + * buf = malloc(total_len * sizeof(unsigned char)) + * + * if buf == NULL: # <<<<<<<<<<<<<< + * raise MemoryError() + * +*/ + } + + /* "polluck_blockchain/placeholder_native.pyx":180 + * raise MemoryError() + * + * serialize_uint64(buf + pos, self.BlockC.index) # <<<<<<<<<<<<<< + * pos += 8 + * serialize_uint64(buf + pos, self.BlockC.timestamp) +*/ + __pyx_t_2 = __pyx_f_18polluck_blockchain_18placeholder_native_serialize_uint64((__pyx_v_buf + __pyx_v_pos), __pyx_v_self->BlockC->index); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 180, __pyx_L1_error) + + /* "polluck_blockchain/placeholder_native.pyx":181 + * + * serialize_uint64(buf + pos, self.BlockC.index) + * pos += 8 # <<<<<<<<<<<<<< + * serialize_uint64(buf + pos, self.BlockC.timestamp) + * pos += 8 +*/ + __pyx_v_pos = (__pyx_v_pos + 8); + + /* "polluck_blockchain/placeholder_native.pyx":182 + * serialize_uint64(buf + pos, self.BlockC.index) + * pos += 8 + * serialize_uint64(buf + pos, self.BlockC.timestamp) # <<<<<<<<<<<<<< + * pos += 8 + * serialize_uint64(buf + pos, self.BlockC.nonce) +*/ + __pyx_t_2 = __pyx_f_18polluck_blockchain_18placeholder_native_serialize_uint64((__pyx_v_buf + __pyx_v_pos), __pyx_v_self->BlockC->timestamp); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 182, __pyx_L1_error) + + /* "polluck_blockchain/placeholder_native.pyx":183 + * pos += 8 + * serialize_uint64(buf + pos, self.BlockC.timestamp) + * pos += 8 # <<<<<<<<<<<<<< + * serialize_uint64(buf + pos, self.BlockC.nonce) + * pos += 8 +*/ + __pyx_v_pos = (__pyx_v_pos + 8); + + /* "polluck_blockchain/placeholder_native.pyx":184 + * serialize_uint64(buf + pos, self.BlockC.timestamp) + * pos += 8 + * serialize_uint64(buf + pos, self.BlockC.nonce) # <<<<<<<<<<<<<< + * pos += 8 + * # Copy data +*/ + __pyx_t_2 = __pyx_f_18polluck_blockchain_18placeholder_native_serialize_uint64((__pyx_v_buf + __pyx_v_pos), __pyx_v_self->BlockC->nonce); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 184, __pyx_L1_error) + + /* "polluck_blockchain/placeholder_native.pyx":185 + * pos += 8 + * serialize_uint64(buf + pos, self.BlockC.nonce) + * pos += 8 # <<<<<<<<<<<<<< + * # Copy data + * memcpy( +*/ + __pyx_v_pos = (__pyx_v_pos + 8); + + /* "polluck_blockchain/placeholder_native.pyx":187 + * pos += 8 + * # Copy data + * memcpy( # <<<<<<<<<<<<<< + * buf + pos, + * self.BlockC.data.c_str(), +*/ + (void)(memcpy((__pyx_v_buf + __pyx_v_pos), __pyx_v_self->BlockC->data.c_str(), __pyx_v_self->BlockC->data.size())); + + /* "polluck_blockchain/placeholder_native.pyx":192 + * self.BlockC.data.size(), + * ) + * pos += self.BlockC.data.size() # <<<<<<<<<<<<<< + * # Copy prev_hash + * memcpy( +*/ + __pyx_v_pos = (__pyx_v_pos + __pyx_v_self->BlockC->data.size()); + + /* "polluck_blockchain/placeholder_native.pyx":194 + * pos += self.BlockC.data.size() + * # Copy prev_hash + * memcpy( # <<<<<<<<<<<<<< + * buf + pos, + * self.BlockC.prev_hash.c_str(), +*/ + (void)(memcpy((__pyx_v_buf + __pyx_v_pos), __pyx_v_self->BlockC->prev_hash.c_str(), __pyx_v_self->BlockC->prev_hash.size())); + + /* "polluck_blockchain/placeholder_native.pyx":199 + * self.BlockC.prev_hash.size(), + * ) + * pos += self.BlockC.prev_hash.size() # <<<<<<<<<<<<<< + * + * return SerializeResult(buf, total_len) +*/ + __pyx_v_pos = (__pyx_v_pos + __pyx_v_self->BlockC->prev_hash.size()); + + /* "polluck_blockchain/placeholder_native.pyx":201 + * pos += self.BlockC.prev_hash.size() + * + * return SerializeResult(buf, total_len) # <<<<<<<<<<<<<< + * + * def bytes_serialize(self): +*/ + __pyx_t_3.ptr = __pyx_v_buf; + __pyx_t_3.size = __pyx_v_total_len; + __pyx_r = __pyx_t_3; + goto __pyx_L0; + + /* "polluck_blockchain/placeholder_native.pyx":162 + * return self.BlockC.hash.decode("UTF-8") + * + * cdef SerializeResult bytes_serialize_c(self): # <<<<<<<<<<<<<< + * cdef: + * size_t total_len +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("polluck_blockchain.placeholder_native.PyBlock.bytes_serialize_c", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + return __pyx_r; +} + +/* "polluck_blockchain/placeholder_native.pyx":203 + * return SerializeResult(buf, total_len) + * + * def bytes_serialize(self): # <<<<<<<<<<<<<< + * cdef SerializeResult serialize_res + * try: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_11bytes_serialize(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_11bytes_serialize = {"bytes_serialize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_11bytes_serialize, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_11bytes_serialize(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("bytes_serialize (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("bytes_serialize", 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("bytes_serialize", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_10bytes_serialize(((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_10bytes_serialize(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self) { + struct __pyx_t_18polluck_blockchain_18placeholder_native_SerializeResult __pyx_v_serialize_res; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + struct __pyx_t_18polluck_blockchain_18placeholder_native_SerializeResult __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + char const *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("bytes_serialize", 0); + + /* "polluck_blockchain/placeholder_native.pyx":205 + * def bytes_serialize(self): + * cdef SerializeResult serialize_res + * try: # <<<<<<<<<<<<<< + * serialize_res = self.bytes_serialize_c() + * return serialize_res.ptr[:serialize_res.size] +*/ + /*try:*/ { + + /* "polluck_blockchain/placeholder_native.pyx":206 + * cdef SerializeResult serialize_res + * try: + * serialize_res = self.bytes_serialize_c() # <<<<<<<<<<<<<< + * return serialize_res.ptr[:serialize_res.size] + * finally: +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_18polluck_blockchain_18placeholder_native_PyBlock *)__pyx_v_self->__pyx_vtab)->bytes_serialize_c(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 206, __pyx_L4_error) + __pyx_v_serialize_res = __pyx_t_1; + + /* "polluck_blockchain/placeholder_native.pyx":207 + * try: + * serialize_res = self.bytes_serialize_c() + * return serialize_res.ptr[:serialize_res.size] # <<<<<<<<<<<<<< + * finally: + * free(serialize_res.ptr) +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(((char const *)__pyx_v_serialize_res.ptr) + 0, __pyx_v_serialize_res.size - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L3_return; + } + + /* "polluck_blockchain/placeholder_native.pyx":209 + * return serialize_res.ptr[:serialize_res.size] + * finally: + * free(serialize_res.ptr) # <<<<<<<<<<<<<< + * + * +*/ + /*finally:*/ { + __pyx_L4_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); + if ( unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + __pyx_t_3 = __pyx_lineno; __pyx_t_4 = __pyx_clineno; __pyx_t_5 = __pyx_filename; + { + free(__pyx_v_serialize_res.ptr); + } + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ErrRestore(__pyx_t_6, __pyx_t_7, __pyx_t_8); + __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; + __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_4; __pyx_filename = __pyx_t_5; + goto __pyx_L1_error; + } + __pyx_L3_return: { + __pyx_t_11 = __pyx_r; + __pyx_r = 0; + free(__pyx_v_serialize_res.ptr); + __pyx_r = __pyx_t_11; + __pyx_t_11 = 0; + goto __pyx_L0; + } + } + + /* "polluck_blockchain/placeholder_native.pyx":203 + * return SerializeResult(buf, total_len) + * + * def bytes_serialize(self): # <<<<<<<<<<<<<< + * cdef SerializeResult serialize_res + * try: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("polluck_blockchain.placeholder_native.PyBlock.bytes_serialize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" @@ -4609,15 +5092,15 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4ha */ /* Python wrapper */ -static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_11__reduce_cython__(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_13__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_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, +static PyMethodDef __pyx_mdef_18polluck_blockchain_18placeholder_native_7PyBlock_13__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_13__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_13__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -4643,14 +5126,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_10__reduce_cython__(((struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *)__pyx_v_self)); + __pyx_r = __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_12__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_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self) { +static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_12__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; @@ -4690,15 +5173,15 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_10_ */ /* Python wrapper */ -static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_13__setstate_cython__(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_15__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_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, +static PyMethodDef __pyx_mdef_18polluck_blockchain_18placeholder_native_7PyBlock_15__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_15__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_15__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -4764,7 +5247,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_12__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_14__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) { @@ -4774,7 +5257,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -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) { +static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_14__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; @@ -4806,7 +5289,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_12_ return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":163 +/* "polluck_blockchain/placeholder_native.pyx":231 * cdef bint _genesis_done * * def __cinit__(self): # <<<<<<<<<<<<<< @@ -4852,7 +5335,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain___cin int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "polluck_blockchain/placeholder_native.pyx":164 + /* "polluck_blockchain/placeholder_native.pyx":232 * * def __cinit__(self): * self._difficulty = 1 # <<<<<<<<<<<<<< @@ -4861,7 +5344,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain___cin */ __pyx_v_self->_difficulty = 1; - /* "polluck_blockchain/placeholder_native.pyx":165 + /* "polluck_blockchain/placeholder_native.pyx":233 * def __cinit__(self): * self._difficulty = 1 * self._index = 0 # <<<<<<<<<<<<<< @@ -4870,7 +5353,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain___cin */ __pyx_v_self->_index = ((uint64_t)0); - /* "polluck_blockchain/placeholder_native.pyx":166 + /* "polluck_blockchain/placeholder_native.pyx":234 * self._difficulty = 1 * self._index = 0 * self._genesis_done = 0 # <<<<<<<<<<<<<< @@ -4879,7 +5362,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain___cin */ __pyx_v_self->_genesis_done = 0; - /* "polluck_blockchain/placeholder_native.pyx":167 + /* "polluck_blockchain/placeholder_native.pyx":235 * self._index = 0 * self._genesis_done = 0 * self._chain = new unordered_map[uint64_t, Block*]() # <<<<<<<<<<<<<< @@ -4890,11 +5373,11 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain___cin __pyx_t_1 = new std::unordered_map (); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 167, __pyx_L1_error) + __PYX_ERR(0, 235, __pyx_L1_error) } __pyx_v_self->_chain = __pyx_t_1; - /* "polluck_blockchain/placeholder_native.pyx":168 + /* "polluck_blockchain/placeholder_native.pyx":236 * self._genesis_done = 0 * self._chain = new unordered_map[uint64_t, Block*]() * if self._chain is NULL: # <<<<<<<<<<<<<< @@ -4904,7 +5387,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":169 + /* "polluck_blockchain/placeholder_native.pyx":237 * self._chain = new unordered_map[uint64_t, Block*]() * if self._chain is NULL: * raise MemoryError("Could not allocate hasmap") # <<<<<<<<<<<<<< @@ -4917,14 +5400,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, 169, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __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, 169, __pyx_L1_error) + __PYX_ERR(0, 237, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":168 + /* "polluck_blockchain/placeholder_native.pyx":236 * self._genesis_done = 0 * self._chain = new unordered_map[uint64_t, Block*]() * if self._chain is NULL: # <<<<<<<<<<<<<< @@ -4933,7 +5416,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain___cin */ } - /* "polluck_blockchain/placeholder_native.pyx":163 + /* "polluck_blockchain/placeholder_native.pyx":231 * cdef bint _genesis_done * * def __cinit__(self): # <<<<<<<<<<<<<< @@ -4954,7 +5437,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain___cin return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":171 +/* "polluck_blockchain/placeholder_native.pyx":239 * raise MemoryError("Could not allocate hasmap") * * def __init__(self, *args, **kwargs): # <<<<<<<<<<<<<< @@ -5002,12 +5485,12 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_2__in return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":176 - * # TODO add entries of map - * # ownership is typically not transferred from the Blockchain extension class +/* "polluck_blockchain/placeholder_native.pyx":242 + * pass + * * 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: */ /* Python wrapper */ @@ -5027,17 +5510,17 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_4__d std::unordered_map ::iterator __pyx_v_it; int __pyx_t_1; - /* "polluck_blockchain/placeholder_native.pyx":177 - * # ownership is typically not transferred from the Blockchain extension class + /* "polluck_blockchain/placeholder_native.pyx":244 * 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(): */ __pyx_v_it = __pyx_v_self->_chain->begin(); - /* "polluck_blockchain/placeholder_native.pyx":178 - * def __dealloc__(self): + /* "polluck_blockchain/placeholder_native.pyx":245 + * # 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(): @@ -5046,7 +5529,7 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_4__d __pyx_t_1 = (__pyx_v_self->_chain != NULL); if (__pyx_t_1) { - /* "polluck_blockchain/placeholder_native.pyx":179 + /* "polluck_blockchain/placeholder_native.pyx":246 * cdef BcHashmap.iterator it = self._chain.begin() * if self._chain is not NULL: * while it != self._chain.end(): # <<<<<<<<<<<<<< @@ -5057,7 +5540,7 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_4__d __pyx_t_1 = (__pyx_v_it != __pyx_v_self->_chain->end()); if (!__pyx_t_1) break; - /* "polluck_blockchain/placeholder_native.pyx":180 + /* "polluck_blockchain/placeholder_native.pyx":247 * if self._chain is not NULL: * while it != self._chain.end(): * del dereference(it).second # <<<<<<<<<<<<<< @@ -5066,7 +5549,7 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_4__d */ delete (*__pyx_v_it).second; - /* "polluck_blockchain/placeholder_native.pyx":181 + /* "polluck_blockchain/placeholder_native.pyx":248 * while it != self._chain.end(): * del dereference(it).second * postincrement(it) # <<<<<<<<<<<<<< @@ -5076,7 +5559,7 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_4__d (void)((__pyx_v_it++)); } - /* "polluck_blockchain/placeholder_native.pyx":183 + /* "polluck_blockchain/placeholder_native.pyx":250 * postincrement(it) * * del self._chain # <<<<<<<<<<<<<< @@ -5085,7 +5568,7 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_4__d */ delete __pyx_v_self->_chain; - /* "polluck_blockchain/placeholder_native.pyx":184 + /* "polluck_blockchain/placeholder_native.pyx":251 * * del self._chain * self._chain = NULL # <<<<<<<<<<<<<< @@ -5094,8 +5577,8 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_4__d */ __pyx_v_self->_chain = NULL; - /* "polluck_blockchain/placeholder_native.pyx":178 - * def __dealloc__(self): + /* "polluck_blockchain/placeholder_native.pyx":245 + * # 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(): @@ -5103,18 +5586,18 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_4__d */ } - /* "polluck_blockchain/placeholder_native.pyx":176 - * # TODO add entries of map - * # ownership is typically not transferred from the Blockchain extension class + /* "polluck_blockchain/placeholder_native.pyx":242 + * pass + * * 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: */ /* function exit code */ } -/* "polluck_blockchain/placeholder_native.pyx":186 +/* "polluck_blockchain/placeholder_native.pyx":253 * self._chain = NULL * * def __len__(self): # <<<<<<<<<<<<<< @@ -5140,7 +5623,7 @@ 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":187 + /* "polluck_blockchain/placeholder_native.pyx":254 * * def __len__(self): * return self._index + 1 # <<<<<<<<<<<<<< @@ -5150,7 +5633,7 @@ static Py_ssize_t __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchai __pyx_r = (__pyx_v_self->_index + 1); goto __pyx_L0; - /* "polluck_blockchain/placeholder_native.pyx":186 + /* "polluck_blockchain/placeholder_native.pyx":253 * self._chain = NULL * * def __len__(self): # <<<<<<<<<<<<<< @@ -5163,7 +5646,7 @@ static Py_ssize_t __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchai return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":189 +/* "polluck_blockchain/placeholder_native.pyx":256 * return self._index + 1 * * def print_key_value_pair(self): # <<<<<<<<<<<<<< @@ -5230,7 +5713,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain int __pyx_clineno = 0; __Pyx_RefNannySetupContext("print_key_value_pair", 0); - /* "polluck_blockchain/placeholder_native.pyx":190 + /* "polluck_blockchain/placeholder_native.pyx":257 * * def print_key_value_pair(self): * cdef BcHashmap.iterator it = self._chain.begin() # <<<<<<<<<<<<<< @@ -5239,7 +5722,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain */ __pyx_v_it = __pyx_v_self->_chain->begin(); - /* "polluck_blockchain/placeholder_native.pyx":192 + /* "polluck_blockchain/placeholder_native.pyx":259 * cdef BcHashmap.iterator it = self._chain.begin() * cdef Block *block * while it != self._chain.end(): # <<<<<<<<<<<<<< @@ -5250,7 +5733,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain __pyx_t_1 = (__pyx_v_it != __pyx_v_self->_chain->end()); if (!__pyx_t_1) break; - /* "polluck_blockchain/placeholder_native.pyx":193 + /* "polluck_blockchain/placeholder_native.pyx":260 * cdef Block *block * while it != self._chain.end(): * print(dereference(it).first) # <<<<<<<<<<<<<< @@ -5258,7 +5741,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain * py_block = PyBlock.from_ptr(block) */ __pyx_t_3 = NULL; - __pyx_t_4 = __Pyx_PyLong_From_uint64_t((*__pyx_v_it).first); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 193, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyLong_From_uint64_t((*__pyx_v_it).first); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 260, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 1; { @@ -5266,12 +5749,12 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_print, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 260, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "polluck_blockchain/placeholder_native.pyx":194 + /* "polluck_blockchain/placeholder_native.pyx":261 * while it != self._chain.end(): * print(dereference(it).first) * block = dereference(it).second # <<<<<<<<<<<<<< @@ -5281,19 +5764,19 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain __pyx_t_6 = (*__pyx_v_it).second; __pyx_v_block = __pyx_t_6; - /* "polluck_blockchain/placeholder_native.pyx":195 + /* "polluck_blockchain/placeholder_native.pyx":262 * 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_t_2 = ((PyObject *)__pyx_vtabptr_18polluck_blockchain_18placeholder_native_PyBlock->from_ptr(__pyx_v_block, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 262, __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 + /* "polluck_blockchain/placeholder_native.pyx":263 * block = dereference(it).second * py_block = PyBlock.from_ptr(block) * print(py_block) # <<<<<<<<<<<<<< @@ -5306,12 +5789,12 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain PyObject *__pyx_callargs[2] = {__pyx_t_4, ((PyObject *)__pyx_v_py_block)}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_print, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 196, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 263, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "polluck_blockchain/placeholder_native.pyx":197 + /* "polluck_blockchain/placeholder_native.pyx":264 * py_block = PyBlock.from_ptr(block) * print(py_block) * postincrement(it) # <<<<<<<<<<<<<< @@ -5321,7 +5804,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain (void)((__pyx_v_it++)); } - /* "polluck_blockchain/placeholder_native.pyx":189 + /* "polluck_blockchain/placeholder_native.pyx":256 * return self._index + 1 * * def print_key_value_pair(self): # <<<<<<<<<<<<<< @@ -5345,7 +5828,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":199 +/* "polluck_blockchain/placeholder_native.pyx":266 * postincrement(it) * * @property # <<<<<<<<<<<<<< @@ -5377,7 +5860,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "polluck_blockchain/placeholder_native.pyx":201 + /* "polluck_blockchain/placeholder_native.pyx":268 * @property * def genesis_done(self): * return self._genesis_done # <<<<<<<<<<<<<< @@ -5385,13 +5868,13 @@ 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, 201, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->_genesis_done); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 268, __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":199 + /* "polluck_blockchain/placeholder_native.pyx":266 * postincrement(it) * * @property # <<<<<<<<<<<<<< @@ -5410,7 +5893,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":203 +/* "polluck_blockchain/placeholder_native.pyx":270 * return self._genesis_done * * @property # <<<<<<<<<<<<<< @@ -5442,7 +5925,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "polluck_blockchain/placeholder_native.pyx":205 + /* "polluck_blockchain/placeholder_native.pyx":272 * @property * def index(self): * return self._index # <<<<<<<<<<<<<< @@ -5450,13 +5933,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, 205, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 272, __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":203 + /* "polluck_blockchain/placeholder_native.pyx":270 * return self._genesis_done * * @property # <<<<<<<<<<<<<< @@ -5475,7 +5958,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":208 +/* "polluck_blockchain/placeholder_native.pyx":275 * * # TODO error handling * cdef Block* get_block_c(self, uint64_t idx): # <<<<<<<<<<<<<< @@ -5486,7 +5969,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":209 + /* "polluck_blockchain/placeholder_native.pyx":276 * # TODO error handling * cdef Block* get_block_c(self, uint64_t idx): * return self._chain[0][idx] # <<<<<<<<<<<<<< @@ -5496,7 +5979,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":208 + /* "polluck_blockchain/placeholder_native.pyx":275 * * # TODO error handling * cdef Block* get_block_c(self, uint64_t idx): # <<<<<<<<<<<<<< @@ -5509,7 +5992,7 @@ static ::Block *__pyx_f_18polluck_blockchain_18placeholder_native_10Blockchain_g return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":211 +/* "polluck_blockchain/placeholder_native.pyx":278 * return self._chain[0][idx] * * def get_block(self, idx): # <<<<<<<<<<<<<< @@ -5556,32 +6039,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, 211, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 278, __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, 211, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 278, __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, 211, __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, 278, __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, 211, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_block", 1, 1, 1, i); __PYX_ERR(0, 278, __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, 211, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 278, __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, 211, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_block", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 278, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -5619,32 +6102,32 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_block", 0); - /* "polluck_blockchain/placeholder_native.pyx":212 + /* "polluck_blockchain/placeholder_native.pyx":279 * * 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, 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_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, 279, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 279, __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, 212, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 279, __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, 212, __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, 279, __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, 212, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 279, __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":213 + /* "polluck_blockchain/placeholder_native.pyx":280 * def get_block(self, idx): * if idx < 0 or idx > self._index: * raise IndexError("Index value is out of bounds") # <<<<<<<<<<<<<< @@ -5657,14 +6140,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, 213, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 280, __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, 213, __pyx_L1_error) + __PYX_ERR(0, 280, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":212 + /* "polluck_blockchain/placeholder_native.pyx":279 * * def get_block(self, idx): * if idx < 0 or idx > self._index: # <<<<<<<<<<<<<< @@ -5673,18 +6156,18 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain */ } - /* "polluck_blockchain/placeholder_native.pyx":215 + /* "polluck_blockchain/placeholder_native.pyx":282 * 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, 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_t_6 = __Pyx_PyLong_As_uint64_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 282, __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, 282, __pyx_L1_error) __pyx_v_block = __pyx_t_7; - /* "polluck_blockchain/placeholder_native.pyx":216 + /* "polluck_blockchain/placeholder_native.pyx":283 * * cdef Block *block = self.get_block_c(idx) * return PyBlock.from_ptr(block, owner=False) # <<<<<<<<<<<<<< @@ -5694,13 +6177,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, 216, __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, 283, __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":211 + /* "polluck_blockchain/placeholder_native.pyx":278 * return self._chain[0][idx] * * def get_block(self, idx): # <<<<<<<<<<<<<< @@ -5720,7 +6203,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":218 +/* "polluck_blockchain/placeholder_native.pyx":285 * return PyBlock.from_ptr(block, owner=False) * * cdef void add_block(self, Block *block): # <<<<<<<<<<<<<< @@ -5730,7 +6213,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":219 + /* "polluck_blockchain/placeholder_native.pyx":286 * * cdef void add_block(self, Block *block): * self._chain[0][block.index] = block # <<<<<<<<<<<<<< @@ -5739,7 +6222,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":220 + /* "polluck_blockchain/placeholder_native.pyx":287 * cdef void add_block(self, Block *block): * self._chain[0][block.index] = block * if self._genesis_done: # <<<<<<<<<<<<<< @@ -5748,7 +6231,7 @@ static void __pyx_f_18polluck_blockchain_18placeholder_native_10Blockchain_add_b */ if (__pyx_v_self->_genesis_done) { - /* "polluck_blockchain/placeholder_native.pyx":221 + /* "polluck_blockchain/placeholder_native.pyx":288 * self._chain[0][block.index] = block * if self._genesis_done: * self._index += 1 # <<<<<<<<<<<<<< @@ -5757,7 +6240,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":220 + /* "polluck_blockchain/placeholder_native.pyx":287 * cdef void add_block(self, Block *block): * self._chain[0][block.index] = block * if self._genesis_done: # <<<<<<<<<<<<<< @@ -5766,7 +6249,7 @@ static void __pyx_f_18polluck_blockchain_18placeholder_native_10Blockchain_add_b */ } - /* "polluck_blockchain/placeholder_native.pyx":218 + /* "polluck_blockchain/placeholder_native.pyx":285 * return PyBlock.from_ptr(block, owner=False) * * cdef void add_block(self, Block *block): # <<<<<<<<<<<<<< @@ -5777,7 +6260,7 @@ static void __pyx_f_18polluck_blockchain_18placeholder_native_10Blockchain_add_b /* function exit code */ } -/* "polluck_blockchain/placeholder_native.pyx":223 +/* "polluck_blockchain/placeholder_native.pyx":290 * self._index += 1 * * def create_genesis_block(self): # <<<<<<<<<<<<<< @@ -5846,19 +6329,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":226 + /* "polluck_blockchain/placeholder_native.pyx":293 * cdef Block *block = new Block( * self._index, - * datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp(), # <<<<<<<<<<<<<< + * int(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, 226, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 293, __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, 226, __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, 293, __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, 226, __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, 293, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_2 = __pyx_t_3; @@ -5869,74 +6352,77 @@ 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, 226, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __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, 226, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 293, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = __Pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 293, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "polluck_blockchain/placeholder_native.pyx":228 - * datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp(), + /* "polluck_blockchain/placeholder_native.pyx":295 + * int(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, 228, __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, 295, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":229 + /* "polluck_blockchain/placeholder_native.pyx":296 * 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, 229, __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, 296, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":230 + /* "polluck_blockchain/placeholder_native.pyx":297 * "Genesis Block".encode("UTF-8"), * "0".encode("UTF-8"), * "".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, 230, __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, 297, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":224 + /* "polluck_blockchain/placeholder_native.pyx":291 * * def create_genesis_block(self): * cdef Block *block = new Block( # <<<<<<<<<<<<<< * self._index, - * datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp(), + * int(datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp()), */ try { __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, 224, __pyx_L1_error) + __PYX_ERR(0, 291, __pyx_L1_error) } __pyx_v_block = __pyx_t_10; - /* "polluck_blockchain/placeholder_native.pyx":232 + /* "polluck_blockchain/placeholder_native.pyx":299 * "".encode("UTF-8"), * ) * block.hash = "dummy hash".encode("UTF-8") # <<<<<<<<<<<<<< * self.add_block(block) * 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, 232, __pyx_L1_error) + __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, 299, __pyx_L1_error) __pyx_v_block->hash = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_9); - /* "polluck_blockchain/placeholder_native.pyx":233 + /* "polluck_blockchain/placeholder_native.pyx":300 * ) * block.hash = "dummy hash".encode("UTF-8") * self.add_block(block) # <<<<<<<<<<<<<< * 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, 233, __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, 300, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":234 + /* "polluck_blockchain/placeholder_native.pyx":301 * block.hash = "dummy hash".encode("UTF-8") * self.add_block(block) * self._genesis_done = True # <<<<<<<<<<<<<< @@ -5945,7 +6431,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain */ __pyx_v_self->_genesis_done = 1; - /* "polluck_blockchain/placeholder_native.pyx":223 + /* "polluck_blockchain/placeholder_native.pyx":290 * self._index += 1 * * def create_genesis_block(self): # <<<<<<<<<<<<<< @@ -5969,7 +6455,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":236 +/* "polluck_blockchain/placeholder_native.pyx":303 * self._genesis_done = True * * def new_block(self, data): # <<<<<<<<<<<<<< @@ -6016,32 +6502,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, 236, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 303, __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, 236, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 303, __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, 236, __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, 303, __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, 236, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("new_block", 1, 1, 1, i); __PYX_ERR(0, 303, __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, 236, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 303, __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, 236, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("new_block", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 303, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -6084,7 +6570,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain int __pyx_clineno = 0; __Pyx_RefNannySetupContext("new_block", 0); - /* "polluck_blockchain/placeholder_native.pyx":237 + /* "polluck_blockchain/placeholder_native.pyx":304 * * def new_block(self, data): * if not self._genesis_done: # <<<<<<<<<<<<<< @@ -6094,7 +6580,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":238 + /* "polluck_blockchain/placeholder_native.pyx":305 * def new_block(self, data): * if not self._genesis_done: * raise RuntimeError("Create a genesis block first.") # <<<<<<<<<<<<<< @@ -6107,14 +6593,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, 238, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 305, __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, 238, __pyx_L1_error) + __PYX_ERR(0, 305, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":237 + /* "polluck_blockchain/placeholder_native.pyx":304 * * def new_block(self, data): * if not self._genesis_done: # <<<<<<<<<<<<<< @@ -6123,17 +6609,17 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain */ } - /* "polluck_blockchain/placeholder_native.pyx":240 + /* "polluck_blockchain/placeholder_native.pyx":307 * 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, 240, __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, 307, __pyx_L1_error) __pyx_v_prev_block = __pyx_t_5; - /* "polluck_blockchain/placeholder_native.pyx":241 + /* "polluck_blockchain/placeholder_native.pyx":308 * * cdef Block *prev_block = self.get_block_c(self._index) * cdef string prev_hash = prev_block.prev_hash # <<<<<<<<<<<<<< @@ -6143,7 +6629,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":242 + /* "polluck_blockchain/placeholder_native.pyx":309 * 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 # <<<<<<<<<<<<<< @@ -6152,19 +6638,19 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain */ __pyx_v_new_idx = (__pyx_v_self->_index + 1); - /* "polluck_blockchain/placeholder_native.pyx":246 + /* "polluck_blockchain/placeholder_native.pyx":313 * cdef Block *block = new Block( * new_idx, - * datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp(), # <<<<<<<<<<<<<< + * int(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, 246, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 313, __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, 246, __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, 313, __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, 246, __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, 313, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_3 = __pyx_t_7; @@ -6175,66 +6661,69 @@ 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, 246, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 313, __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, 246, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 313, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = __Pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 313, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "polluck_blockchain/placeholder_native.pyx":248 - * datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp(), + /* "polluck_blockchain/placeholder_native.pyx":315 + * int(datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp()), * 0, * data.encode("UTF-8"), # <<<<<<<<<<<<<< * prev_hash, * "".encode("UTF-8"), */ - __pyx_t_7 = __pyx_v_data; - __Pyx_INCREF(__pyx_t_7); + __pyx_t_2 = __pyx_v_data; + __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0; { - 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, 248, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_UTF_8}; + __pyx_t_7 = __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_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 315, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); } - __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; + __pyx_t_6 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_7); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 315, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "polluck_blockchain/placeholder_native.pyx":250 + /* "polluck_blockchain/placeholder_native.pyx":317 * 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, 250, __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, 317, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":244 + /* "polluck_blockchain/placeholder_native.pyx":311 * cdef uint64_t new_idx = self._index + 1 * * cdef Block *block = new Block( # <<<<<<<<<<<<<< * new_idx, - * datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp(), + * int(datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp()), */ try { __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, 244, __pyx_L1_error) + __PYX_ERR(0, 311, __pyx_L1_error) } __pyx_v_block = __pyx_t_5; - /* "polluck_blockchain/placeholder_native.pyx":252 + /* "polluck_blockchain/placeholder_native.pyx":319 * "".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, 252, __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, 319, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":236 + /* "polluck_blockchain/placeholder_native.pyx":303 * self._genesis_done = True * * def new_block(self, data): # <<<<<<<<<<<<<< @@ -6533,8 +7022,9 @@ 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_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}, + {"bytes_serialize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_11bytes_serialize, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_13__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_15__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; @@ -6875,16 +7365,17 @@ static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { /*--- Type init code ---*/ __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; + __pyx_vtable_18polluck_blockchain_18placeholder_native_PyBlock.bytes_serialize_c = (struct __pyx_t_18polluck_blockchain_18placeholder_native_SerializeResult (*)(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *))__pyx_f_18polluck_blockchain_18placeholder_native_7PyBlock_bytes_serialize_c; #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, 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) + __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, 55, __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, 55, __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, 33, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_PyBlock) < (0)) __PYX_ERR(0, 55, __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); @@ -6894,23 +7385,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, 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) + if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_PyBlock, __pyx_vtabptr_18polluck_blockchain_18placeholder_native_PyBlock) < (0)) __PYX_ERR(0, 55, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_PyBlock) < (0)) __PYX_ERR(0, 55, __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, 55, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_PyBlock) < (0)) __PYX_ERR(0, 55, __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, 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) + __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, 225, __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, 225, __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, 157, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain) < (0)) __PYX_ERR(0, 225, __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); @@ -6920,10 +7411,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, 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) + if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain, __pyx_vtabptr_18polluck_blockchain_18placeholder_native_Blockchain) < (0)) __PYX_ERR(0, 225, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain) < (0)) __PYX_ERR(0, 225, __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, 225, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain) < (0)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -7289,12 +7780,27 @@ __Pyx_RefNannySetupContext("PyInit_placeholder_native", 0); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_dopt_basics, __pyx_t_2) < (0)) __PYX_ERR(0, 13, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + /* "polluck_blockchain/placeholder_native.pyx":203 + * return SerializeResult(buf, total_len) + * + * def bytes_serialize(self): # <<<<<<<<<<<<<< + * cdef SerializeResult serialize_res + * try: +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_18polluck_blockchain_18placeholder_native_7PyBlock_11bytes_serialize, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PyBlock_bytes_serialize, 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(0, 203, __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_PyBlock, __pyx_mstate_global->__pyx_n_u_bytes_serialize, __pyx_t_2) < (0)) __PYX_ERR(0, 203, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * 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_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_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_18polluck_blockchain_18placeholder_native_7PyBlock_13__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[1])); 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); @@ -7308,7 +7814,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_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_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_18polluck_blockchain_18placeholder_native_7PyBlock_15__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[2])); 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); @@ -7316,64 +7822,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":189 + /* "polluck_blockchain/placeholder_native.pyx":256 * 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_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[3])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 256, __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) + 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, 256, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "polluck_blockchain/placeholder_native.pyx":211 + /* "polluck_blockchain/placeholder_native.pyx":278 * 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_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_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[4])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 278, __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, 211, __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, 278, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "polluck_blockchain/placeholder_native.pyx":223 + /* "polluck_blockchain/placeholder_native.pyx":290 * 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_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_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[5])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 290, __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, 223, __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, 290, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "polluck_blockchain/placeholder_native.pyx":236 + /* "polluck_blockchain/placeholder_native.pyx":303 * 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_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_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[6])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 303, __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, 236, __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, 303, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "(tree fragment)":1 @@ -7381,7 +7887,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_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_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[7])); 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); @@ -7395,7 +7901,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_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_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[8])); 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); @@ -7449,7 +7955,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) + __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_print); if (!__pyx_builtin_print) __PYX_ERR(0, 260, __pyx_L1_error) /* Cached unbound methods */ __pyx_mstate->__pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type; @@ -7469,14 +7975,14 @@ static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "polluck_blockchain/placeholder_native.pyx":55 + /* "polluck_blockchain/placeholder_native.pyx":77 * self.BlockC = new Block( * index, - * datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp(), # <<<<<<<<<<<<<< + * int(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, 55, __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, 77, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]); #if CYTHON_IMMORTAL_CONSTANTS @@ -7502,34 +8008,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},{8},{5},{1},{1},{2},{7},{6},{2},{9},{50},{45},{14},{10},{28},{30},{31},{20},{20},{31},{7},{25},{27},{20},{12},{18},{5},{18},{20},{4},{8},{11},{20},{6},{8},{13},{8},{9},{12},{7},{3},{5},{13},{2},{5},{8},{10},{8},{9},{7},{5},{4},{37},{3},{10},{9},{13},{5},{20},{8},{11},{14},{12},{10},{17},{13},{8},{4},{12},{10},{12},{19},{6},{8},{4},{9},{6},{0},{1},{13},{10},{52},{117},{97},{71},{9}}; - #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (893 bytes) */ -const char* const cstring = "BZh91AY&SY\000\024\376\\\000\000Y\377\373m\337\375\257v\177\354\305\277\367\366T\277\377\377\340@@@@@@@@@@@\000@\003\021vIQK\020\225\t#\321\036\221\265?Jh\321\221\246\3244\000z\201\243M\r4\0004\032h\311\241\223\324\323\311\006\232MM4\320\002(\362\032\203@\006\200\000\000\000\0004\007\250\323\324\365=2\207\014F\232h4\001\240\000\000\001\240\3104\3204\000h\320\006!\240\022H&P\310\232\236&\ny\252=5\017Ph\320\000h\000\000\000\r\003@\0364\003>\347\365s\347*4\256\206\221\206\242\010$\024&\207\326\034\020\rEC\2107\200\245\022\002\023E\362\t\001Eyg\007!\037\317\306m\262\357\240\375\334\331v\367`\037\367\223rX\277v\241y\266\333\232\364\222~\374\232H\364\325Qy6-d\n\316WV&&\"\261_n\330\371h\327\277fhc\006\034\243\021\035T\031\367\311~2\332\034=k\305\351\210\256\206FLrh\305oe\332\231\212\307\351\266g\202\227\014:\340\355\033\206\250O\277w\333f1\0056\330\213\220lV\234\201\207\0032\357\262q/l\005L\230\306\033Z\226\006r\004\016\223\277\210f\323[\246DR\n9\314\325\300<\320\025\206\205\001$)<\341\325A\242f\346\014\327>\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); + const struct { const unsigned int length: 7; } index[] = {{25},{29},{28},{8},{5},{1},{1},{7},{6},{2},{9},{50},{45},{14},{10},{28},{30},{31},{20},{20},{31},{7},{25},{27},{23},{20},{12},{18},{5},{15},{18},{20},{4},{8},{11},{20},{6},{8},{13},{8},{9},{12},{7},{3},{5},{13},{2},{5},{8},{10},{8},{9},{7},{5},{37},{3},{10},{9},{13},{5},{20},{3},{8},{11},{14},{12},{10},{17},{13},{8},{4},{13},{12},{10},{12},{19},{4},{6},{8},{4},{9},{6},{0},{1},{13},{10},{52},{121},{37},{101},{71},{9}}; + #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (965 bytes) */ +const char* const cstring = "BZh91AY&SY\022u\211t\000\000o\377\377m\377\375\257w\177\374\307\277\367\366T\277\357\377\360@@@@@@@@@\000@@@\000P\003>\355\314\353UJ\033\230j\251\372\232\233\325\0324~\246\023\325\0314\014&\021\246\001\r\003\324\003\004\320\310\006&\230\233DzyPh\246\246\305?Q\2411\006\251\372\210z\236\246\000\000\002\000\003\000\000\000\3224\323CA)\244L\202h\215\250\323G\251\212d\214\230\002`\230\010\300\010\304\300\000!\2005\016\000\032\006\200hh\000\000i\210h\323@\000\000\006\206@\000\030J\232\232\023\324\231\003\365C&\203@2\003A\210\000\320\001\243@\000\001\246\217SF\233\204\n\220T\373Z\340+ \341U\327\277\337\021\004\021\004R\"\305\226v,\376\026>\240\232f7\024\n\020\265A\320\305EQ+\261\350(I<\224`A!ES\360\274\325\262)s\n\367\355\267\236\034\336t\3535\263\005\310\262\311\0140W\005(7aRA\343\214\304)\010\025q!\201!\366\252\001T\335\236\247\204\"?|\317\301\354~{d,\220\216\201)k\307#zz;\324\0227\0277;uQ\357\272\305\200\336^\211n\323:\207\201\206VG\203\316\n\363]\030\025\031\255\037:>\371\020i\232\025\010\r\031\2018\016\340\242\3737\355\343\215\311\325\032\306\245\021\301\022\267b+\360\263TF?\2140\251\231\320\232\020\214p\322IX\316\315F\276\036\033\345\032\266\214\230*\177\274\331\211\003\004\026`9\365\240k\211\265\001[\255x\270\033\035w,B;\"\224\324`\230\264\214N\203H\331\312na3BC\244\356\222I\026\314\226F\241\3478\214\357\366\275\241\"\235:\326\230\375PK\212\024\014(\225T!\003p\211\003\005AQ\345\031,\226M\240\361\246\023\310U\315\262\323\010\271\254\212\366\013\230 \324\026\314\322\031\332\353\032\310\037-\252\246\305\343\017\273\234Jp\031\0320y\340\0160\223\262D\214\304\020\223i\362\264\020$\006\035pS`\034\300:\343\030\t\013\004\276@\231&L$\222H\244\201\020\242\273`\333\246%\373\300\301<\373\347\233\002\004\205\022\271\326\325K{.\0354&\200g\236\210\232\373\031\224\032\373\337\020\303d\307+\"\320\244UP#T\001\201X4Q""\n \242\032\303\252i\336;G%yW;\313\r\201\rj\032\371\266\205\2373\217\217\016#\r\327\344\312[j\023*Zt\262vZ\014e\220K\023\265S\330\271\342\326\270\352\213 \253C`\326\032A\007\335\276\254Z\322\t\276\020\226m+n\317\212\214O\033\212\214\342\333\262\200 \343\023\3321@q\242j(\332JF\212\350\262\277\331\336\2462\354p\r\313\306\270\312\2356G\304+\3405f\226#\016\233F\t\260\255A\010\250}O\270\324\300n\031r)\327\220\210\0368Z-K\212p\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); + #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (831 bytes) */ +const char* const cstring = "x\332\205T\317\217\3238\024V\305\010\312\320a\267\200@\010X\245\253\005\361\2630\200\004\007\330\325\374\000v\320\302n\321 !\204d\271\216\333Z\223\330\251\355\224vOs\354\321G\037}\3141G\216\374\t\034s\234?e\237\323\2643lG\"R\342g\177\317~\337{\357s\266D\032\205\001\027:\300Q$\010\3264\030`\025\343dKR?\301A\237r\252\230\n\272\000\357\005=&\225n\357\360\220\216\203\021\216R\032\000$R\035\210^\320\025)\017\325?\223M\357y\363\375\356\313{Oo\375\0212\205\273\021\245\334\177\373\204\251\231\025r\021\204\264\207\323H\007\010I\032\246\204\"\024\204p\240\026\300\207\337\323\222\215\030\216\000%\2143\215\220\222\344~\"\242(%{\250$C\006\230\361\373I\204\t\035\210(\244\022q\254\331\210\266\223\311\370\231\202\375\274\257D*\t\375}s\341~h\265\027a\311D\017\004G\350;LQ\2554T\3408\224\224\265AUefd\216\300}\252\227\3268\375\274\264\226\000C\215\366\350\004\225\225D\tf\262\252^5,s<\004\226\010\316\241\356DS\005\260\204\352\261\177\251\007\306\360n3\242\321[:\326\357how\347\315\213\217\177\277}\201\336\357na5\341\204\2116\021\022\372\310 \245\222\347\377N!\021 \210q\244%\224\273\213!\207c\212\020b\215\341\245\232\3054\024\t\224\001+F\324\021\263=\207)'\002\004 E\214\022-\375\350W!\2438A\250\227r\202\320\242\216\2459K\026\201:\007\021\353\262p\314\274\010\021\204^0g\232i\032+\204b(/\202'\026a\032Qoq\034\303\270\350\2027\340\010\320\031\241\313\232j/k*\021I\"\351h\346TZ\236\2107\230HU5\201v\036\327S\310/\231\3143\001m\242*\025o\216\264\277\r\236\3410\305\321\214\345\341}Xj\377b\0012/'\211\364J\210z\207\355\226\3206/\216*e\260\252{vD2\350\030\371(\330\014\227&\005\225 h\275\377BC\026M)\323Q\017^U\177\203Rja\032\307\023\377\277\030\354o\024\3653\323\307Si\316\231G&\264\277\332mW+\032\347\314m\273a;\007\365\2530od\033Y\247\250_4\314\016\335Z\326\231\357\321f\335{\336\265\330\016\017\352-w\301}\312\233\371o9.\352\201[\315Z~Xq\177f\233\031\366\007\355\270N\321X+\032?M\207\246nO\273\246\273\221\255d[\231\316\037\345\335/\253_[%\372\2639e\206\266V\332g\247}\3231\260\2711}m\260\031\356o\034""\324O\027\r\340\364-x\230\203\377y\363\034\"l\2728_?\200\2355s\315b\317\256\n\006+?\nw\305>q-\267\356\335>\373\020G\202\256M?\230O\356RV\313\232\305\234\001\030\337\032\327lY\202\353n7\273\224\237\314\301\365\354\224\230\363f\333\236\262\332\237\3254M\250\nq\315\242q\301\374\345N\370\265_,s\303\2546\003!\366e\333\264\255\375Z\261\262:\275c:\377\0011\225J\306"; + PyObject *data = __Pyx_DecompressString(cstring, 831, 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 (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"; + #else /* compression: none (1486 bytes) */ +const char* const bytes = "Could not allocate hasmapCreate a genesis block first.Index value is out of boundsPyBlock(UTF-8)?disableenablegcisenabledno 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__PyBlock.bytes_serialize__Pyx_PyDict_NextRefTIMEZONE_UTCasyncio.coroutinesblockbytes_serializecline_in_tracebackcreate_genesis_blockdatadatetimedopt_basicsdopt_basics.datetimeencodefrom_ptrfromtimestamp__func__get_block__getstate__hashlibidxindex_is_coroutineititems__main____module____name__new_blocknew_idxnoncepolluck_blockchain.placeholder_nativepopprev_blockprev_hashprevious_hashprintprint_key_value_pairptrpy_block__pyx_state__pyx_vtable____qualname____reduce____reduce_cython____reduce_ex____repr__selfserialize_res__set_name__setdefault__setstate____setstate_cython__sizestruct__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\017\210q\220\010\230\t\240\021\240&\250\004\250C\250t\2603\260b\270\n\300!\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\340\010\t\330\014\034\230D\320 2\260!\330\014\023\220=\240\004\240B\240m\2601\340\014\020\220\001\220\035\230a\200A\330\010\034\230I\240Q\330\014\020\220\001\330\014\017\210q\220\010\230\t\240\021\240&\250\004\250C\250t\2603\260b\270\n\300!\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 < 80; i++) { + for (int i = 0; i < 82; i++) { Py_ssize_t bytes_length = index[i].length; PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL); - if (likely(string) && i >= 16) PyUnicode_InternInPlace(&string); + if (likely(string) && i >= 14) PyUnicode_InternInPlace(&string); if (unlikely(!string)) { Py_XDECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) @@ -7537,7 +8043,7 @@ const char* const bytes = "Allocation of block object failedCould not allocate h stringtab[i] = string; pos += bytes_length; } - for (int i = 80; i < 89; i++) { + for (int i = 82; i < 92; i++) { Py_ssize_t bytes_length = index[i].length; PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length); stringtab[i] = string; @@ -7548,15 +8054,15 @@ const char* const bytes = "Allocation of block object failedCould not allocate h } } Py_XDECREF(data); - for (Py_ssize_t i = 0; i < 89; i++) { + for (Py_ssize_t i = 0; i < 92; i++) { if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { __PYX_ERR(0, 1, __pyx_L1_error) } } #if CYTHON_IMMORTAL_CONSTANTS { - PyObject **table = stringtab + 80; - for (Py_ssize_t i=0; i<9; ++i) { + PyObject **table = stringtab + 82; + for (Py_ssize_t i=0; i<10; ++i) { #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); #else @@ -7598,7 +8104,7 @@ typedef struct { unsigned int num_kwonly_args : 1; unsigned int nlocals : 3; unsigned int flags : 10; - unsigned int first_line : 8; + unsigned int first_line : 9; } __Pyx_PyCode_New_function_description; /* NewCodeObj.proto */ static PyObject* __Pyx_PyCode_New( @@ -7614,45 +8120,50 @@ static PyObject* __Pyx_PyCode_New( static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) { PyObject* tuple_dedup_map = PyDict_New(); if (unlikely(!tuple_dedup_map)) return -1; + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 203}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_serialize_res}; + __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_polluck_blockchain_placehold, __pyx_mstate->__pyx_n_u_bytes_serialize, __pyx_mstate->__pyx_kp_b_iso88591_A_D_2_Bm1_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) 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[0] = __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[0])) goto bad; + __pyx_mstate_global->__pyx_codeobj_tab[1] = __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[1])) 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[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; + __pyx_mstate_global->__pyx_codeobj_tab[2] = __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[2])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 189}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 256}; 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; + __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_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[3])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 211}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 278}; 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[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; + __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_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[4])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 223}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 290}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __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_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; + __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_create_genesis_block, __pyx_mstate->__pyx_kp_b_iso88591_A_IQ_q_Ct3b_7_1_waq_gQa_X_Jaq_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 236}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 303}; 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[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; + __pyx_mstate_global->__pyx_codeobj_tab[6] = __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_q_Ct3b_q_gQa_J, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) 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[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; + __pyx_mstate_global->__pyx_codeobj_tab[7] = __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[7])) 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[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; + __pyx_mstate_global->__pyx_codeobj_tab[8] = __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[8])) goto bad; } Py_DECREF(tuple_dedup_map); return 0; @@ -8984,114 +9495,6 @@ static void __Pyx_RaiseArgtupleInvalid( (num_expected == 1) ? "" : "s", num_found); } -/* RaiseException */ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - PyObject* owned_instance = NULL; - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (PyExceptionClass_Check(type)) { - PyObject *instance_class = NULL; - if (value && PyExceptionInstance_Check(value)) { - instance_class = (PyObject*) Py_TYPE(value); - if (instance_class != type) { - int is_subclass = PyObject_IsSubclass(instance_class, type); - if (!is_subclass) { - instance_class = NULL; - } else if (unlikely(is_subclass == -1)) { - goto bad; - } else { - type = instance_class; - } - } - } - if (!instance_class) { - PyObject *args; - if (!value) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } else - args = PyTuple_Pack(1, value); - if (!args) - goto bad; - owned_instance = PyObject_Call(type, args, NULL); - Py_DECREF(args); - if (!owned_instance) - goto bad; - value = owned_instance; - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %R should have returned an instance of " - "BaseException, not %R", - type, Py_TYPE(value)); - goto bad; - } - } - } else { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } - if (cause) { - PyObject *fixed_cause; - if (cause == Py_None) { - fixed_cause = NULL; - } else if (PyExceptionClass_Check(cause)) { - fixed_cause = PyObject_CallObject(cause, NULL); - if (fixed_cause == NULL) - goto bad; - } else if (PyExceptionInstance_Check(cause)) { - fixed_cause = cause; - Py_INCREF(fixed_cause); - } else { - PyErr_SetString(PyExc_TypeError, - "exception causes must derive from " - "BaseException"); - goto bad; - } - PyException_SetCause(value, fixed_cause); - } - PyErr_SetObject(type, value); - if (tb) { -#if PY_VERSION_HEX >= 0x030C00A6 - PyException_SetTraceback(value, tb); -#elif CYTHON_FAST_THREAD_STATE - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); - } -#else - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); -#endif - } -bad: - Py_XDECREF(owned_instance); - return; -} - /* KeywordStringCheck */ static int __Pyx_CheckKeywordStrings( const char* function_name, @@ -9267,6 +9670,353 @@ static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds) { } } +/* GetException */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) +#endif +{ + PyObject *local_type = NULL, *local_value, *local_tb = NULL; +#if CYTHON_FAST_THREAD_STATE + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if PY_VERSION_HEX >= 0x030C0000 + local_value = tstate->current_exception; + tstate->current_exception = 0; + #else + local_type = tstate->curexc_type; + local_value = tstate->curexc_value; + local_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + #endif +#elif __PYX_LIMITED_VERSION_HEX > 0x030C0000 + local_value = PyErr_GetRaisedException(); +#else + PyErr_Fetch(&local_type, &local_value, &local_tb); +#endif +#if __PYX_LIMITED_VERSION_HEX > 0x030C0000 + if (likely(local_value)) { + local_type = (PyObject*) Py_TYPE(local_value); + Py_INCREF(local_type); + local_tb = PyException_GetTraceback(local_value); + } +#else + PyErr_NormalizeException(&local_type, &local_value, &local_tb); +#if CYTHON_FAST_THREAD_STATE + if (unlikely(tstate->curexc_type)) +#else + if (unlikely(PyErr_Occurred())) +#endif + goto bad; + if (local_tb) { + if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) + goto bad; + } +#endif // __PYX_LIMITED_VERSION_HEX > 0x030C0000 + Py_XINCREF(local_tb); + Py_XINCREF(local_type); + Py_XINCREF(local_value); + *type = local_type; + *value = local_value; + *tb = local_tb; +#if CYTHON_FAST_THREAD_STATE + #if CYTHON_USE_EXC_INFO_STACK + { + _PyErr_StackItem *exc_info = tstate->exc_info; + #if PY_VERSION_HEX >= 0x030B00a4 + tmp_value = exc_info->exc_value; + exc_info->exc_value = local_value; + tmp_type = NULL; + tmp_tb = NULL; + Py_XDECREF(local_type); + Py_XDECREF(local_tb); + #else + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = local_type; + exc_info->exc_value = local_value; + exc_info->exc_traceback = local_tb; + #endif + } + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = local_type; + tstate->exc_value = local_value; + tstate->exc_traceback = local_tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#elif __PYX_LIMITED_VERSION_HEX >= 0x030b0000 + PyErr_SetHandledException(local_value); + Py_XDECREF(local_value); + Py_XDECREF(local_type); + Py_XDECREF(local_tb); +#else + PyErr_SetExcInfo(local_type, local_value, local_tb); +#endif + return 0; +#if __PYX_LIMITED_VERSION_HEX <= 0x030C0000 +bad: + *type = 0; + *value = 0; + *tb = 0; + Py_XDECREF(local_type); + Py_XDECREF(local_value); + Py_XDECREF(local_tb); + return -1; +#endif +} + +/* SwapException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_value = exc_info->exc_value; + exc_info->exc_value = *value; + if (tmp_value == NULL || tmp_value == Py_None) { + Py_XDECREF(tmp_value); + tmp_value = NULL; + tmp_type = NULL; + tmp_tb = NULL; + } else { + tmp_type = (PyObject*) Py_TYPE(tmp_value); + Py_INCREF(tmp_type); + #if CYTHON_COMPILING_IN_CPYTHON + tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback; + Py_XINCREF(tmp_tb); + #else + tmp_tb = PyException_GetTraceback(tmp_value); + #endif + } + #elif CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = *type; + exc_info->exc_value = *value; + exc_info->exc_traceback = *tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = *type; + tstate->exc_value = *value; + tstate->exc_traceback = *tb; + #endif + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); + PyErr_SetExcInfo(*type, *value, *tb); + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} +#endif + +/* GetTopmostException (used by SaveResetException) */ +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE +static _PyErr_StackItem * +__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) +{ + _PyErr_StackItem *exc_info = tstate->exc_info; + while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && + exc_info->previous_item != NULL) + { + exc_info = exc_info->previous_item; + } + return exc_info; +} +#endif + +/* SaveResetException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + PyObject *exc_value = exc_info->exc_value; + if (exc_value == NULL || exc_value == Py_None) { + *value = NULL; + *type = NULL; + *tb = NULL; + } else { + *value = exc_value; + Py_INCREF(*value); + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + *tb = PyException_GetTraceback(exc_value); + } + #elif CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + *type = exc_info->exc_type; + *value = exc_info->exc_value; + *tb = exc_info->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #else + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #endif +} +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + PyObject *tmp_value = exc_info->exc_value; + exc_info->exc_value = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); + #else + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = type; + exc_info->exc_value = value; + exc_info->exc_traceback = tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); + #endif +} +#endif + +/* RaiseException */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *instance_class = NULL; + if (value && PyExceptionInstance_Check(value)) { + instance_class = (PyObject*) Py_TYPE(value); + if (instance_class != type) { + int is_subclass = PyObject_IsSubclass(instance_class, type); + if (!is_subclass) { + instance_class = NULL; + } else if (unlikely(is_subclass == -1)) { + goto bad; + } else { + type = instance_class; + } + } + } + if (!instance_class) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyObject_Call(type, args, NULL); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + if (cause) { + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyException_SetTraceback(value, tb); +#elif CYTHON_FAST_THREAD_STATE + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); +#endif + } +bad: + Py_XDECREF(owned_instance); + return; +} + /* AllocateExtensionType */ static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final) { if (is_final || likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { @@ -11829,6 +12579,107 @@ bad: return (target_type) value;\ } +/* PyObjectVectorCallKwBuilder (used by CIntToPy) */ +#if CYTHON_VECTORCALL +static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + (void)__Pyx_PyObject_FastCallDict; + if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1; + Py_INCREF(key); + args[n] = value; + return 0; +} +CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + (void)__Pyx_VectorcallBuilder_AddArgStr; + if (unlikely(!PyUnicode_Check(key))) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + return -1; + } + return __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n); +} +static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + PyObject *pyKey = PyUnicode_FromString(key); + if (!pyKey) return -1; + return __Pyx_VectorcallBuilder_AddArg(pyKey, value, builder, args, n); +} +#else // CYTHON_VECTORCALL +CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, CYTHON_UNUSED PyObject **args, CYTHON_UNUSED int n) { + if (unlikely(!PyUnicode_Check(key))) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + return -1; + } + return PyDict_SetItem(builder, key, value); +} +#endif + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(uint64_t) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint64_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(uint64_t) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(uint64_t), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(uint64_t)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + /* CIntFromPy */ static CYTHON_INLINE uint64_t __Pyx_PyLong_As_uint64_t(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC @@ -12079,107 +12930,6 @@ raise_neg_overflow: return (uint64_t) -1; } -/* PyObjectVectorCallKwBuilder (used by CIntToPy) */ -#if CYTHON_VECTORCALL -static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { - (void)__Pyx_PyObject_FastCallDict; - if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1; - Py_INCREF(key); - args[n] = value; - return 0; -} -CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { - (void)__Pyx_VectorcallBuilder_AddArgStr; - if (unlikely(!PyUnicode_Check(key))) { - PyErr_SetString(PyExc_TypeError, "keywords must be strings"); - return -1; - } - return __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n); -} -static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n) { - PyObject *pyKey = PyUnicode_FromString(key); - if (!pyKey) return -1; - return __Pyx_VectorcallBuilder_AddArg(pyKey, value, builder, args, n); -} -#else // CYTHON_VECTORCALL -CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, CYTHON_UNUSED PyObject **args, CYTHON_UNUSED int n) { - if (unlikely(!PyUnicode_Check(key))) { - PyErr_SetString(PyExc_TypeError, "keywords must be strings"); - return -1; - } - return PyDict_SetItem(builder, key, value); -} -#endif - -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(uint64_t) < sizeof(long)) { - return PyLong_FromLong((long) value); - } else if (sizeof(uint64_t) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#if !CYTHON_COMPILING_IN_PYPY - } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(uint64_t) <= sizeof(long)) { - return PyLong_FromLong((long) value); - } else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); - } - } - { - unsigned char *bytes = (unsigned char *)&value; -#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 - if (is_unsigned) { - return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); - } else { - return PyLong_FromNativeBytes(bytes, sizeof(value), -1); - } -#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 - int one = 1; int little = (int)*(unsigned char *)&one; - return _PyLong_FromByteArray(bytes, sizeof(uint64_t), - little, !is_unsigned); -#else - int one = 1; int little = (int)*(unsigned char *)&one; - PyObject *from_bytes, *result = NULL, *kwds = NULL; - PyObject *py_bytes = NULL, *order_str = NULL; - from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); - if (!from_bytes) return NULL; - py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(uint64_t)); - if (!py_bytes) goto limited_bad; - order_str = PyUnicode_FromString(little ? "little" : "big"); - if (!order_str) goto limited_bad; - { - PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; - if (!is_unsigned) { - kwds = __Pyx_MakeVectorcallBuilderKwds(1); - if (!kwds) goto limited_bad; - if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; - } - result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); - } - limited_bad: - Py_XDECREF(kwds); - Py_XDECREF(order_str); - Py_XDECREF(py_bytes); - Py_XDECREF(from_bytes); - return result; -#endif - } -} - /* FormatTypeName */ #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000 static __Pyx_TypeName diff --git a/src/polluck_blockchain/placeholder_native.pyx b/src/polluck_blockchain/placeholder_native.pyx index f6ec72a..f0a2ecb 100644 --- a/src/polluck_blockchain/placeholder_native.pyx +++ b/src/polluck_blockchain/placeholder_native.pyx @@ -17,18 +17,40 @@ 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 libc.stdlib cimport malloc, free +from libc.string cimport memcpy from cython.operator import postincrement, dereference + ctypedef unsigned long ULong ctypedef unordered_map[uint64_t, Block*] BcHashmap -cdef timestamp_to_datetime(double ts): - return datetime.datetime.fromtimestamp(ts, dopt_basics.datetime.TIMEZONE_UTC) +cdef timestamp_to_datetime(uint64_t ts): + return datetime.datetime.fromtimestamp(float(ts), dopt_basics.datetime.TIMEZONE_UTC) -cdef float_to_bytes(double num): - return struct.pack(">d", num) +# cdef float_to_bytes(double num): +# return struct.pack(">d", num) +cdef int serialize_uint32(unsigned char* out, unsigned int v) except -1 nogil: + out[0] = (v >> 24) & 0xFF + out[1] = (v >> 16) & 0xFF + out[2] = (v >> 8) & 0xFF + out[3] = v & 0xFF + +cdef int serialize_uint64(unsigned char* out, unsigned long long v) except -1 nogil: + out[0] = (v >> 56) & 0xFF + out[1] = (v >> 48) & 0xFF + out[2] = (v >> 40) & 0xFF + out[3] = (v >> 32) & 0xFF + out[4] = (v >> 24) & 0xFF + out[5] = (v >> 16) & 0xFF + out[6] = (v >> 8) & 0xFF + out[7] = v & 0xFF + +cdef struct SerializeResult: + unsigned char *ptr + size_t size cdef class PyBlock: cdef: @@ -52,26 +74,19 @@ cdef class PyBlock: if not from_ptr: self.BlockC = new Block( index, - datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp(), + int(datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp()), nonce, data.encode("UTF-8"), previous_hash.encode("UTF-8"), "".encode("UTF-8"), ) if self.BlockC == NULL: - raise MemoryError("Allocation of block object failed") + raise MemoryError() self.ptr_owner = True def __init__(self, *args, **kwargs): pass - # self._index = index - # # self._timestamp = dopt_basics.datetime.current_time_tz().timestamp() - # self._timestamp = datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp() - # self._data = data.encode("UTF-8") - # self._prev_hash = previous_hash.encode("UTF-8") - # self._nonce = nonce - # self._hash = "".encode("UTF-8") def __dealloc__(self): if self.BlockC is not NULL and self.ptr_owner is True: @@ -144,6 +159,58 @@ cdef class PyBlock: def hash(self): return self.BlockC.hash.decode("UTF-8") + cdef SerializeResult bytes_serialize_c(self): + cdef: + size_t total_len + unsigned char* buf + size_t pos = 0 + + # index (8), timestamp (8), nonce (8), data, prev_hash + total_len = ( + (8 * 3) + + self.BlockC.data.size() + + self.BlockC.prev_hash.size() + ) + buf = malloc(total_len * sizeof(unsigned char)) + + if buf == NULL: + raise MemoryError() + + serialize_uint64(buf + pos, self.BlockC.index) + pos += 8 + serialize_uint64(buf + pos, self.BlockC.timestamp) + pos += 8 + serialize_uint64(buf + pos, self.BlockC.nonce) + pos += 8 + # Copy data + memcpy( + buf + pos, + self.BlockC.data.c_str(), + self.BlockC.data.size(), + ) + pos += self.BlockC.data.size() + # Copy prev_hash + memcpy( + buf + pos, + self.BlockC.prev_hash.c_str(), + self.BlockC.prev_hash.size(), + ) + pos += self.BlockC.prev_hash.size() + + return SerializeResult(buf, total_len) + + def bytes_serialize(self): + cdef SerializeResult serialize_res + try: + serialize_res = self.bytes_serialize_c() + return serialize_res.ptr[:serialize_res.size] + finally: + free(serialize_res.ptr) + + + + + # @hash.setter # def hash(self, value): # if not isinstance(value, str): @@ -222,7 +289,7 @@ cdef class Blockchain: def create_genesis_block(self): cdef Block *block = new Block( self._index, - datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp(), + int(datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp()), 0, "Genesis Block".encode("UTF-8"), "0".encode("UTF-8"), @@ -242,7 +309,7 @@ cdef class Blockchain: cdef Block *block = new Block( new_idx, - datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp(), + int(datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp()), 0, data.encode("UTF-8"), prev_hash,