From b3324182f73e71e6771dacb57e0f32e8b025ce86 Mon Sep 17 00:00:00 2001 From: foefl Date: Mon, 15 Dec 2025 10:46:21 +0100 Subject: [PATCH] working serialization --- setup.py | 25 +- src/polluck_blockchain/openssl_evp.pxd | 15 + src/polluck_blockchain/placeholder_native.cpp | 1671 +++++++++++------ src/polluck_blockchain/placeholder_native.pyx | 79 +- 4 files changed, 1225 insertions(+), 565 deletions(-) create mode 100644 src/polluck_blockchain/openssl_evp.pxd diff --git a/setup.py b/setup.py index c7c074c..2d17f78 100644 --- a/setup.py +++ b/setup.py @@ -1,25 +1,44 @@ import os import sys +from pathlib import Path from Cython.Build import cythonize from Cython.Compiler import Options -from setuptools import setup +from setuptools import Extension, setup +# Cython compilation options Options.docstrings = False Options.embed_pos_in_docstring = False Options.annotate = False Options.fast_fail = True DEBUG = bool(os.getenv("DOPT_DEBUG", None)) - linetrace_opt: bool = False if DEBUG: linetrace_opt = True +# includes +OPENSSL_DIR = (Path(__file__).parent / "openssl").resolve() +assert OPENSSL_DIR.exists() +openssl_include = OPENSSL_DIR / "include" +assert openssl_include.exists() +openssl_lib = OPENSSL_DIR / "lib" +assert openssl_lib.exists() + +ext = Extension( + name="polluck_blockchain.placeholder_native", + sources=["src/polluck_blockchain/placeholder_native.pyx"], + include_dirs=[str(openssl_include)], + library_dirs=[str(openssl_lib)], + libraries=["libssl", "libcrypto"], +) + + ext_modules = cythonize( [ + ext, # "src/polluck_blockchain/placeholder.py", - "src/polluck_blockchain/placeholder_native.pyx", + # "src/polluck_blockchain/placeholder_native.pyx", # "src/polluck_blockchain/python_translate.py", ], compiler_directives={ diff --git a/src/polluck_blockchain/openssl_evp.pxd b/src/polluck_blockchain/openssl_evp.pxd new file mode 100644 index 0000000..ca4016c --- /dev/null +++ b/src/polluck_blockchain/openssl_evp.pxd @@ -0,0 +1,15 @@ + +cdef extern from "openssl/evp.h": + ctypedef struct EVP_MD_CTX: + pass + ctypedef struct EVP_MD: + pass + EVP_MD_CTX *EVP_MD_CTX_new() + void EVP_MD_CTX_free(EVP_MD_CTX *) + const EVP_MD *EVP_sha256() + int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, void *impl) + int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, size_t cnt) + int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, + unsigned int *s) + int EVP_MD_size(const EVP_MD *md) + int EVP_MD_CTX_reset(EVP_MD_CTX *ctx) diff --git a/src/polluck_blockchain/placeholder_native.cpp b/src/polluck_blockchain/placeholder_native.cpp index adce004..6e0e66c 100644 --- a/src/polluck_blockchain/placeholder_native.cpp +++ b/src/polluck_blockchain/placeholder_native.cpp @@ -1,15 +1,24 @@ -/* Generated by Cython 3.2.2 */ +/* Generated by Cython 3.2.3 */ /* BEGIN: Cython Metadata { "distutils": { "depends": [ + "A:\\Arbeitsaufgaben\\Polluck-projects\\blockchain\\openssl\\include\\openssl\\evp.h", "src\\polluck_blockchain\\block.hpp" ], "include_dirs": [ - "src\\polluck_blockchain" + "src\\polluck_blockchain", + "A:\\Arbeitsaufgaben\\Polluck-projects\\blockchain\\openssl\\include" ], "language": "c++", + "libraries": [ + "libssl", + "libcrypto" + ], + "library_dirs": [ + "A:\\Arbeitsaufgaben\\Polluck-projects\\blockchain\\openssl\\lib" + ], "name": "polluck_blockchain.placeholder_native", "sources": [ "src/polluck_blockchain/placeholder_native.pyx" @@ -41,8 +50,8 @@ END: Cython Metadata */ #elif PY_VERSION_HEX < 0x03080000 #error Cython requires Python 3.8+. #else -#define __PYX_ABI_VERSION "3_2_2" -#define CYTHON_HEX_VERSION 0x030202F0 +#define __PYX_ABI_VERSION "3_2_3" +#define CYTHON_HEX_VERSION 0x030203F0 #define CYTHON_FUTURE_DIVISION 1 /* CModulePreamble */ #include @@ -1172,6 +1181,7 @@ static int __Pyx_init_co_variables(void) { #include #include +#include "openssl/evp.h" #ifdef _OPENMP #include #endif /* _OPENMP */ @@ -1180,6 +1190,15 @@ static int __Pyx_init_co_variables(void) { #define CYTHON_WITHOUT_ASSERTIONS #endif +#ifdef CYTHON_FREETHREADING_COMPATIBLE +#if CYTHON_FREETHREADING_COMPATIBLE +#define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_NOT_USED +#else +#define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_USED +#endif +#else +#define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_USED +#endif #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 #define __PYX_DEFAULT_STRING_ENCODING "" @@ -1554,7 +1573,7 @@ static const char* const __pyx_f[] = { /* #### Code section: numeric_typedefs ### */ -/* "polluck_blockchain/placeholder_native.pyx":25 +/* "polluck_blockchain/placeholder_native.pyx":26 * * * ctypedef unsigned long ULong # <<<<<<<<<<<<<< @@ -1568,10 +1587,9 @@ 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":26 +/* "polluck_blockchain/placeholder_native.pyx":27 * * ctypedef unsigned long ULong * ctypedef unordered_map[uint64_t, Block*] BcHashmap # <<<<<<<<<<<<<< @@ -1580,19 +1598,7 @@ struct __pyx_opt_args_18polluck_blockchain_18placeholder_native_7PyBlock_from_pt */ typedef std::unordered_map __pyx_t_18polluck_blockchain_18placeholder_native_BcHashmap; -/* "polluck_blockchain/placeholder_native.pyx":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 +/* "polluck_blockchain/placeholder_native.pyx":102 * * @staticmethod * cdef PyBlock from_ptr(Block *block, bint owner=False): # <<<<<<<<<<<<<< @@ -1604,8 +1610,8 @@ struct __pyx_opt_args_18polluck_blockchain_18placeholder_native_7PyBlock_from_pt int owner; }; -/* "polluck_blockchain/placeholder_native.pyx":55 - * size_t size +/* "polluck_blockchain/placeholder_native.pyx":60 + * # size_t size * * cdef class PyBlock: # <<<<<<<<<<<<<< * cdef: @@ -1619,7 +1625,7 @@ struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock { }; -/* "polluck_blockchain/placeholder_native.pyx":225 +/* "polluck_blockchain/placeholder_native.pyx":279 * * * cdef class Blockchain: # <<<<<<<<<<<<<< @@ -1637,8 +1643,8 @@ struct __pyx_obj_18polluck_blockchain_18placeholder_native_Blockchain { -/* "polluck_blockchain/placeholder_native.pyx":55 - * size_t size +/* "polluck_blockchain/placeholder_native.pyx":60 + * # size_t size * * cdef class PyBlock: # <<<<<<<<<<<<<< * cdef: @@ -1647,12 +1653,15 @@ 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 *); + unsigned char *(*bytes_serialize_c)(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *, size_t *); + unsigned char *(*digest)(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *, unsigned char *, size_t, size_t *); + unsigned char *(*perform_hash_c)(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *, size_t *); + PyObject *(*perform_hash)(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *, int __pyx_skip_dispatch); }; static struct __pyx_vtabstruct_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_vtabptr_18polluck_blockchain_18placeholder_native_PyBlock; -/* "polluck_blockchain/placeholder_native.pyx":225 +/* "polluck_blockchain/placeholder_native.pyx":279 * * * cdef class Blockchain: # <<<<<<<<<<<<<< @@ -2143,6 +2152,14 @@ static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) #endif +/* MoveIfSupported.proto */ +#if CYTHON_USE_CPP_STD_MOVE + #include + #define __PYX_STD_MOVE_IF_SUPPORTED(x) std::move(x) +#else + #define __PYX_STD_MOVE_IF_SUPPORTED(x) x +#endif + /* PyTypeError_Check.proto */ #define __Pyx_PyExc_TypeError_Check(obj) __Pyx_TypeCheck(obj, PyExc_TypeError) @@ -2155,14 +2172,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject /* PyIndexError_Check.proto */ #define __Pyx_PyExc_IndexError_Check(obj) __Pyx_TypeCheck(obj, PyExc_IndexError) -/* MoveIfSupported.proto */ -#if CYTHON_USE_CPP_STD_MOVE - #include - #define __PYX_STD_MOVE_IF_SUPPORTED(x) std::move(x) -#else - #define __PYX_STD_MOVE_IF_SUPPORTED(x) x -#endif - /* PyRuntimeError_Check.proto */ #define __Pyx_PyExc_RuntimeError_Check(obj) __Pyx_TypeCheck(obj, PyExc_RuntimeError) @@ -2579,7 +2588,10 @@ 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 unsigned char *__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_size); /* proto*/ +static unsigned char *__pyx_f_18polluck_blockchain_18placeholder_native_7PyBlock_digest(CYTHON_UNUSED struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self, unsigned char *__pyx_v_data, size_t __pyx_v_data_size, size_t *__pyx_v_digest_size); /* proto*/ +static unsigned char *__pyx_f_18polluck_blockchain_18placeholder_native_7PyBlock_perform_hash_c(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self, size_t *__pyx_v_digest_size); /* proto*/ +static PyObject *__pyx_f_18polluck_blockchain_18placeholder_native_7PyBlock_perform_hash(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self, int __pyx_skip_dispatch); /* 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*/ @@ -2603,6 +2615,8 @@ static void __pyx_f_18polluck_blockchain_18placeholder_native_10Blockchain_add_b /* Module declarations from "libc.stdlib" */ +/* Module declarations from "polluck_blockchain.openssl_evp" */ + /* Module declarations from "polluck_blockchain.placeholder_native" */ 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*/ @@ -2634,8 +2648,9 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_9pr 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_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 PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_12perform_hash(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_14__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_16__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 */ @@ -2678,8 +2693,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[9]; - PyObject *__pyx_string_tab[92]; + PyObject *__pyx_codeobj_tab[10]; + PyObject *__pyx_string_tab[96]; PyObject *__pyx_number_tab[4]; /* #### Code section: module_state_contents ### */ /* CommonTypesMetaclass.module_state_decls */ @@ -2746,73 +2761,77 @@ static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_stati #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] -#define __pyx_n_u_datetime __pyx_string_tab[33] -#define __pyx_n_u_dopt_basics __pyx_string_tab[34] -#define __pyx_n_u_dopt_basics_datetime __pyx_string_tab[35] -#define __pyx_n_u_encode __pyx_string_tab[36] -#define __pyx_n_u_from_ptr __pyx_string_tab[37] -#define __pyx_n_u_fromtimestamp __pyx_string_tab[38] -#define __pyx_n_u_func __pyx_string_tab[39] -#define __pyx_n_u_get_block __pyx_string_tab[40] -#define __pyx_n_u_getstate __pyx_string_tab[41] -#define __pyx_n_u_hashlib __pyx_string_tab[42] -#define __pyx_n_u_idx __pyx_string_tab[43] -#define __pyx_n_u_index __pyx_string_tab[44] -#define __pyx_n_u_is_coroutine __pyx_string_tab[45] -#define __pyx_n_u_it __pyx_string_tab[46] -#define __pyx_n_u_items __pyx_string_tab[47] -#define __pyx_n_u_main __pyx_string_tab[48] -#define __pyx_n_u_module __pyx_string_tab[49] -#define __pyx_n_u_name __pyx_string_tab[50] -#define __pyx_n_u_new_block __pyx_string_tab[51] -#define __pyx_n_u_new_idx __pyx_string_tab[52] -#define __pyx_n_u_nonce __pyx_string_tab[53] -#define __pyx_n_u_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] -#define __pyx_n_u_qualname __pyx_string_tab[65] -#define __pyx_n_u_reduce __pyx_string_tab[66] -#define __pyx_n_u_reduce_cython __pyx_string_tab[67] -#define __pyx_n_u_reduce_ex __pyx_string_tab[68] -#define __pyx_n_u_repr __pyx_string_tab[69] -#define __pyx_n_u_self __pyx_string_tab[70] -#define __pyx_n_u_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_n_u_PyBlock_perform_hash __pyx_string_tab[25] +#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[26] +#define __pyx_n_u_TIMEZONE_UTC __pyx_string_tab[27] +#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[28] +#define __pyx_n_u_block __pyx_string_tab[29] +#define __pyx_n_u_bytes_serialize __pyx_string_tab[30] +#define __pyx_n_u_cline_in_traceback __pyx_string_tab[31] +#define __pyx_n_u_create_genesis_block __pyx_string_tab[32] +#define __pyx_n_u_data __pyx_string_tab[33] +#define __pyx_n_u_datetime __pyx_string_tab[34] +#define __pyx_n_u_dopt_basics __pyx_string_tab[35] +#define __pyx_n_u_dopt_basics_datetime __pyx_string_tab[36] +#define __pyx_n_u_encode __pyx_string_tab[37] +#define __pyx_n_u_from_ptr __pyx_string_tab[38] +#define __pyx_n_u_fromtimestamp __pyx_string_tab[39] +#define __pyx_n_u_func __pyx_string_tab[40] +#define __pyx_n_u_get_block __pyx_string_tab[41] +#define __pyx_n_u_getstate __pyx_string_tab[42] +#define __pyx_n_u_hash __pyx_string_tab[43] +#define __pyx_n_u_hashlib __pyx_string_tab[44] +#define __pyx_n_u_hex __pyx_string_tab[45] +#define __pyx_n_u_idx __pyx_string_tab[46] +#define __pyx_n_u_index __pyx_string_tab[47] +#define __pyx_n_u_is_coroutine __pyx_string_tab[48] +#define __pyx_n_u_it __pyx_string_tab[49] +#define __pyx_n_u_items __pyx_string_tab[50] +#define __pyx_n_u_main __pyx_string_tab[51] +#define __pyx_n_u_module __pyx_string_tab[52] +#define __pyx_n_u_name __pyx_string_tab[53] +#define __pyx_n_u_new_block __pyx_string_tab[54] +#define __pyx_n_u_new_idx __pyx_string_tab[55] +#define __pyx_n_u_nonce __pyx_string_tab[56] +#define __pyx_n_u_perform_hash __pyx_string_tab[57] +#define __pyx_n_u_polluck_blockchain_placeholder_n __pyx_string_tab[58] +#define __pyx_n_u_pop __pyx_string_tab[59] +#define __pyx_n_u_prev_block __pyx_string_tab[60] +#define __pyx_n_u_prev_hash __pyx_string_tab[61] +#define __pyx_n_u_previous_hash __pyx_string_tab[62] +#define __pyx_n_u_print __pyx_string_tab[63] +#define __pyx_n_u_print_key_value_pair __pyx_string_tab[64] +#define __pyx_n_u_py_block __pyx_string_tab[65] +#define __pyx_n_u_pyx_state __pyx_string_tab[66] +#define __pyx_n_u_pyx_vtable __pyx_string_tab[67] +#define __pyx_n_u_qualname __pyx_string_tab[68] +#define __pyx_n_u_reduce __pyx_string_tab[69] +#define __pyx_n_u_reduce_cython __pyx_string_tab[70] +#define __pyx_n_u_reduce_ex __pyx_string_tab[71] +#define __pyx_n_u_repr __pyx_string_tab[72] +#define __pyx_n_u_self __pyx_string_tab[73] +#define __pyx_n_u_serialize_res __pyx_string_tab[74] +#define __pyx_n_u_serialize_size __pyx_string_tab[75] +#define __pyx_n_u_set_name __pyx_string_tab[76] +#define __pyx_n_u_setdefault __pyx_string_tab[77] +#define __pyx_n_u_setstate __pyx_string_tab[78] +#define __pyx_n_u_setstate_cython __pyx_string_tab[79] +#define __pyx_n_u_struct __pyx_string_tab[80] +#define __pyx_n_u_test __pyx_string_tab[81] +#define __pyx_n_u_time __pyx_string_tab[82] +#define __pyx_n_u_timestamp __pyx_string_tab[83] +#define __pyx_n_u_values __pyx_string_tab[84] +#define __pyx_kp_b_ __pyx_string_tab[85] +#define __pyx_kp_b_0 __pyx_string_tab[86] +#define __pyx_kp_b_Genesis_Block __pyx_string_tab[87] +#define __pyx_kp_b_dummy_hash __pyx_string_tab[88] +#define __pyx_kp_b_iso88591_A_4r_3d_D_AQ_D_AQ_iq_Q __pyx_string_tab[89] +#define __pyx_kp_b_iso88591_A_4t1_aq_a_HBa_IQ_q_Ct3b_q_gQa_J __pyx_string_tab[90] +#define __pyx_kp_b_iso88591_A_D_2_1A __pyx_string_tab[91] +#define __pyx_kp_b_iso88591_A_IQ_q_Ct3b_7_1_waq_gQa_X_Jaq_Q __pyx_string_tab[92] +#define __pyx_kp_b_iso88591_A_T_a_c_D_t1_c_L_1_iq __pyx_string_tab[93] +#define __pyx_kp_b_iso88591_A_T_xuAV2_b_q_t1 __pyx_string_tab[94] +#define __pyx_kp_b_iso88591_Q __pyx_string_tab[95] #define __pyx_int_0 __pyx_number_tab[0] #define __pyx_int_1 __pyx_number_tab[1] #define __pyx_int_12 __pyx_number_tab[2] @@ -2836,8 +2855,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<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<10; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<96; ++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 */ @@ -2866,8 +2885,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<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<10; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<96; ++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 */ @@ -3263,7 +3282,7 @@ static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_6libcpp_6s return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":28 +/* "polluck_blockchain/placeholder_native.pyx":29 * ctypedef unordered_map[uint64_t, Block*] BcHashmap * * cdef timestamp_to_datetime(uint64_t ts): # <<<<<<<<<<<<<< @@ -3286,7 +3305,7 @@ static PyObject *__pyx_f_18polluck_blockchain_18placeholder_native_timestamp_to_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("timestamp_to_datetime", 0); - /* "polluck_blockchain/placeholder_native.pyx":29 + /* "polluck_blockchain/placeholder_native.pyx":30 * * cdef timestamp_to_datetime(uint64_t ts): * return datetime.datetime.fromtimestamp(float(ts), dopt_basics.datetime.TIMEZONE_UTC) # <<<<<<<<<<<<<< @@ -3294,21 +3313,21 @@ static PyObject *__pyx_f_18polluck_blockchain_18placeholder_native_timestamp_to_ * */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 29, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_datetime); 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_datetime); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 29, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_datetime); 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_2 = __pyx_t_4; __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(((double)__pyx_v_ts)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 29, __pyx_L1_error) + __pyx_t_3 = PyFloat_FromDouble(((double)__pyx_v_ts)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __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, 29, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_dopt_basics); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 30, __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, 29, __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, 30, __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, 29, __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, 30, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_7 = 0; @@ -3319,14 +3338,14 @@ static PyObject *__pyx_f_18polluck_blockchain_18placeholder_native_timestamp_to_ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "polluck_blockchain/placeholder_native.pyx":28 + /* "polluck_blockchain/placeholder_native.pyx":29 * ctypedef unordered_map[uint64_t, Block*] BcHashmap * * cdef timestamp_to_datetime(uint64_t ts): # <<<<<<<<<<<<<< @@ -3350,7 +3369,7 @@ static PyObject *__pyx_f_18polluck_blockchain_18placeholder_native_timestamp_to_ return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":35 +/* "polluck_blockchain/placeholder_native.pyx":36 * # return struct.pack(">d", num) * * cdef int serialize_uint32(unsigned char* out, unsigned int v) except -1 nogil: # <<<<<<<<<<<<<< @@ -3361,7 +3380,7 @@ static PyObject *__pyx_f_18polluck_blockchain_18placeholder_native_timestamp_to_ 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":36 + /* "polluck_blockchain/placeholder_native.pyx":37 * * cdef int serialize_uint32(unsigned char* out, unsigned int v) except -1 nogil: * out[0] = (v >> 24) & 0xFF # <<<<<<<<<<<<<< @@ -3370,7 +3389,7 @@ static int __pyx_f_18polluck_blockchain_18placeholder_native_serialize_uint32(un */ (__pyx_v_out[0]) = ((__pyx_v_v >> 24) & 0xFF); - /* "polluck_blockchain/placeholder_native.pyx":37 + /* "polluck_blockchain/placeholder_native.pyx":38 * cdef int serialize_uint32(unsigned char* out, unsigned int v) except -1 nogil: * out[0] = (v >> 24) & 0xFF * out[1] = (v >> 16) & 0xFF # <<<<<<<<<<<<<< @@ -3379,7 +3398,7 @@ static int __pyx_f_18polluck_blockchain_18placeholder_native_serialize_uint32(un */ (__pyx_v_out[1]) = ((__pyx_v_v >> 16) & 0xFF); - /* "polluck_blockchain/placeholder_native.pyx":38 + /* "polluck_blockchain/placeholder_native.pyx":39 * out[0] = (v >> 24) & 0xFF * out[1] = (v >> 16) & 0xFF * out[2] = (v >> 8) & 0xFF # <<<<<<<<<<<<<< @@ -3388,7 +3407,7 @@ static int __pyx_f_18polluck_blockchain_18placeholder_native_serialize_uint32(un */ (__pyx_v_out[2]) = ((__pyx_v_v >> 8) & 0xFF); - /* "polluck_blockchain/placeholder_native.pyx":39 + /* "polluck_blockchain/placeholder_native.pyx":40 * out[1] = (v >> 16) & 0xFF * out[2] = (v >> 8) & 0xFF * out[3] = v & 0xFF # <<<<<<<<<<<<<< @@ -3397,7 +3416,7 @@ static int __pyx_f_18polluck_blockchain_18placeholder_native_serialize_uint32(un */ (__pyx_v_out[3]) = (__pyx_v_v & 0xFF); - /* "polluck_blockchain/placeholder_native.pyx":35 + /* "polluck_blockchain/placeholder_native.pyx":36 * # return struct.pack(">d", num) * * cdef int serialize_uint32(unsigned char* out, unsigned int v) except -1 nogil: # <<<<<<<<<<<<<< @@ -3410,7 +3429,7 @@ static int __pyx_f_18polluck_blockchain_18placeholder_native_serialize_uint32(un return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":41 +/* "polluck_blockchain/placeholder_native.pyx":42 * out[3] = v & 0xFF * * cdef int serialize_uint64(unsigned char* out, unsigned long long v) except -1 nogil: # <<<<<<<<<<<<<< @@ -3421,7 +3440,7 @@ static int __pyx_f_18polluck_blockchain_18placeholder_native_serialize_uint32(un 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 + /* "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 # <<<<<<<<<<<<<< @@ -3430,7 +3449,7 @@ static int __pyx_f_18polluck_blockchain_18placeholder_native_serialize_uint64(un */ (__pyx_v_out[0]) = ((__pyx_v_v >> 56) & 0xFF); - /* "polluck_blockchain/placeholder_native.pyx":43 + /* "polluck_blockchain/placeholder_native.pyx":44 * cdef int serialize_uint64(unsigned char* out, unsigned long long v) except -1 nogil: * out[0] = (v >> 56) & 0xFF * out[1] = (v >> 48) & 0xFF # <<<<<<<<<<<<<< @@ -3439,7 +3458,7 @@ static int __pyx_f_18polluck_blockchain_18placeholder_native_serialize_uint64(un */ (__pyx_v_out[1]) = ((__pyx_v_v >> 48) & 0xFF); - /* "polluck_blockchain/placeholder_native.pyx":44 + /* "polluck_blockchain/placeholder_native.pyx":45 * out[0] = (v >> 56) & 0xFF * out[1] = (v >> 48) & 0xFF * out[2] = (v >> 40) & 0xFF # <<<<<<<<<<<<<< @@ -3448,7 +3467,7 @@ static int __pyx_f_18polluck_blockchain_18placeholder_native_serialize_uint64(un */ (__pyx_v_out[2]) = ((__pyx_v_v >> 40) & 0xFF); - /* "polluck_blockchain/placeholder_native.pyx":45 + /* "polluck_blockchain/placeholder_native.pyx":46 * out[1] = (v >> 48) & 0xFF * out[2] = (v >> 40) & 0xFF * out[3] = (v >> 32) & 0xFF # <<<<<<<<<<<<<< @@ -3457,7 +3476,7 @@ static int __pyx_f_18polluck_blockchain_18placeholder_native_serialize_uint64(un */ (__pyx_v_out[3]) = ((__pyx_v_v >> 32) & 0xFF); - /* "polluck_blockchain/placeholder_native.pyx":46 + /* "polluck_blockchain/placeholder_native.pyx":47 * out[2] = (v >> 40) & 0xFF * out[3] = (v >> 32) & 0xFF * out[4] = (v >> 24) & 0xFF # <<<<<<<<<<<<<< @@ -3466,7 +3485,7 @@ static int __pyx_f_18polluck_blockchain_18placeholder_native_serialize_uint64(un */ (__pyx_v_out[4]) = ((__pyx_v_v >> 24) & 0xFF); - /* "polluck_blockchain/placeholder_native.pyx":47 + /* "polluck_blockchain/placeholder_native.pyx":48 * out[3] = (v >> 32) & 0xFF * out[4] = (v >> 24) & 0xFF * out[5] = (v >> 16) & 0xFF # <<<<<<<<<<<<<< @@ -3475,7 +3494,7 @@ static int __pyx_f_18polluck_blockchain_18placeholder_native_serialize_uint64(un */ (__pyx_v_out[5]) = ((__pyx_v_v >> 16) & 0xFF); - /* "polluck_blockchain/placeholder_native.pyx":48 + /* "polluck_blockchain/placeholder_native.pyx":49 * out[4] = (v >> 24) & 0xFF * out[5] = (v >> 16) & 0xFF * out[6] = (v >> 8) & 0xFF # <<<<<<<<<<<<<< @@ -3484,16 +3503,16 @@ static int __pyx_f_18polluck_blockchain_18placeholder_native_serialize_uint64(un */ (__pyx_v_out[6]) = ((__pyx_v_v >> 8) & 0xFF); - /* "polluck_blockchain/placeholder_native.pyx":49 + /* "polluck_blockchain/placeholder_native.pyx":50 * out[5] = (v >> 16) & 0xFF * out[6] = (v >> 8) & 0xFF * out[7] = v & 0xFF # <<<<<<<<<<<<<< * - * cdef struct SerializeResult: + * # cdef struct SerializeResult: */ (__pyx_v_out[7]) = (__pyx_v_v & 0xFF); - /* "polluck_blockchain/placeholder_native.pyx":41 + /* "polluck_blockchain/placeholder_native.pyx":42 * out[3] = v & 0xFF * * cdef int serialize_uint64(unsigned char* out, unsigned long long v) except -1 nogil: # <<<<<<<<<<<<<< @@ -3506,7 +3525,7 @@ static int __pyx_f_18polluck_blockchain_18placeholder_native_serialize_uint64(un return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":66 +/* "polluck_blockchain/placeholder_native.pyx":71 * bint ptr_owner * * def __cinit__(self, # <<<<<<<<<<<<<< @@ -3540,36 +3559,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, 66, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 71, __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, 66, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 71, __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, 66, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 71, __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, 66, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 71, __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, 66, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 71, __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, 66, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 71, __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, 66, __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, 71, __pyx_L3_error) - /* "polluck_blockchain/placeholder_native.pyx":71 + /* "polluck_blockchain/placeholder_native.pyx":76 * data, * previous_hash, * from_ptr=False, # <<<<<<<<<<<<<< @@ -3578,23 +3597,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, 66, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, i); __PYX_ERR(0, 71, __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, 66, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 71, __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, 66, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 71, __pyx_L3_error) values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 66, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 71, __pyx_L3_error) values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 66, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 71, __pyx_L3_error) values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); - if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 66, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 71, __pyx_L3_error) break; default: goto __pyx_L5_argtuple_error; } @@ -3608,7 +3627,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, 66, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, __pyx_nargs); __PYX_ERR(0, 71, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3621,7 +3640,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":66 + /* "polluck_blockchain/placeholder_native.pyx":71 * bint ptr_owner * * def __cinit__(self, # <<<<<<<<<<<<<< @@ -3659,7 +3678,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock___cinit__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "polluck_blockchain/placeholder_native.pyx":73 + /* "polluck_blockchain/placeholder_native.pyx":78 * from_ptr=False, * ): * self.ptr_owner = False # <<<<<<<<<<<<<< @@ -3668,39 +3687,39 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock___cinit__ */ __pyx_v_self->ptr_owner = 0; - /* "polluck_blockchain/placeholder_native.pyx":74 + /* "polluck_blockchain/placeholder_native.pyx":79 * ): * 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, 74, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_from_ptr); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 79, __pyx_L1_error) __pyx_t_2 = (!__pyx_t_1); if (__pyx_t_2) { - /* "polluck_blockchain/placeholder_native.pyx":76 + /* "polluck_blockchain/placeholder_native.pyx":81 * if not from_ptr: * self.BlockC = new Block( * index, # <<<<<<<<<<<<<< * 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, 76, __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, 81, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":77 + /* "polluck_blockchain/placeholder_native.pyx":82 * self.BlockC = new Block( * index, * 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, 77, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 82, __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, 77, __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, 82, __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, 77, __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, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_5 = __pyx_t_6; @@ -3711,25 +3730,25 @@ 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, 77, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } - __pyx_t_6 = __Pyx_PyNumber_Int(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 77, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyNumber_Int(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 82, __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_t_9 = __Pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "polluck_blockchain/placeholder_native.pyx":78 + /* "polluck_blockchain/placeholder_native.pyx":83 * index, * 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, 78, __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, 83, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":79 + /* "polluck_blockchain/placeholder_native.pyx":84 * int(datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp()), * nonce, * data.encode("UTF-8"), # <<<<<<<<<<<<<< @@ -3743,13 +3762,13 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock___cinit__ 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) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); } - __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_t_11 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_6); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "polluck_blockchain/placeholder_native.pyx":80 + /* "polluck_blockchain/placeholder_native.pyx":85 * nonce, * data.encode("UTF-8"), * previous_hash.encode("UTF-8"), # <<<<<<<<<<<<<< @@ -3763,22 +3782,22 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock___cinit__ 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) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); } - __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_t_12 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_6); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "polluck_blockchain/placeholder_native.pyx":81 + /* "polluck_blockchain/placeholder_native.pyx":86 * 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, 81, __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, 86, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":75 + /* "polluck_blockchain/placeholder_native.pyx":80 * self.ptr_owner = False * if not from_ptr: * self.BlockC = new Block( # <<<<<<<<<<<<<< @@ -3789,11 +3808,11 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock___cinit__ __pyx_t_14 = new ::Block(__pyx_t_3, __pyx_t_9, __pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 75, __pyx_L1_error) + __PYX_ERR(0, 80, __pyx_L1_error) } __pyx_v_self->BlockC = __pyx_t_14; - /* "polluck_blockchain/placeholder_native.pyx":83 + /* "polluck_blockchain/placeholder_native.pyx":88 * "".encode("UTF-8"), * ) * if self.BlockC == NULL: # <<<<<<<<<<<<<< @@ -3803,16 +3822,16 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock___cinit__ __pyx_t_2 = (__pyx_v_self->BlockC == NULL); if (unlikely(__pyx_t_2)) { - /* "polluck_blockchain/placeholder_native.pyx":84 + /* "polluck_blockchain/placeholder_native.pyx":89 * ) * if self.BlockC == NULL: * raise MemoryError() # <<<<<<<<<<<<<< * * self.ptr_owner = True */ - PyErr_NoMemory(); __PYX_ERR(0, 84, __pyx_L1_error) + PyErr_NoMemory(); __PYX_ERR(0, 89, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":83 + /* "polluck_blockchain/placeholder_native.pyx":88 * "".encode("UTF-8"), * ) * if self.BlockC == NULL: # <<<<<<<<<<<<<< @@ -3821,7 +3840,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock___cinit__ */ } - /* "polluck_blockchain/placeholder_native.pyx":86 + /* "polluck_blockchain/placeholder_native.pyx":91 * raise MemoryError() * * self.ptr_owner = True # <<<<<<<<<<<<<< @@ -3830,7 +3849,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock___cinit__ */ __pyx_v_self->ptr_owner = 1; - /* "polluck_blockchain/placeholder_native.pyx":74 + /* "polluck_blockchain/placeholder_native.pyx":79 * ): * self.ptr_owner = False * if not from_ptr: # <<<<<<<<<<<<<< @@ -3839,7 +3858,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock___cinit__ */ } - /* "polluck_blockchain/placeholder_native.pyx":66 + /* "polluck_blockchain/placeholder_native.pyx":71 * bint ptr_owner * * def __cinit__(self, # <<<<<<<<<<<<<< @@ -3862,7 +3881,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock___cinit__ return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":88 +/* "polluck_blockchain/placeholder_native.pyx":93 * self.ptr_owner = True * * def __init__(self, *args, **kwargs): # <<<<<<<<<<<<<< @@ -3910,7 +3929,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_2__init__ return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":91 +/* "polluck_blockchain/placeholder_native.pyx":96 * pass * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -3935,7 +3954,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":92 + /* "polluck_blockchain/placeholder_native.pyx":97 * * def __dealloc__(self): * if self.BlockC is not NULL and self.ptr_owner is True: # <<<<<<<<<<<<<< @@ -3953,7 +3972,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":93 + /* "polluck_blockchain/placeholder_native.pyx":98 * def __dealloc__(self): * if self.BlockC is not NULL and self.ptr_owner is True: * del self.BlockC # <<<<<<<<<<<<<< @@ -3962,7 +3981,7 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4__deall */ delete __pyx_v_self->BlockC; - /* "polluck_blockchain/placeholder_native.pyx":94 + /* "polluck_blockchain/placeholder_native.pyx":99 * if self.BlockC is not NULL and self.ptr_owner is True: * del self.BlockC * self.BlockC = NULL # <<<<<<<<<<<<<< @@ -3971,7 +3990,7 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4__deall */ __pyx_v_self->BlockC = NULL; - /* "polluck_blockchain/placeholder_native.pyx":92 + /* "polluck_blockchain/placeholder_native.pyx":97 * * def __dealloc__(self): * if self.BlockC is not NULL and self.ptr_owner is True: # <<<<<<<<<<<<<< @@ -3980,7 +3999,7 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4__deall */ } - /* "polluck_blockchain/placeholder_native.pyx":91 + /* "polluck_blockchain/placeholder_native.pyx":96 * pass * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -3991,7 +4010,7 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4__deall /* function exit code */ } -/* "polluck_blockchain/placeholder_native.pyx":96 +/* "polluck_blockchain/placeholder_native.pyx":101 * self.BlockC = NULL * * @staticmethod # <<<<<<<<<<<<<< @@ -4001,7 +4020,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":97 + /* "polluck_blockchain/placeholder_native.pyx":102 * * @staticmethod * cdef PyBlock from_ptr(Block *block, bint owner=False): # <<<<<<<<<<<<<< @@ -4027,77 +4046,77 @@ static struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx } } - /* "polluck_blockchain/placeholder_native.pyx":100 + /* "polluck_blockchain/placeholder_native.pyx":105 * 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, 100, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_block->index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 105, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - /* "polluck_blockchain/placeholder_native.pyx":101 + /* "polluck_blockchain/placeholder_native.pyx":106 * 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, 101, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyLong_From_uint64_t(__pyx_v_block->nonce); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - /* "polluck_blockchain/placeholder_native.pyx":102 + /* "polluck_blockchain/placeholder_native.pyx":107 * 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, 102, __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, 107, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - /* "polluck_blockchain/placeholder_native.pyx":103 + /* "polluck_blockchain/placeholder_native.pyx":108 * 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, 103, __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, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - /* "polluck_blockchain/placeholder_native.pyx":98 + /* "polluck_blockchain/placeholder_native.pyx":103 * @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, 98, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 103, __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, 98, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 103, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_2); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 98, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 103, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_3); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 98, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 103, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_4); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4) != (0)) __PYX_ERR(0, 98, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4) != (0)) __PYX_ERR(0, 103, __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, 98, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 4, Py_True) != (0)) __PYX_ERR(0, 103, __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, 98, __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, 103, __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":106 + /* "polluck_blockchain/placeholder_native.pyx":111 * True, * ) * py_block.BlockC = block # <<<<<<<<<<<<<< @@ -4106,7 +4125,7 @@ static struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx */ __pyx_v_py_block->BlockC = __pyx_v_block; - /* "polluck_blockchain/placeholder_native.pyx":107 + /* "polluck_blockchain/placeholder_native.pyx":112 * ) * py_block.BlockC = block * py_block.ptr_owner = owner # <<<<<<<<<<<<<< @@ -4115,7 +4134,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":109 + /* "polluck_blockchain/placeholder_native.pyx":114 * py_block.ptr_owner = owner * * return py_block # <<<<<<<<<<<<<< @@ -4127,7 +4146,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":96 + /* "polluck_blockchain/placeholder_native.pyx":101 * self.BlockC = NULL * * @staticmethod # <<<<<<<<<<<<<< @@ -4151,7 +4170,7 @@ static struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":111 +/* "polluck_blockchain/placeholder_native.pyx":116 * return py_block * * def __repr__(self): # <<<<<<<<<<<<<< @@ -4188,7 +4207,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_6__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__repr__", 0); - /* "polluck_blockchain/placeholder_native.pyx":112 + /* "polluck_blockchain/placeholder_native.pyx":117 * * def __repr__(self): * return f"PyBlock({self.index, self.timestamp, self.nonce, self.data})" # <<<<<<<<<<<<<< @@ -4196,43 +4215,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, 112, __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, 117, __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, 112, __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, 117, __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, 112, __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, 117, __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, 112, __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, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 112, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 117, __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, 112, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 117, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_2); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 112, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 117, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_3); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 112, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 117, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_4); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4) != (0)) __PYX_ERR(0, 112, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4) != (0)) __PYX_ERR(0, 117, __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, 112, __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, 117, __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, 112, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 117, __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":111 + /* "polluck_blockchain/placeholder_native.pyx":116 * return py_block * * def __repr__(self): # <<<<<<<<<<<<<< @@ -4255,7 +4274,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_6__ return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":114 +/* "polluck_blockchain/placeholder_native.pyx":119 * return f"PyBlock({self.index, self.timestamp, self.nonce, self.data})" * * def __str__(self): # <<<<<<<<<<<<<< @@ -4289,7 +4308,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_8__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "polluck_blockchain/placeholder_native.pyx":115 + /* "polluck_blockchain/placeholder_native.pyx":120 * * def __str__(self): * return self.__repr__() # <<<<<<<<<<<<<< @@ -4304,14 +4323,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, 115, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __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":114 + /* "polluck_blockchain/placeholder_native.pyx":119 * return f"PyBlock({self.index, self.timestamp, self.nonce, self.data})" * * def __str__(self): # <<<<<<<<<<<<<< @@ -4331,7 +4350,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_8__ return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":134 +/* "polluck_blockchain/placeholder_native.pyx":139 * * # Python public API * @property # <<<<<<<<<<<<<< @@ -4363,7 +4382,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_5in int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "polluck_blockchain/placeholder_native.pyx":136 + /* "polluck_blockchain/placeholder_native.pyx":141 * @property * def index(self): * return self.BlockC.index # <<<<<<<<<<<<<< @@ -4371,13 +4390,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, 136, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->BlockC->index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __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":134 + /* "polluck_blockchain/placeholder_native.pyx":139 * * # Python public API * @property # <<<<<<<<<<<<<< @@ -4396,7 +4415,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_5in return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":138 +/* "polluck_blockchain/placeholder_native.pyx":143 * return self.BlockC.index * * @property # <<<<<<<<<<<<<< @@ -4428,7 +4447,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_9ti int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "polluck_blockchain/placeholder_native.pyx":140 + /* "polluck_blockchain/placeholder_native.pyx":145 * @property * def timestamp(self): * return timestamp_to_datetime(self.BlockC.timestamp) # <<<<<<<<<<<<<< @@ -4436,13 +4455,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, 140, __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, 145, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "polluck_blockchain/placeholder_native.pyx":138 + /* "polluck_blockchain/placeholder_native.pyx":143 * return self.BlockC.index * * @property # <<<<<<<<<<<<<< @@ -4461,7 +4480,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_9ti return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":142 +/* "polluck_blockchain/placeholder_native.pyx":147 * return timestamp_to_datetime(self.BlockC.timestamp) * * @property # <<<<<<<<<<<<<< @@ -4493,7 +4512,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4da int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "polluck_blockchain/placeholder_native.pyx":144 + /* "polluck_blockchain/placeholder_native.pyx":149 * @property * def data(self): * return self.BlockC.data.decode("UTF-8") # <<<<<<<<<<<<<< @@ -4501,13 +4520,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, 144, __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, 149, __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":142 + /* "polluck_blockchain/placeholder_native.pyx":147 * return timestamp_to_datetime(self.BlockC.timestamp) * * @property # <<<<<<<<<<<<<< @@ -4526,7 +4545,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4da return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":146 +/* "polluck_blockchain/placeholder_native.pyx":151 * return self.BlockC.data.decode("UTF-8") * * @property # <<<<<<<<<<<<<< @@ -4558,7 +4577,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_9pr int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "polluck_blockchain/placeholder_native.pyx":148 + /* "polluck_blockchain/placeholder_native.pyx":153 * @property * def prev_hash(self): * return self.BlockC.prev_hash.decode("UTF-8") # <<<<<<<<<<<<<< @@ -4566,13 +4585,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, 148, __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, 153, __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":146 + /* "polluck_blockchain/placeholder_native.pyx":151 * return self.BlockC.data.decode("UTF-8") * * @property # <<<<<<<<<<<<<< @@ -4591,7 +4610,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_9pr return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":150 +/* "polluck_blockchain/placeholder_native.pyx":155 * return self.BlockC.prev_hash.decode("UTF-8") * * @property # <<<<<<<<<<<<<< @@ -4623,7 +4642,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_5no int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "polluck_blockchain/placeholder_native.pyx":152 + /* "polluck_blockchain/placeholder_native.pyx":157 * @property * def nonce(self): * return self.BlockC.nonce # <<<<<<<<<<<<<< @@ -4631,13 +4650,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, 152, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->BlockC->nonce); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __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":150 + /* "polluck_blockchain/placeholder_native.pyx":155 * return self.BlockC.prev_hash.decode("UTF-8") * * @property # <<<<<<<<<<<<<< @@ -4656,7 +4675,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_5no return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":158 +/* "polluck_blockchain/placeholder_native.pyx":163 * # self._nonce = value * * @property # <<<<<<<<<<<<<< @@ -4688,21 +4707,21 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4ha int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "polluck_blockchain/placeholder_native.pyx":160 + /* "polluck_blockchain/placeholder_native.pyx":165 * @property * def hash(self): * return self.BlockC.hash.decode("UTF-8") # <<<<<<<<<<<<<< * - * cdef SerializeResult bytes_serialize_c(self): + * cdef unsigned char* bytes_serialize_c(self, size_t *size): */ __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, 160, __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, 165, __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":158 + /* "polluck_blockchain/placeholder_native.pyx":163 * # self._nonce = value * * @property # <<<<<<<<<<<<<< @@ -4721,55 +4740,53 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_4ha return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":162 +/* "polluck_blockchain/placeholder_native.pyx":167 * return self.BlockC.hash.decode("UTF-8") * - * cdef SerializeResult bytes_serialize_c(self): # <<<<<<<<<<<<<< + * cdef unsigned char* bytes_serialize_c(self, size_t *size): # <<<<<<<<<<<<<< * 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; +static unsigned char *__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_size) { unsigned char *__pyx_v_buf; size_t __pyx_v_pos; - struct __pyx_t_18polluck_blockchain_18placeholder_native_SerializeResult __pyx_r; + unsigned char *__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 + /* "polluck_blockchain/placeholder_native.pyx":171 * size_t total_len * unsigned char* buf * size_t pos = 0 # <<<<<<<<<<<<<< * - * # test: prev_hash + size of index (64bit) + * # index (8), timestamp (8), nonce (8), data, prev_hash */ __pyx_v_pos = 0; - /* "polluck_blockchain/placeholder_native.pyx":172 - * total_len = ( + /* "polluck_blockchain/placeholder_native.pyx":174 + * + * # index (8), timestamp (8), nonce (8), data, prev_hash + * size[0] = ( # <<<<<<<<<<<<<< * (8 * 3) + - * self.BlockC.data.size() + # <<<<<<<<<<<<<< - * self.BlockC.prev_hash.size() - * ) + * self.BlockC.data.size() + */ - __pyx_v_total_len = ((((size_t)0x18) + __pyx_v_self->BlockC->data.size()) + __pyx_v_self->BlockC->prev_hash.size()); + (__pyx_v_size[0]) = ((((size_t)0x18) + __pyx_v_self->BlockC->data.size()) + __pyx_v_self->BlockC->prev_hash.size()); - /* "polluck_blockchain/placeholder_native.pyx":175 + /* "polluck_blockchain/placeholder_native.pyx":179 * self.BlockC.prev_hash.size() * ) - * buf = malloc(total_len * sizeof(unsigned char)) # <<<<<<<<<<<<<< + * buf = malloc(size[0] * sizeof(unsigned char)) # <<<<<<<<<<<<<< * * if buf == NULL: */ - __pyx_v_buf = ((unsigned char *)malloc((__pyx_v_total_len * (sizeof(unsigned char))))); + __pyx_v_buf = ((unsigned char *)malloc(((__pyx_v_size[0]) * (sizeof(unsigned char))))); - /* "polluck_blockchain/placeholder_native.pyx":177 - * buf = malloc(total_len * sizeof(unsigned char)) + /* "polluck_blockchain/placeholder_native.pyx":181 + * buf = malloc(size[0] * sizeof(unsigned char)) * * if buf == NULL: # <<<<<<<<<<<<<< * raise MemoryError() @@ -4778,17 +4795,17 @@ static struct __pyx_t_18polluck_blockchain_18placeholder_native_SerializeResult __pyx_t_1 = (__pyx_v_buf == NULL); if (unlikely(__pyx_t_1)) { - /* "polluck_blockchain/placeholder_native.pyx":178 + /* "polluck_blockchain/placeholder_native.pyx":182 * * if buf == NULL: * raise MemoryError() # <<<<<<<<<<<<<< * * serialize_uint64(buf + pos, self.BlockC.index) */ - PyErr_NoMemory(); __PYX_ERR(0, 178, __pyx_L1_error) + PyErr_NoMemory(); __PYX_ERR(0, 182, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":177 - * buf = malloc(total_len * sizeof(unsigned char)) + /* "polluck_blockchain/placeholder_native.pyx":181 + * buf = malloc(size[0] * sizeof(unsigned char)) * * if buf == NULL: # <<<<<<<<<<<<<< * raise MemoryError() @@ -4796,16 +4813,16 @@ static struct __pyx_t_18polluck_blockchain_18placeholder_native_SerializeResult */ } - /* "polluck_blockchain/placeholder_native.pyx":180 + /* "polluck_blockchain/placeholder_native.pyx":184 * 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) + __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, 184, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":181 + /* "polluck_blockchain/placeholder_native.pyx":185 * * serialize_uint64(buf + pos, self.BlockC.index) * pos += 8 # <<<<<<<<<<<<<< @@ -4814,16 +4831,16 @@ static struct __pyx_t_18polluck_blockchain_18placeholder_native_SerializeResult */ __pyx_v_pos = (__pyx_v_pos + 8); - /* "polluck_blockchain/placeholder_native.pyx":182 + /* "polluck_blockchain/placeholder_native.pyx":186 * 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) + __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, 186, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":183 + /* "polluck_blockchain/placeholder_native.pyx":187 * pos += 8 * serialize_uint64(buf + pos, self.BlockC.timestamp) * pos += 8 # <<<<<<<<<<<<<< @@ -4832,16 +4849,16 @@ static struct __pyx_t_18polluck_blockchain_18placeholder_native_SerializeResult */ __pyx_v_pos = (__pyx_v_pos + 8); - /* "polluck_blockchain/placeholder_native.pyx":184 + /* "polluck_blockchain/placeholder_native.pyx":188 * 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) + __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, 188, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":185 + /* "polluck_blockchain/placeholder_native.pyx":189 * pos += 8 * serialize_uint64(buf + pos, self.BlockC.nonce) * pos += 8 # <<<<<<<<<<<<<< @@ -4850,7 +4867,7 @@ static struct __pyx_t_18polluck_blockchain_18placeholder_native_SerializeResult */ __pyx_v_pos = (__pyx_v_pos + 8); - /* "polluck_blockchain/placeholder_native.pyx":187 + /* "polluck_blockchain/placeholder_native.pyx":191 * pos += 8 * # Copy data * memcpy( # <<<<<<<<<<<<<< @@ -4859,7 +4876,7 @@ static struct __pyx_t_18polluck_blockchain_18placeholder_native_SerializeResult */ (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 + /* "polluck_blockchain/placeholder_native.pyx":196 * self.BlockC.data.size(), * ) * pos += self.BlockC.data.size() # <<<<<<<<<<<<<< @@ -4868,7 +4885,7 @@ static struct __pyx_t_18polluck_blockchain_18placeholder_native_SerializeResult */ __pyx_v_pos = (__pyx_v_pos + __pyx_v_self->BlockC->data.size()); - /* "polluck_blockchain/placeholder_native.pyx":194 + /* "polluck_blockchain/placeholder_native.pyx":198 * pos += self.BlockC.data.size() * # Copy prev_hash * memcpy( # <<<<<<<<<<<<<< @@ -4877,31 +4894,29 @@ static struct __pyx_t_18polluck_blockchain_18placeholder_native_SerializeResult */ (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 + /* "polluck_blockchain/placeholder_native.pyx":203 * self.BlockC.prev_hash.size(), * ) * pos += self.BlockC.prev_hash.size() # <<<<<<<<<<<<<< * - * return SerializeResult(buf, total_len) + * return buf */ __pyx_v_pos = (__pyx_v_pos + __pyx_v_self->BlockC->prev_hash.size()); - /* "polluck_blockchain/placeholder_native.pyx":201 + /* "polluck_blockchain/placeholder_native.pyx":205 * pos += self.BlockC.prev_hash.size() * - * return SerializeResult(buf, total_len) # <<<<<<<<<<<<<< + * return buf # <<<<<<<<<<<<<< * * def bytes_serialize(self): */ - __pyx_t_3.ptr = __pyx_v_buf; - __pyx_t_3.size = __pyx_v_total_len; - __pyx_r = __pyx_t_3; + __pyx_r = __pyx_v_buf; goto __pyx_L0; - /* "polluck_blockchain/placeholder_native.pyx":162 + /* "polluck_blockchain/placeholder_native.pyx":167 * return self.BlockC.hash.decode("UTF-8") * - * cdef SerializeResult bytes_serialize_c(self): # <<<<<<<<<<<<<< + * cdef unsigned char* bytes_serialize_c(self, size_t *size): # <<<<<<<<<<<<<< * cdef: * size_t total_len */ @@ -4909,17 +4924,17 @@ static struct __pyx_t_18polluck_blockchain_18placeholder_native_SerializeResult /* 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_r = 0; __pyx_L0:; return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":203 - * return SerializeResult(buf, total_len) +/* "polluck_blockchain/placeholder_native.pyx":207 + * return buf * * def bytes_serialize(self): # <<<<<<<<<<<<<< - * cdef SerializeResult serialize_res - * try: + * cdef: + * unsigned char *serialize_res */ /* Python wrapper */ @@ -4965,10 +4980,11 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } 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; + unsigned char *__pyx_v_serialize_res; + size_t __pyx_v_serialize_size; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - struct __pyx_t_18polluck_blockchain_18placeholder_native_SerializeResult __pyx_t_1; + unsigned char *__pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_t_3; int __pyx_t_4; @@ -4984,46 +5000,46 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_10b int __pyx_clineno = 0; __Pyx_RefNannySetupContext("bytes_serialize", 0); - /* "polluck_blockchain/placeholder_native.pyx":205 - * def bytes_serialize(self): - * cdef SerializeResult serialize_res + /* "polluck_blockchain/placeholder_native.pyx":211 + * unsigned char *serialize_res + * size_t serialize_size * try: # <<<<<<<<<<<<<< - * serialize_res = self.bytes_serialize_c() - * return serialize_res.ptr[:serialize_res.size] + * serialize_res = self.bytes_serialize_c(&serialize_size) + * return serialize_res[:serialize_size] */ /*try:*/ { - /* "polluck_blockchain/placeholder_native.pyx":206 - * cdef SerializeResult serialize_res + /* "polluck_blockchain/placeholder_native.pyx":212 + * size_t serialize_size * try: - * serialize_res = self.bytes_serialize_c() # <<<<<<<<<<<<<< - * return serialize_res.ptr[:serialize_res.size] + * serialize_res = self.bytes_serialize_c(&serialize_size) # <<<<<<<<<<<<<< + * return serialize_res[:serialize_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_t_1 = ((struct __pyx_vtabstruct_18polluck_blockchain_18placeholder_native_PyBlock *)__pyx_v_self->__pyx_vtab)->bytes_serialize_c(__pyx_v_self, (&__pyx_v_serialize_size)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 212, __pyx_L4_error) __pyx_v_serialize_res = __pyx_t_1; - /* "polluck_blockchain/placeholder_native.pyx":207 + /* "polluck_blockchain/placeholder_native.pyx":213 * try: - * serialize_res = self.bytes_serialize_c() - * return serialize_res.ptr[:serialize_res.size] # <<<<<<<<<<<<<< + * serialize_res = self.bytes_serialize_c(&serialize_size) + * return serialize_res[:serialize_size] # <<<<<<<<<<<<<< * finally: - * free(serialize_res.ptr) + * free(serialize_res) */ __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_t_2 = __Pyx_PyBytes_FromStringAndSize(((char const *)__pyx_v_serialize_res) + 0, __pyx_v_serialize_size - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __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] + /* "polluck_blockchain/placeholder_native.pyx":215 + * return serialize_res[:serialize_size] * finally: - * free(serialize_res.ptr) # <<<<<<<<<<<<<< - * + * free(serialize_res) # <<<<<<<<<<<<<< * + * cdef unsigned char* digest(self, unsigned char *data, size_t data_size, size_t *digest_size): */ /*finally:*/ { __pyx_L4_error:; @@ -5042,7 +5058,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_10b __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); + free(__pyx_v_serialize_res); } __Pyx_XGIVEREF(__pyx_t_9); __Pyx_XGIVEREF(__pyx_t_10); @@ -5059,19 +5075,19 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_10b __pyx_L3_return: { __pyx_t_11 = __pyx_r; __pyx_r = 0; - free(__pyx_v_serialize_res.ptr); + free(__pyx_v_serialize_res); __pyx_r = __pyx_t_11; __pyx_t_11 = 0; goto __pyx_L0; } } - /* "polluck_blockchain/placeholder_native.pyx":203 - * return SerializeResult(buf, total_len) + /* "polluck_blockchain/placeholder_native.pyx":207 + * return buf * * def bytes_serialize(self): # <<<<<<<<<<<<<< - * cdef SerializeResult serialize_res - * try: + * cdef: + * unsigned char *serialize_res */ /* function exit code */ @@ -5085,6 +5101,538 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_10b return __pyx_r; } +/* "polluck_blockchain/placeholder_native.pyx":217 + * free(serialize_res) + * + * cdef unsigned char* digest(self, unsigned char *data, size_t data_size, size_t *digest_size): # <<<<<<<<<<<<<< + * cdef ossl.EVP_MD_CTX *ctx = ossl.EVP_MD_CTX_new() + * if ctx == NULL: +*/ + +static unsigned char *__pyx_f_18polluck_blockchain_18placeholder_native_7PyBlock_digest(CYTHON_UNUSED struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self, unsigned char *__pyx_v_data, size_t __pyx_v_data_size, size_t *__pyx_v_digest_size) { + EVP_MD_CTX *__pyx_v_ctx; + EVP_MD const *__pyx_v_algo; + unsigned char *__pyx_v_digest; + size_t __pyx_v_dig_buff_len; + unsigned int __pyx_v_digest_len; + unsigned char *__pyx_r; + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "polluck_blockchain/placeholder_native.pyx":218 + * + * cdef unsigned char* digest(self, unsigned char *data, size_t data_size, size_t *digest_size): + * cdef ossl.EVP_MD_CTX *ctx = ossl.EVP_MD_CTX_new() # <<<<<<<<<<<<<< + * if ctx == NULL: + * raise MemoryError() +*/ + __pyx_v_ctx = EVP_MD_CTX_new(); + + /* "polluck_blockchain/placeholder_native.pyx":219 + * cdef unsigned char* digest(self, unsigned char *data, size_t data_size, size_t *digest_size): + * cdef ossl.EVP_MD_CTX *ctx = ossl.EVP_MD_CTX_new() + * if ctx == NULL: # <<<<<<<<<<<<<< + * raise MemoryError() + * cdef const ossl.EVP_MD *algo = ossl.EVP_sha256() +*/ + __pyx_t_1 = (__pyx_v_ctx == NULL); + if (unlikely(__pyx_t_1)) { + + /* "polluck_blockchain/placeholder_native.pyx":220 + * cdef ossl.EVP_MD_CTX *ctx = ossl.EVP_MD_CTX_new() + * if ctx == NULL: + * raise MemoryError() # <<<<<<<<<<<<<< + * cdef const ossl.EVP_MD *algo = ossl.EVP_sha256() + * +*/ + PyErr_NoMemory(); __PYX_ERR(0, 220, __pyx_L1_error) + + /* "polluck_blockchain/placeholder_native.pyx":219 + * cdef unsigned char* digest(self, unsigned char *data, size_t data_size, size_t *digest_size): + * cdef ossl.EVP_MD_CTX *ctx = ossl.EVP_MD_CTX_new() + * if ctx == NULL: # <<<<<<<<<<<<<< + * raise MemoryError() + * cdef const ossl.EVP_MD *algo = ossl.EVP_sha256() +*/ + } + + /* "polluck_blockchain/placeholder_native.pyx":221 + * if ctx == NULL: + * raise MemoryError() + * cdef const ossl.EVP_MD *algo = ossl.EVP_sha256() # <<<<<<<<<<<<<< + * + * cdef: +*/ + __pyx_v_algo = EVP_sha256(); + + /* "polluck_blockchain/placeholder_native.pyx":228 + * unsigned int digest_len + * + * dig_buff_len = ossl.EVP_MD_size(algo) # <<<<<<<<<<<<<< + * digest = malloc(dig_buff_len * sizeof(unsigned char)) + * ossl.EVP_DigestInit_ex(ctx, algo, NULL) +*/ + __pyx_v_dig_buff_len = ((size_t)EVP_MD_size(__pyx_v_algo)); + + /* "polluck_blockchain/placeholder_native.pyx":229 + * + * dig_buff_len = ossl.EVP_MD_size(algo) + * digest = malloc(dig_buff_len * sizeof(unsigned char)) # <<<<<<<<<<<<<< + * ossl.EVP_DigestInit_ex(ctx, algo, NULL) + * ossl.EVP_DigestUpdate(ctx, data, data_size) +*/ + __pyx_v_digest = ((unsigned char *)malloc((__pyx_v_dig_buff_len * (sizeof(unsigned char))))); + + /* "polluck_blockchain/placeholder_native.pyx":230 + * dig_buff_len = ossl.EVP_MD_size(algo) + * digest = malloc(dig_buff_len * sizeof(unsigned char)) + * ossl.EVP_DigestInit_ex(ctx, algo, NULL) # <<<<<<<<<<<<<< + * ossl.EVP_DigestUpdate(ctx, data, data_size) + * ossl.EVP_DigestFinal_ex(ctx, digest, &digest_len) +*/ + (void)(EVP_DigestInit_ex(__pyx_v_ctx, __pyx_v_algo, NULL)); + + /* "polluck_blockchain/placeholder_native.pyx":231 + * digest = malloc(dig_buff_len * sizeof(unsigned char)) + * ossl.EVP_DigestInit_ex(ctx, algo, NULL) + * ossl.EVP_DigestUpdate(ctx, data, data_size) # <<<<<<<<<<<<<< + * ossl.EVP_DigestFinal_ex(ctx, digest, &digest_len) + * +*/ + (void)(EVP_DigestUpdate(__pyx_v_ctx, __pyx_v_data, __pyx_v_data_size)); + + /* "polluck_blockchain/placeholder_native.pyx":232 + * ossl.EVP_DigestInit_ex(ctx, algo, NULL) + * ossl.EVP_DigestUpdate(ctx, data, data_size) + * ossl.EVP_DigestFinal_ex(ctx, digest, &digest_len) # <<<<<<<<<<<<<< + * + * digest_size[0] = dig_buff_len +*/ + (void)(EVP_DigestFinal_ex(__pyx_v_ctx, __pyx_v_digest, (&__pyx_v_digest_len))); + + /* "polluck_blockchain/placeholder_native.pyx":234 + * ossl.EVP_DigestFinal_ex(ctx, digest, &digest_len) + * + * digest_size[0] = dig_buff_len # <<<<<<<<<<<<<< + * + * ossl.EVP_MD_CTX_free(ctx) +*/ + (__pyx_v_digest_size[0]) = __pyx_v_dig_buff_len; + + /* "polluck_blockchain/placeholder_native.pyx":236 + * digest_size[0] = dig_buff_len + * + * ossl.EVP_MD_CTX_free(ctx) # <<<<<<<<<<<<<< + * + * return digest +*/ + EVP_MD_CTX_free(__pyx_v_ctx); + + /* "polluck_blockchain/placeholder_native.pyx":238 + * ossl.EVP_MD_CTX_free(ctx) + * + * return digest # <<<<<<<<<<<<<< + * + * cdef unsigned char* perform_hash_c(self, size_t *digest_size): +*/ + __pyx_r = __pyx_v_digest; + goto __pyx_L0; + + /* "polluck_blockchain/placeholder_native.pyx":217 + * free(serialize_res) + * + * cdef unsigned char* digest(self, unsigned char *data, size_t data_size, size_t *digest_size): # <<<<<<<<<<<<<< + * cdef ossl.EVP_MD_CTX *ctx = ossl.EVP_MD_CTX_new() + * if ctx == NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("polluck_blockchain.placeholder_native.PyBlock.digest", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + return __pyx_r; +} + +/* "polluck_blockchain/placeholder_native.pyx":240 + * return digest + * + * cdef unsigned char* perform_hash_c(self, size_t *digest_size): # <<<<<<<<<<<<<< + * cdef: + * unsigned char *serialize_res +*/ + +static unsigned char *__pyx_f_18polluck_blockchain_18placeholder_native_7PyBlock_perform_hash_c(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self, size_t *__pyx_v_digest_size) { + unsigned char *__pyx_v_serialize_res; + size_t __pyx_v_serialize_size; + unsigned char *__pyx_v_digest; + unsigned char *__pyx_r; + unsigned char *__pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "polluck_blockchain/placeholder_native.pyx":246 + * unsigned char *digest + * + * serialize_res = self.bytes_serialize_c(&serialize_size) # <<<<<<<<<<<<<< + * digest = self.digest(serialize_res, serialize_size, digest_size) + * +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_18polluck_blockchain_18placeholder_native_PyBlock *)__pyx_v_self->__pyx_vtab)->bytes_serialize_c(__pyx_v_self, (&__pyx_v_serialize_size)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 246, __pyx_L1_error) + __pyx_v_serialize_res = __pyx_t_1; + + /* "polluck_blockchain/placeholder_native.pyx":247 + * + * serialize_res = self.bytes_serialize_c(&serialize_size) + * digest = self.digest(serialize_res, serialize_size, digest_size) # <<<<<<<<<<<<<< + * + * return digest +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_18polluck_blockchain_18placeholder_native_PyBlock *)__pyx_v_self->__pyx_vtab)->digest(__pyx_v_self, __pyx_v_serialize_res, __pyx_v_serialize_size, __pyx_v_digest_size); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 247, __pyx_L1_error) + __pyx_v_digest = __pyx_t_1; + + /* "polluck_blockchain/placeholder_native.pyx":249 + * digest = self.digest(serialize_res, serialize_size, digest_size) + * + * return digest # <<<<<<<<<<<<<< + * + * cpdef perform_hash(self): +*/ + __pyx_r = __pyx_v_digest; + goto __pyx_L0; + + /* "polluck_blockchain/placeholder_native.pyx":240 + * return digest + * + * cdef unsigned char* perform_hash_c(self, size_t *digest_size): # <<<<<<<<<<<<<< + * cdef: + * unsigned char *serialize_res +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("polluck_blockchain.placeholder_native.PyBlock.perform_hash_c", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + return __pyx_r; +} + +/* "polluck_blockchain/placeholder_native.pyx":251 + * return digest + * + * cpdef perform_hash(self): # <<<<<<<<<<<<<< + * cdef: + * unsigned char *digest +*/ + +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_13perform_hash(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 PyObject *__pyx_f_18polluck_blockchain_18placeholder_native_7PyBlock_perform_hash(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self, int __pyx_skip_dispatch) { + unsigned char *__pyx_v_digest; + size_t __pyx_v_digest_size; + 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; + unsigned char *__pyx_t_6; + PyObject *__pyx_t_7 = NULL; + std::string __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + char const *__pyx_t_11; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + PyObject *__pyx_t_16 = NULL; + PyObject *__pyx_t_17 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("perform_hash", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if ( + #if !CYTHON_USE_TYPE_SLOTS + unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_18polluck_blockchain_18placeholder_native_PyBlock && + __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC)) + #else + unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE))) + #endif + ) { + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { + PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + #endif + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_perform_hash); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_13perform_hash)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = NULL; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = __pyx_t_1; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_3); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__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, 251, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); + if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) { + __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; + } + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS + } + #endif + } + + /* "polluck_blockchain/placeholder_native.pyx":256 + * size_t digest_size + * + * try: # <<<<<<<<<<<<<< + * digest = self.perform_hash_c(&digest_size) + * self.BlockC.hash = bytes(digest[:digest_size]).hex().encode("UTF-8") +*/ + /*try:*/ { + + /* "polluck_blockchain/placeholder_native.pyx":257 + * + * try: + * digest = self.perform_hash_c(&digest_size) # <<<<<<<<<<<<<< + * self.BlockC.hash = bytes(digest[:digest_size]).hex().encode("UTF-8") + * finally: +*/ + __pyx_t_6 = ((struct __pyx_vtabstruct_18polluck_blockchain_18placeholder_native_PyBlock *)__pyx_v_self->__pyx_vtab)->perform_hash_c(__pyx_v_self, (&__pyx_v_digest_size)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L4_error) + __pyx_v_digest = __pyx_t_6; + + /* "polluck_blockchain/placeholder_native.pyx":258 + * try: + * digest = self.perform_hash_c(&digest_size) + * self.BlockC.hash = bytes(digest[:digest_size]).hex().encode("UTF-8") # <<<<<<<<<<<<<< + * finally: + * free(digest) +*/ + __pyx_t_3 = NULL; + __pyx_t_7 = __Pyx_PyBytes_FromStringAndSize(((char const *)__pyx_v_digest) + 0, __pyx_v_digest_size - 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 258, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(&PyBytes_Type), __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_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 258, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_2 = __pyx_t_4; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_hex, __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_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_4 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 258, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_8 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 258, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_self->BlockC->hash = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_8); + } + + /* "polluck_blockchain/placeholder_native.pyx":260 + * self.BlockC.hash = bytes(digest[:digest_size]).hex().encode("UTF-8") + * finally: + * free(digest) # <<<<<<<<<<<<<< + * + * return self.hash +*/ + /*finally:*/ { + /*normal exit:*/{ + free(__pyx_v_digest); + goto __pyx_L5; + } + __pyx_L4_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17); + if ( unlikely(__Pyx_GetException(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14) < 0)) __Pyx_ErrFetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14); + __Pyx_XGOTREF(__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_13); + __Pyx_XGOTREF(__pyx_t_14); + __Pyx_XGOTREF(__pyx_t_15); + __Pyx_XGOTREF(__pyx_t_16); + __Pyx_XGOTREF(__pyx_t_17); + __pyx_t_9 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_11 = __pyx_filename; + { + free(__pyx_v_digest); + } + __Pyx_XGIVEREF(__pyx_t_15); + __Pyx_XGIVEREF(__pyx_t_16); + __Pyx_XGIVEREF(__pyx_t_17); + __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_XGIVEREF(__pyx_t_14); + __Pyx_ErrRestore(__pyx_t_12, __pyx_t_13, __pyx_t_14); + __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; + __pyx_lineno = __pyx_t_9; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_11; + goto __pyx_L1_error; + } + __pyx_L5:; + } + + /* "polluck_blockchain/placeholder_native.pyx":262 + * free(digest) + * + * return self.hash # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_hash); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 262, __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":251 + * return digest + * + * cpdef perform_hash(self): # <<<<<<<<<<<<<< + * cdef: + * unsigned char *digest +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("polluck_blockchain.placeholder_native.PyBlock.perform_hash", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_13perform_hash(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_13perform_hash = {"perform_hash", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_13perform_hash, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_13perform_hash(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("perform_hash (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("perform_hash", 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("perform_hash", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_12perform_hash(((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_12perform_hash(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("perform_hash", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_18polluck_blockchain_18placeholder_native_7PyBlock_perform_hash(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("polluck_blockchain.placeholder_native.PyBlock.perform_hash", __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__" @@ -5092,15 +5640,15 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_10b */ /* Python wrapper */ -static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_13__reduce_cython__(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_15__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_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, +static PyMethodDef __pyx_mdef_18polluck_blockchain_18placeholder_native_7PyBlock_15__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_15__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_15__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -5126,14 +5674,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_12__reduce_cython__(((struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *)__pyx_v_self)); + __pyx_r = __pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_14__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_12__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *__pyx_v_self) { +static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_14__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; @@ -5173,15 +5721,15 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_12_ */ /* Python wrapper */ -static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_15__setstate_cython__(PyObject *__pyx_v_self, +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_17__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_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, +static PyMethodDef __pyx_mdef_18polluck_blockchain_18placeholder_native_7PyBlock_17__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_17__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_17__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else @@ -5247,7 +5795,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_14__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_16__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) { @@ -5257,7 +5805,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -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) { +static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_16__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; @@ -5289,7 +5837,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_7PyBlock_14_ return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":231 +/* "polluck_blockchain/placeholder_native.pyx":285 * cdef bint _genesis_done * * def __cinit__(self): # <<<<<<<<<<<<<< @@ -5335,7 +5883,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain___cin int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "polluck_blockchain/placeholder_native.pyx":232 + /* "polluck_blockchain/placeholder_native.pyx":286 * * def __cinit__(self): * self._difficulty = 1 # <<<<<<<<<<<<<< @@ -5344,7 +5892,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain___cin */ __pyx_v_self->_difficulty = 1; - /* "polluck_blockchain/placeholder_native.pyx":233 + /* "polluck_blockchain/placeholder_native.pyx":287 * def __cinit__(self): * self._difficulty = 1 * self._index = 0 # <<<<<<<<<<<<<< @@ -5353,7 +5901,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain___cin */ __pyx_v_self->_index = ((uint64_t)0); - /* "polluck_blockchain/placeholder_native.pyx":234 + /* "polluck_blockchain/placeholder_native.pyx":288 * self._difficulty = 1 * self._index = 0 * self._genesis_done = 0 # <<<<<<<<<<<<<< @@ -5362,7 +5910,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain___cin */ __pyx_v_self->_genesis_done = 0; - /* "polluck_blockchain/placeholder_native.pyx":235 + /* "polluck_blockchain/placeholder_native.pyx":289 * self._index = 0 * self._genesis_done = 0 * self._chain = new unordered_map[uint64_t, Block*]() # <<<<<<<<<<<<<< @@ -5373,11 +5921,11 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain___cin __pyx_t_1 = new std::unordered_map (); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 235, __pyx_L1_error) + __PYX_ERR(0, 289, __pyx_L1_error) } __pyx_v_self->_chain = __pyx_t_1; - /* "polluck_blockchain/placeholder_native.pyx":236 + /* "polluck_blockchain/placeholder_native.pyx":290 * self._genesis_done = 0 * self._chain = new unordered_map[uint64_t, Block*]() * if self._chain is NULL: # <<<<<<<<<<<<<< @@ -5387,7 +5935,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":237 + /* "polluck_blockchain/placeholder_native.pyx":291 * self._chain = new unordered_map[uint64_t, Block*]() * if self._chain is NULL: * raise MemoryError("Could not allocate hasmap") # <<<<<<<<<<<<<< @@ -5400,14 +5948,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, 237, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 291, __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, 237, __pyx_L1_error) + __PYX_ERR(0, 291, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":236 + /* "polluck_blockchain/placeholder_native.pyx":290 * self._genesis_done = 0 * self._chain = new unordered_map[uint64_t, Block*]() * if self._chain is NULL: # <<<<<<<<<<<<<< @@ -5416,7 +5964,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain___cin */ } - /* "polluck_blockchain/placeholder_native.pyx":231 + /* "polluck_blockchain/placeholder_native.pyx":285 * cdef bint _genesis_done * * def __cinit__(self): # <<<<<<<<<<<<<< @@ -5437,7 +5985,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain___cin return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":239 +/* "polluck_blockchain/placeholder_native.pyx":293 * raise MemoryError("Could not allocate hasmap") * * def __init__(self, *args, **kwargs): # <<<<<<<<<<<<<< @@ -5485,7 +6033,7 @@ static int __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_2__in return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":242 +/* "polluck_blockchain/placeholder_native.pyx":296 * pass * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -5510,7 +6058,7 @@ 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":244 + /* "polluck_blockchain/placeholder_native.pyx":298 * def __dealloc__(self): * # ownership is typically not transferred from the Blockchain extension class * cdef BcHashmap.iterator it = self._chain.begin() # <<<<<<<<<<<<<< @@ -5519,7 +6067,7 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_4__d */ __pyx_v_it = __pyx_v_self->_chain->begin(); - /* "polluck_blockchain/placeholder_native.pyx":245 + /* "polluck_blockchain/placeholder_native.pyx":299 * # ownership is typically not transferred from the Blockchain extension class * cdef BcHashmap.iterator it = self._chain.begin() * if self._chain is not NULL: # <<<<<<<<<<<<<< @@ -5529,7 +6077,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":246 + /* "polluck_blockchain/placeholder_native.pyx":300 * cdef BcHashmap.iterator it = self._chain.begin() * if self._chain is not NULL: * while it != self._chain.end(): # <<<<<<<<<<<<<< @@ -5540,7 +6088,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":247 + /* "polluck_blockchain/placeholder_native.pyx":301 * if self._chain is not NULL: * while it != self._chain.end(): * del dereference(it).second # <<<<<<<<<<<<<< @@ -5549,7 +6097,7 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_4__d */ delete (*__pyx_v_it).second; - /* "polluck_blockchain/placeholder_native.pyx":248 + /* "polluck_blockchain/placeholder_native.pyx":302 * while it != self._chain.end(): * del dereference(it).second * postincrement(it) # <<<<<<<<<<<<<< @@ -5559,7 +6107,7 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_4__d (void)((__pyx_v_it++)); } - /* "polluck_blockchain/placeholder_native.pyx":250 + /* "polluck_blockchain/placeholder_native.pyx":304 * postincrement(it) * * del self._chain # <<<<<<<<<<<<<< @@ -5568,7 +6116,7 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_4__d */ delete __pyx_v_self->_chain; - /* "polluck_blockchain/placeholder_native.pyx":251 + /* "polluck_blockchain/placeholder_native.pyx":305 * * del self._chain * self._chain = NULL # <<<<<<<<<<<<<< @@ -5577,7 +6125,7 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_4__d */ __pyx_v_self->_chain = NULL; - /* "polluck_blockchain/placeholder_native.pyx":245 + /* "polluck_blockchain/placeholder_native.pyx":299 * # ownership is typically not transferred from the Blockchain extension class * cdef BcHashmap.iterator it = self._chain.begin() * if self._chain is not NULL: # <<<<<<<<<<<<<< @@ -5586,7 +6134,7 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_4__d */ } - /* "polluck_blockchain/placeholder_native.pyx":242 + /* "polluck_blockchain/placeholder_native.pyx":296 * pass * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -5597,7 +6145,7 @@ static void __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain_4__d /* function exit code */ } -/* "polluck_blockchain/placeholder_native.pyx":253 +/* "polluck_blockchain/placeholder_native.pyx":307 * self._chain = NULL * * def __len__(self): # <<<<<<<<<<<<<< @@ -5623,7 +6171,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":254 + /* "polluck_blockchain/placeholder_native.pyx":308 * * def __len__(self): * return self._index + 1 # <<<<<<<<<<<<<< @@ -5633,7 +6181,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":253 + /* "polluck_blockchain/placeholder_native.pyx":307 * self._chain = NULL * * def __len__(self): # <<<<<<<<<<<<<< @@ -5646,7 +6194,7 @@ static Py_ssize_t __pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchai return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":256 +/* "polluck_blockchain/placeholder_native.pyx":310 * return self._index + 1 * * def print_key_value_pair(self): # <<<<<<<<<<<<<< @@ -5713,7 +6261,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":257 + /* "polluck_blockchain/placeholder_native.pyx":311 * * def print_key_value_pair(self): * cdef BcHashmap.iterator it = self._chain.begin() # <<<<<<<<<<<<<< @@ -5722,7 +6270,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain */ __pyx_v_it = __pyx_v_self->_chain->begin(); - /* "polluck_blockchain/placeholder_native.pyx":259 + /* "polluck_blockchain/placeholder_native.pyx":313 * cdef BcHashmap.iterator it = self._chain.begin() * cdef Block *block * while it != self._chain.end(): # <<<<<<<<<<<<<< @@ -5733,7 +6281,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":260 + /* "polluck_blockchain/placeholder_native.pyx":314 * cdef Block *block * while it != self._chain.end(): * print(dereference(it).first) # <<<<<<<<<<<<<< @@ -5741,7 +6289,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, 260, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyLong_From_uint64_t((*__pyx_v_it).first); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 314, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 1; { @@ -5749,12 +6297,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, 260, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 314, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "polluck_blockchain/placeholder_native.pyx":261 + /* "polluck_blockchain/placeholder_native.pyx":315 * while it != self._chain.end(): * print(dereference(it).first) * block = dereference(it).second # <<<<<<<<<<<<<< @@ -5764,19 +6312,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":262 + /* "polluck_blockchain/placeholder_native.pyx":316 * 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, 262, __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, 316, __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":263 + /* "polluck_blockchain/placeholder_native.pyx":317 * block = dereference(it).second * py_block = PyBlock.from_ptr(block) * print(py_block) # <<<<<<<<<<<<<< @@ -5789,12 +6337,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, 263, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 317, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "polluck_blockchain/placeholder_native.pyx":264 + /* "polluck_blockchain/placeholder_native.pyx":318 * py_block = PyBlock.from_ptr(block) * print(py_block) * postincrement(it) # <<<<<<<<<<<<<< @@ -5804,7 +6352,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain (void)((__pyx_v_it++)); } - /* "polluck_blockchain/placeholder_native.pyx":256 + /* "polluck_blockchain/placeholder_native.pyx":310 * return self._index + 1 * * def print_key_value_pair(self): # <<<<<<<<<<<<<< @@ -5828,7 +6376,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":266 +/* "polluck_blockchain/placeholder_native.pyx":320 * postincrement(it) * * @property # <<<<<<<<<<<<<< @@ -5860,7 +6408,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "polluck_blockchain/placeholder_native.pyx":268 + /* "polluck_blockchain/placeholder_native.pyx":322 * @property * def genesis_done(self): * return self._genesis_done # <<<<<<<<<<<<<< @@ -5868,13 +6416,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, 268, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->_genesis_done); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 322, __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":266 + /* "polluck_blockchain/placeholder_native.pyx":320 * postincrement(it) * * @property # <<<<<<<<<<<<<< @@ -5893,7 +6441,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":270 +/* "polluck_blockchain/placeholder_native.pyx":324 * return self._genesis_done * * @property # <<<<<<<<<<<<<< @@ -5925,7 +6473,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "polluck_blockchain/placeholder_native.pyx":272 + /* "polluck_blockchain/placeholder_native.pyx":326 * @property * def index(self): * return self._index # <<<<<<<<<<<<<< @@ -5933,13 +6481,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, 272, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 326, __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":270 + /* "polluck_blockchain/placeholder_native.pyx":324 * return self._genesis_done * * @property # <<<<<<<<<<<<<< @@ -5958,7 +6506,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":275 +/* "polluck_blockchain/placeholder_native.pyx":329 * * # TODO error handling * cdef Block* get_block_c(self, uint64_t idx): # <<<<<<<<<<<<<< @@ -5969,7 +6517,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":276 + /* "polluck_blockchain/placeholder_native.pyx":330 * # TODO error handling * cdef Block* get_block_c(self, uint64_t idx): * return self._chain[0][idx] # <<<<<<<<<<<<<< @@ -5979,7 +6527,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":275 + /* "polluck_blockchain/placeholder_native.pyx":329 * * # TODO error handling * cdef Block* get_block_c(self, uint64_t idx): # <<<<<<<<<<<<<< @@ -5992,7 +6540,7 @@ static ::Block *__pyx_f_18polluck_blockchain_18placeholder_native_10Blockchain_g return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":278 +/* "polluck_blockchain/placeholder_native.pyx":332 * return self._chain[0][idx] * * def get_block(self, idx): # <<<<<<<<<<<<<< @@ -6039,32 +6587,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, 278, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 332, __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, 278, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 332, __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, 278, __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, 332, __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, 278, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_block", 1, 1, 1, i); __PYX_ERR(0, 332, __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, 278, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 332, __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, 278, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_block", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 332, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -6102,32 +6650,32 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_block", 0); - /* "polluck_blockchain/placeholder_native.pyx":279 + /* "polluck_blockchain/placeholder_native.pyx":333 * * 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, 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_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, 333, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 333, __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, 279, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 333, __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, 279, __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, 333, __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, 279, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 333, __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":280 + /* "polluck_blockchain/placeholder_native.pyx":334 * def get_block(self, idx): * if idx < 0 or idx > self._index: * raise IndexError("Index value is out of bounds") # <<<<<<<<<<<<<< @@ -6140,14 +6688,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, 280, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 334, __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, 280, __pyx_L1_error) + __PYX_ERR(0, 334, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":279 + /* "polluck_blockchain/placeholder_native.pyx":333 * * def get_block(self, idx): * if idx < 0 or idx > self._index: # <<<<<<<<<<<<<< @@ -6156,18 +6704,18 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain */ } - /* "polluck_blockchain/placeholder_native.pyx":282 + /* "polluck_blockchain/placeholder_native.pyx":336 * 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, 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_t_6 = __Pyx_PyLong_As_uint64_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 336, __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, 336, __pyx_L1_error) __pyx_v_block = __pyx_t_7; - /* "polluck_blockchain/placeholder_native.pyx":283 + /* "polluck_blockchain/placeholder_native.pyx":337 * * cdef Block *block = self.get_block_c(idx) * return PyBlock.from_ptr(block, owner=False) # <<<<<<<<<<<<<< @@ -6177,13 +6725,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, 283, __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, 337, __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":278 + /* "polluck_blockchain/placeholder_native.pyx":332 * return self._chain[0][idx] * * def get_block(self, idx): # <<<<<<<<<<<<<< @@ -6203,7 +6751,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":285 +/* "polluck_blockchain/placeholder_native.pyx":339 * return PyBlock.from_ptr(block, owner=False) * * cdef void add_block(self, Block *block): # <<<<<<<<<<<<<< @@ -6213,7 +6761,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":286 + /* "polluck_blockchain/placeholder_native.pyx":340 * * cdef void add_block(self, Block *block): * self._chain[0][block.index] = block # <<<<<<<<<<<<<< @@ -6222,7 +6770,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":287 + /* "polluck_blockchain/placeholder_native.pyx":341 * cdef void add_block(self, Block *block): * self._chain[0][block.index] = block * if self._genesis_done: # <<<<<<<<<<<<<< @@ -6231,7 +6779,7 @@ static void __pyx_f_18polluck_blockchain_18placeholder_native_10Blockchain_add_b */ if (__pyx_v_self->_genesis_done) { - /* "polluck_blockchain/placeholder_native.pyx":288 + /* "polluck_blockchain/placeholder_native.pyx":342 * self._chain[0][block.index] = block * if self._genesis_done: * self._index += 1 # <<<<<<<<<<<<<< @@ -6240,7 +6788,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":287 + /* "polluck_blockchain/placeholder_native.pyx":341 * cdef void add_block(self, Block *block): * self._chain[0][block.index] = block * if self._genesis_done: # <<<<<<<<<<<<<< @@ -6249,7 +6797,7 @@ static void __pyx_f_18polluck_blockchain_18placeholder_native_10Blockchain_add_b */ } - /* "polluck_blockchain/placeholder_native.pyx":285 + /* "polluck_blockchain/placeholder_native.pyx":339 * return PyBlock.from_ptr(block, owner=False) * * cdef void add_block(self, Block *block): # <<<<<<<<<<<<<< @@ -6260,7 +6808,7 @@ static void __pyx_f_18polluck_blockchain_18placeholder_native_10Blockchain_add_b /* function exit code */ } -/* "polluck_blockchain/placeholder_native.pyx":290 +/* "polluck_blockchain/placeholder_native.pyx":344 * self._index += 1 * * def create_genesis_block(self): # <<<<<<<<<<<<<< @@ -6329,19 +6877,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":293 + /* "polluck_blockchain/placeholder_native.pyx":347 * cdef Block *block = new Block( * self._index, * 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, 293, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 347, __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, 293, __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, 347, __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, 293, __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, 347, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_2 = __pyx_t_3; @@ -6352,43 +6900,43 @@ 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, 293, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 347, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } - __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 293, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 347, __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_t_6 = __Pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 347, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "polluck_blockchain/placeholder_native.pyx":295 + /* "polluck_blockchain/placeholder_native.pyx":349 * 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, 295, __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, 349, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":296 + /* "polluck_blockchain/placeholder_native.pyx":350 * 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, 296, __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, 350, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":297 + /* "polluck_blockchain/placeholder_native.pyx":351 * "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, 297, __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, 351, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":291 + /* "polluck_blockchain/placeholder_native.pyx":345 * * def create_genesis_block(self): * cdef Block *block = new Block( # <<<<<<<<<<<<<< @@ -6399,30 +6947,30 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain __pyx_t_10 = new ::Block(__pyx_v_self->_index, __pyx_t_6, 0, __pyx_t_7, __pyx_t_8, __pyx_t_9); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 291, __pyx_L1_error) + __PYX_ERR(0, 345, __pyx_L1_error) } __pyx_v_block = __pyx_t_10; - /* "polluck_blockchain/placeholder_native.pyx":299 + /* "polluck_blockchain/placeholder_native.pyx":353 * "".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, 299, __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, 353, __pyx_L1_error) __pyx_v_block->hash = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_9); - /* "polluck_blockchain/placeholder_native.pyx":300 + /* "polluck_blockchain/placeholder_native.pyx":354 * ) * 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, 300, __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, 354, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":301 + /* "polluck_blockchain/placeholder_native.pyx":355 * block.hash = "dummy hash".encode("UTF-8") * self.add_block(block) * self._genesis_done = True # <<<<<<<<<<<<<< @@ -6431,7 +6979,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain */ __pyx_v_self->_genesis_done = 1; - /* "polluck_blockchain/placeholder_native.pyx":290 + /* "polluck_blockchain/placeholder_native.pyx":344 * self._index += 1 * * def create_genesis_block(self): # <<<<<<<<<<<<<< @@ -6455,7 +7003,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain return __pyx_r; } -/* "polluck_blockchain/placeholder_native.pyx":303 +/* "polluck_blockchain/placeholder_native.pyx":357 * self._genesis_done = True * * def new_block(self, data): # <<<<<<<<<<<<<< @@ -6502,32 +7050,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, 303, __pyx_L3_error) + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 357, __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, 303, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 357, __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, 303, __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, 357, __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, 303, __pyx_L3_error) } + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("new_block", 1, 1, 1, i); __PYX_ERR(0, 357, __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, 303, __pyx_L3_error) + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 357, __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, 303, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("new_block", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 357, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -6570,7 +7118,7 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain int __pyx_clineno = 0; __Pyx_RefNannySetupContext("new_block", 0); - /* "polluck_blockchain/placeholder_native.pyx":304 + /* "polluck_blockchain/placeholder_native.pyx":358 * * def new_block(self, data): * if not self._genesis_done: # <<<<<<<<<<<<<< @@ -6580,7 +7128,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":305 + /* "polluck_blockchain/placeholder_native.pyx":359 * def new_block(self, data): * if not self._genesis_done: * raise RuntimeError("Create a genesis block first.") # <<<<<<<<<<<<<< @@ -6593,14 +7141,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, 305, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 359, __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, 305, __pyx_L1_error) + __PYX_ERR(0, 359, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":304 + /* "polluck_blockchain/placeholder_native.pyx":358 * * def new_block(self, data): * if not self._genesis_done: # <<<<<<<<<<<<<< @@ -6609,17 +7157,17 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain */ } - /* "polluck_blockchain/placeholder_native.pyx":307 + /* "polluck_blockchain/placeholder_native.pyx":361 * 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, 307, __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, 361, __pyx_L1_error) __pyx_v_prev_block = __pyx_t_5; - /* "polluck_blockchain/placeholder_native.pyx":308 + /* "polluck_blockchain/placeholder_native.pyx":362 * * cdef Block *prev_block = self.get_block_c(self._index) * cdef string prev_hash = prev_block.prev_hash # <<<<<<<<<<<<<< @@ -6629,7 +7177,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":309 + /* "polluck_blockchain/placeholder_native.pyx":363 * 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 # <<<<<<<<<<<<<< @@ -6638,19 +7186,19 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain */ __pyx_v_new_idx = (__pyx_v_self->_index + 1); - /* "polluck_blockchain/placeholder_native.pyx":313 + /* "polluck_blockchain/placeholder_native.pyx":367 * cdef Block *block = new Block( * new_idx, * 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, 313, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_datetime); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 367, __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, 313, __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, 367, __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, 313, __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, 367, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_3 = __pyx_t_7; @@ -6661,16 +7209,16 @@ 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, 313, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 367, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } - __pyx_t_7 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 313, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 367, __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_t_9 = __Pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 367, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "polluck_blockchain/placeholder_native.pyx":315 + /* "polluck_blockchain/placeholder_native.pyx":369 * int(datetime.datetime(2025, 12, 1, 12, 0, 0).timestamp()), * 0, * data.encode("UTF-8"), # <<<<<<<<<<<<<< @@ -6684,22 +7232,22 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain 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) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 369, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); } - __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_t_6 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_7); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 369, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "polluck_blockchain/placeholder_native.pyx":317 + /* "polluck_blockchain/placeholder_native.pyx":371 * 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, 317, __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, 371, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":311 + /* "polluck_blockchain/placeholder_native.pyx":365 * cdef uint64_t new_idx = self._index + 1 * * cdef Block *block = new Block( # <<<<<<<<<<<<<< @@ -6710,20 +7258,20 @@ static PyObject *__pyx_pf_18polluck_blockchain_18placeholder_native_10Blockchain __pyx_t_5 = new ::Block(__pyx_v_new_idx, __pyx_t_9, 0, __pyx_t_6, __pyx_v_prev_hash, __pyx_t_10); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 311, __pyx_L1_error) + __PYX_ERR(0, 365, __pyx_L1_error) } __pyx_v_block = __pyx_t_5; - /* "polluck_blockchain/placeholder_native.pyx":319 + /* "polluck_blockchain/placeholder_native.pyx":373 * "".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, 319, __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, 373, __pyx_L1_error) - /* "polluck_blockchain/placeholder_native.pyx":303 + /* "polluck_blockchain/placeholder_native.pyx":357 * self._genesis_done = True * * def new_block(self, data): # <<<<<<<<<<<<<< @@ -7023,8 +7571,8 @@ static PyObject *__pyx_getprop_18polluck_blockchain_18placeholder_native_7PyBloc static PyMethodDef __pyx_methods_18polluck_blockchain_18placeholder_native_PyBlock[] = { {"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}, + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_15__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_18polluck_blockchain_18placeholder_native_7PyBlock_17__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; @@ -7365,17 +7913,20 @@ 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; + __pyx_vtable_18polluck_blockchain_18placeholder_native_PyBlock.bytes_serialize_c = (unsigned char *(*)(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *, size_t *))__pyx_f_18polluck_blockchain_18placeholder_native_7PyBlock_bytes_serialize_c; + __pyx_vtable_18polluck_blockchain_18placeholder_native_PyBlock.digest = (unsigned char *(*)(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *, unsigned char *, size_t, size_t *))__pyx_f_18polluck_blockchain_18placeholder_native_7PyBlock_digest; + __pyx_vtable_18polluck_blockchain_18placeholder_native_PyBlock.perform_hash_c = (unsigned char *(*)(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *, size_t *))__pyx_f_18polluck_blockchain_18placeholder_native_7PyBlock_perform_hash_c; + __pyx_vtable_18polluck_blockchain_18placeholder_native_PyBlock.perform_hash = (PyObject *(*)(struct __pyx_obj_18polluck_blockchain_18placeholder_native_PyBlock *, int __pyx_skip_dispatch))__pyx_f_18polluck_blockchain_18placeholder_native_7PyBlock_perform_hash; #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, 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) + __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, 60, __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, 60, __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, 55, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_PyBlock) < (0)) __PYX_ERR(0, 60, __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); @@ -7385,23 +7936,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, 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) + if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_PyBlock, __pyx_vtabptr_18polluck_blockchain_18placeholder_native_PyBlock) < (0)) __PYX_ERR(0, 60, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_PyBlock) < (0)) __PYX_ERR(0, 60, __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, 60, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_PyBlock) < (0)) __PYX_ERR(0, 60, __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, 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) + __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, 279, __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, 279, __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, 225, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain) < (0)) __PYX_ERR(0, 279, __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); @@ -7411,10 +7962,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, 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) + if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain, __pyx_vtabptr_18polluck_blockchain_18placeholder_native_Blockchain) < (0)) __PYX_ERR(0, 279, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain) < (0)) __PYX_ERR(0, 279, __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, 279, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_18polluck_blockchain_18placeholder_native_Blockchain) < (0)) __PYX_ERR(0, 279, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -7456,7 +8007,7 @@ static PyModuleDef_Slot __pyx_moduledef_slots[] = { {Py_mod_create, (void*)__pyx_pymod_create}, {Py_mod_exec, (void*)__pyx_pymod_exec_placeholder_native}, #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING - {Py_mod_gil, Py_MOD_GIL_USED}, + {Py_mod_gil, __Pyx_FREETHREADING_COMPATIBLE}, #endif #if PY_VERSION_HEX >= 0x030C0000 && CYTHON_USE_MODULE_STATE {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED}, @@ -7780,19 +8331,34 @@ __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) + /* "polluck_blockchain/placeholder_native.pyx":207 + * return buf * * def bytes_serialize(self): # <<<<<<<<<<<<<< - * cdef SerializeResult serialize_res - * try: + * cdef: + * unsigned char *serialize_res */ - __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_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, 207, __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) + 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, 207, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "polluck_blockchain/placeholder_native.pyx":251 + * return digest + * + * cpdef perform_hash(self): # <<<<<<<<<<<<<< + * cdef: + * unsigned char *digest +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_18polluck_blockchain_18placeholder_native_7PyBlock_13perform_hash, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PyBlock_perform_hash, 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(0, 251, __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_perform_hash, __pyx_t_2) < (0)) __PYX_ERR(0, 251, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "(tree fragment)":1 @@ -7800,7 +8366,7 @@ __Pyx_RefNannySetupContext("PyInit_placeholder_native", 0); * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_18polluck_blockchain_18placeholder_native_7PyBlock_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_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_18polluck_blockchain_18placeholder_native_7PyBlock_15__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[2])); 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); @@ -7814,7 +8380,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_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_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_18polluck_blockchain_18placeholder_native_7PyBlock_17__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[3])); 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); @@ -7822,64 +8388,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":256 + /* "polluck_blockchain/placeholder_native.pyx":310 * 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[3])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 256, __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[4])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 310, __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, 256, __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, 310, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "polluck_blockchain/placeholder_native.pyx":278 + /* "polluck_blockchain/placeholder_native.pyx":332 * 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[4])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 278, __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[5])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 332, __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, 278, __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, 332, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "polluck_blockchain/placeholder_native.pyx":290 + /* "polluck_blockchain/placeholder_native.pyx":344 * 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[5])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 290, __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[6])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 344, __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, 290, __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, 344, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "polluck_blockchain/placeholder_native.pyx":303 + /* "polluck_blockchain/placeholder_native.pyx":357 * 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[6])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 303, __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[7])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 357, __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, 303, __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, 357, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "(tree fragment)":1 @@ -7887,7 +8453,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[7])); 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[8])); 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); @@ -7901,7 +8467,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[8])); 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[9])); 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); @@ -7955,7 +8521,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, 260, __pyx_L1_error) + __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_print); if (!__pyx_builtin_print) __PYX_ERR(0, 314, __pyx_L1_error) /* Cached unbound methods */ __pyx_mstate->__pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type; @@ -7975,14 +8541,14 @@ static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "polluck_blockchain/placeholder_native.pyx":77 + /* "polluck_blockchain/placeholder_native.pyx":82 * self.BlockC = new Block( * index, * 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, 77, __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, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]); #if CYTHON_IMMORTAL_CONSTANTS @@ -8008,31 +8574,31 @@ static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) { CYTHON_UNUSED_VAR(__pyx_mstate); { - const struct { const unsigned int length: 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\212\204}}\254jI\031\035\202\036\214\027$)v!\313\037\242\370\026\230{\231\211\027\232HA\027\200\002\016\002 \004i \005\n\331\260\366\r\340\200\n\2332\026\255a\331\024}\202`B\000\364\214s\212S\3175w\034S%\216\035p\376\0363\251(\317\346v?\336/\256L\305H\342R@[\270;O\001\317\005\027n\333\323\313\014\311\312:L\357-x\253A5\316\267\324B\034\367>\246g!\035\324\241\010\306\372\211\254C\240Q\3149LL9I5\226\017\266\250MU\325;q\310\301\213!\335b\276|\002\306\241:3T.>\266M\023\031\303\312\033\215\215\303\3418[g\244\311\344\206W\261\300\230v\335\265\035mw\365]\250k\032\023`\255\334\323\006\220\206$\202\350\312\302\2275 7K&\351YLz-\221\210\376\256\312\236\206\234\253\274\317Y\214\335\253\241\\ot\207(9\357I$\213fD\320\321t\347\001\234\356\336\326|\212aZ\300\345\324\322\273\025gxP/\254\261\211:\342\262C\307\271\351\240\321jk\\^6sF\r\301P\345\226\247\301\306\244Y\264\2673\004\013SL\351D\250\3103\203=\241k\316^\366\271\261\274a\317\224\t\332\231U3\247Yj+\317<+\271\026b\242m\334Tf\032\261\026\3546p\0130[\236sbB\262\\\254&I\223\t$\222(<\200\\J\313\240\334LO\330yl\367\2510 HO+\225MIx\022\352\322)\236\033\247\276\006\235[S\333^\267^\3146\214%\300i4\025\221k\307\r\0032\205\244\244qW\033+\364\025Li5\370\247F\301\262\232S\223hu\342\330\361\251Y\216\362\374\032\017#Z\222\340\201\002\262\005v\304F4\203\205\246\006\201\217\030\204\223\007\333v\2013O\213\240O\017t\232\200\200\210\272\214$\007\244\202\300Y>\260N\004\273\007k\363G\177\354Cq\221V\226E\"\004\266\315\021O\231w= \177\334\017\210j\212\230\352\2539Xk\272\023c\33075\025\376\231\007\304\203z\243\302\026\\\267\255Z\\C06\352\250u\022\206\242\210\356\242\024\271=\233M\t\310Fh\236?\216\222\343\025\246&4\270R6\202r\234J\300\3608$\241\204_\030A)S\024d\350\324\321\243\252\235U\037\370\273\222)\302\204\200\000M\007("; + PyObject *data = __Pyx_DecompressString(cstring, 1004, 2); if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) const char* const bytes = __Pyx_PyBytes_AsString(data); #if !CYTHON_ASSUME_SAFE_MACROS if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } #endif - #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (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); + #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (895 bytes) */ +const char* const cstring = "x\332\205T\315\217\0335\024't\305\246a\266%m\241B|MPA\320\322\224m\221\340\300\207\262\273\005\026A\333\240\024!\324\312r\016CN\260\242\376\010\313\010'\373\202\272\r\366\2074\246\222I\277\017\346#\177\300\204T\355\3038\240S\177\202\303\224\372`\342\251\362\371\300\357\3634\016\344\223\331\236\363\374\344i\357\373\273_}\372]\300$\356\207\224\306n\036\022&\027R\020s?\240\003\234\206\312GH\320 %\024!?\200\013\025\207|\342\273J\260\t\303!X\t\213\231BH\nr/\341a\230\222#T&CF\230\305\367\222\020\023:\342a@\005\212\261b\023\332Nf\323\257%\234\217\207\222\247\202\320o\367V\356\347R{\025\226\314\324\210\307\010\375\313&\251\222\n\020\270\310JJlP\205\314\"\2315\363\220\252\r]L_l\350\022\310P\241#:C%\222(\301LT\350U\313f\216\347\206\215\004\227\246\376LQ\tf\001\350\261?\351R\235P1\340\"B\320\336\221s\236\3028`D\241Gt\252~\245\203\336\341/\017\377x\374\350!z\332\333\307r\026\023\306\333\204\013\350-\2032\313\334\377s3\t\301\202X\214\224\200\026\3641\324u\0010\001V\030\006U,\242\001O\000\032,\031\221kb{i\2461\341@\n\301#\224(\341V\247\205*\243\004\241A\032\023\204V\330\226\342\002\200\262$7B\326\037\321)\013\246\314\361\023A\006\253\002\230b\212F\022\241\010\220G\360E\324]\r\207\275\371O\032\353\361q\347\357\372+\227\033\205\007Y\275\364\357\347\255|7\357\024\336u\375\215}\325\266\316\340lM7]vU0\330\377_\270w\314\227\266ew\235\333\013\027b-\350\316\374w\375\314\336\314jY\263Xf\000\302K\357=SB\360\221\355e7\363\327rp\2752'\372\272>0\333F\271\273\232\272\t\250\020\333,\274\033\372g{\311\351\3367\314\216\263\332\302\010\261\3376M\323\202\202\032eAo\352\236\371\300E\002\324J\010\246&\265\035\373[v?{~r\353\244\177\272}:\376\253VUxV\277\352\260?\256\025[\215\371\035\335\375\007\021\312s\260"; + PyObject *data = __Pyx_DecompressString(cstring, 895, 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 (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"; + #else /* compression: none (1593 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_serializePyBlock.perform_hash__Pyx_PyDict_NextRefTIMEZONE_UTCasyncio.coroutinesblockbytes_serializecline_in_tracebackcreate_genesis_blockdatadatetimedopt_basicsdopt_basics.datetimeencodefrom_ptrfromtimestamp__func__get_block__getstate__hashhashlibhexidxindex_is_coroutineititems__main____module____name__new_blocknew_idxnonceperform_hashpolluck_blockchain.placeholder_nativepopprev_blockprev_hashprevious_hashprintprint_key_value_pairpy_block__pyx_state__pyx_vtable____qualname____reduce____reduce_cython____reduce_ex____repr__selfserialize_resserialize_size__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\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\360\010\000\t\n\330\014\034\230D\320 2\260!\2601\260A\330\014\023\220=\240\002\240!\340\014\020\220\001\220\021\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!\200A\360\n\000\t\n\330\014\025\220T\230\037\250\001\250\021\250!\330\014\020\220\007\220x\230u\240A\240V\2502\250]\270$\270b\300\007\300q\310\001\340\014\020\220\001\220\021\340\010\017\210t\2201\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 < 82; i++) { + for (int i = 0; i < 85; i++) { Py_ssize_t bytes_length = index[i].length; PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL); if (likely(string) && i >= 14) PyUnicode_InternInPlace(&string); @@ -8043,7 +8609,7 @@ const char* const bytes = "Could not allocate hasmapCreate a genesis block first stringtab[i] = string; pos += bytes_length; } - for (int i = 82; i < 92; i++) { + for (int i = 85; i < 96; i++) { Py_ssize_t bytes_length = index[i].length; PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length); stringtab[i] = string; @@ -8054,15 +8620,15 @@ const char* const bytes = "Could not allocate hasmapCreate a genesis block first } } Py_XDECREF(data); - for (Py_ssize_t i = 0; i < 92; i++) { + for (Py_ssize_t i = 0; i < 96; i++) { if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { __PYX_ERR(0, 1, __pyx_L1_error) } } #if CYTHON_IMMORTAL_CONSTANTS { - PyObject **table = stringtab + 82; - for (Py_ssize_t i=0; i<10; ++i) { + PyObject **table = stringtab + 85; + for (Py_ssize_t i=0; i<11; ++i) { #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); #else @@ -8121,49 +8687,54 @@ 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, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 207}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_serialize_res, __pyx_mstate->__pyx_n_u_serialize_size}; + __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_1A, 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), 251}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; + __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_polluck_blockchain_placehold, __pyx_mstate->__pyx_n_u_perform_hash, __pyx_mstate->__pyx_kp_b_iso88591_A_T_xuAV2_b_q_t1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) 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[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; + __pyx_mstate_global->__pyx_codeobj_tab[2] = __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[2])) 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[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; + __pyx_mstate_global->__pyx_codeobj_tab[3] = __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[3])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 256}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 310}; 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[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; + __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_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[4])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 278}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 332}; 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[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; + __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_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[5])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 290}; + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 344}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __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_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; + __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_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[6])) goto bad; } { - const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 303}; + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 357}; 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[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; + __pyx_mstate_global->__pyx_codeobj_tab[7] = __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[7])) 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[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; + __pyx_mstate_global->__pyx_codeobj_tab[8] = __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[8])) 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[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; + __pyx_mstate_global->__pyx_codeobj_tab[9] = __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[9])) goto bad; } Py_DECREF(tuple_dedup_map); return 0; diff --git a/src/polluck_blockchain/placeholder_native.pyx b/src/polluck_blockchain/placeholder_native.pyx index f0a2ecb..8a27b97 100644 --- a/src/polluck_blockchain/placeholder_native.pyx +++ b/src/polluck_blockchain/placeholder_native.pyx @@ -20,6 +20,7 @@ from libc.stdint cimport uint64_t from libc.stdlib cimport malloc, free from libc.string cimport memcpy from cython.operator import postincrement, dereference +cimport polluck_blockchain.openssl_evp as ossl ctypedef unsigned long ULong @@ -48,9 +49,13 @@ cdef int serialize_uint64(unsigned char* out, unsigned long long v) except -1 no out[6] = (v >> 8) & 0xFF out[7] = v & 0xFF -cdef struct SerializeResult: - unsigned char *ptr - size_t size +# cdef struct SerializeResult: +# unsigned char *ptr +# size_t size + +# cdef struct DigestResult: +# unsigned char *ptr +# size_t size cdef class PyBlock: cdef: @@ -159,19 +164,19 @@ cdef class PyBlock: def hash(self): return self.BlockC.hash.decode("UTF-8") - cdef SerializeResult bytes_serialize_c(self): + cdef unsigned char* bytes_serialize_c(self, size_t *size): cdef: size_t total_len unsigned char* buf size_t pos = 0 # index (8), timestamp (8), nonce (8), data, prev_hash - total_len = ( + size[0] = ( (8 * 3) + self.BlockC.data.size() + self.BlockC.prev_hash.size() ) - buf = malloc(total_len * sizeof(unsigned char)) + buf = malloc(size[0] * sizeof(unsigned char)) if buf == NULL: raise MemoryError() @@ -197,15 +202,65 @@ cdef class PyBlock: ) pos += self.BlockC.prev_hash.size() - return SerializeResult(buf, total_len) + return buf def bytes_serialize(self): - cdef SerializeResult serialize_res + cdef: + unsigned char *serialize_res + size_t serialize_size try: - serialize_res = self.bytes_serialize_c() - return serialize_res.ptr[:serialize_res.size] + serialize_res = self.bytes_serialize_c(&serialize_size) + return serialize_res[:serialize_size] finally: - free(serialize_res.ptr) + free(serialize_res) + + cdef unsigned char* digest(self, unsigned char *data, size_t data_size, size_t *digest_size): + cdef ossl.EVP_MD_CTX *ctx = ossl.EVP_MD_CTX_new() + if ctx == NULL: + raise MemoryError() + cdef const ossl.EVP_MD *algo = ossl.EVP_sha256() + + cdef: + unsigned char* digest + size_t dig_buff_len + unsigned int digest_len + + dig_buff_len = ossl.EVP_MD_size(algo) + digest = malloc(dig_buff_len * sizeof(unsigned char)) + ossl.EVP_DigestInit_ex(ctx, algo, NULL) + ossl.EVP_DigestUpdate(ctx, data, data_size) + ossl.EVP_DigestFinal_ex(ctx, digest, &digest_len) + + digest_size[0] = dig_buff_len + + ossl.EVP_MD_CTX_free(ctx) + + return digest + + cdef unsigned char* perform_hash_c(self, size_t *digest_size): + cdef: + unsigned char *serialize_res + size_t serialize_size + unsigned char *digest + + serialize_res = self.bytes_serialize_c(&serialize_size) + digest = self.digest(serialize_res, serialize_size, digest_size) + + return digest + + cpdef perform_hash(self): + cdef: + unsigned char *digest + size_t digest_size + + try: + digest = self.perform_hash_c(&digest_size) + self.BlockC.hash = bytes(digest[:digest_size]).hex().encode("UTF-8") + finally: + free(digest) + + return self.hash + @@ -234,7 +289,7 @@ cdef class Blockchain: self._chain = new unordered_map[uint64_t, Block*]() if self._chain is NULL: raise MemoryError("Could not allocate hasmap") - + def __init__(self, *args, **kwargs): pass