From 32861d418037b838b29455d62eae8a86b3c518f2 Mon Sep 17 00:00:00 2001 From: "alexey.stratulat" <alexey.stratulat@demlabs.net> Date: Wed, 18 Dec 2019 21:27:10 +0700 Subject: [PATCH] [*] Fix. Rename PyDapChainHasfFast to PyDapHashFast --- include/libdap-chain-python.h | 2 +- include/wrapping_dap_chain_ledger.h | 3 ++- src/libdap-chain-python.c | 2 +- src/wrapping_dap_chain_ledger.c | 20 ++++++++++---------- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/include/libdap-chain-python.h b/include/libdap-chain-python.h index 9874ea04..aee6083e 100644 --- a/include/libdap-chain-python.h +++ b/include/libdap-chain-python.h @@ -13,7 +13,7 @@ #include "dap_chain.h" #include "dap_chain_node_client.h" #include "wrapping_dap_chain_ledger.h" -#include "wrapping_dap_chain_common_objects.h" +#include "wrapping_dap_chain_common.h" #ifdef __cplusplus extern "C" { diff --git a/include/wrapping_dap_chain_ledger.h b/include/wrapping_dap_chain_ledger.h index d5eb4d34..160ea180 100644 --- a/include/wrapping_dap_chain_ledger.h +++ b/include/wrapping_dap_chain_ledger.h @@ -3,9 +3,10 @@ #include "Python.h" #include "dap_chain_ledger.h" -#include "wrapping_dap_chain_common_objects.h" +#include "wrapping_dap_chain_common.h" #include "wrapping_dap_chain_datum_tx.h" #include "wrapping_dap_chain_datum_token.h" +#include "wrapping_dap_hash.h" #include "libdap-python.h" diff --git a/src/libdap-chain-python.c b/src/libdap-chain-python.c index 6d04a59f..3e840db7 100644 --- a/src/libdap-chain-python.c +++ b/src/libdap-chain-python.c @@ -15,7 +15,7 @@ PyObject *dap_chain_find_by_id_py(PyObject *self, PyObject *args){ if (!PyArg_ParseTuple(args, "O|O", &obj_net_id, &obj_chain_id)) return NULL; PyObject *new_obj = _PyObject_New(&dapChainObject_dapChainType); - ((PyDapChainObject*)new_obj)->chain_t = dap_chain_find_by_id(((PyDapChainNetIdObject*)obj_net_id)->net_id, ((PyDapChainIdObject*)obj_chain_id)->id); + ((PyDapChainObject*)new_obj)->chain_t = dap_chain_find_by_id(((PyDapChainNetIdObject*)obj_net_id)->net_id, ((PyDapChainIDObject*)obj_chain_id)->chain_id); return Py_BuildValue("O", &new_obj); } diff --git a/src/wrapping_dap_chain_ledger.c b/src/wrapping_dap_chain_ledger.c index d4cbc2dc..befafc13 100644 --- a/src/wrapping_dap_chain_ledger.c +++ b/src/wrapping_dap_chain_ledger.c @@ -18,15 +18,15 @@ PyObject *dap_chain_ledger_set_local_cell_id_py(PyObject *self, PyObject *args){ if (!PyArg_ParseTuple(args, "O", &obj_local_cell_id)) return NULL; dap_chain_ledger_set_local_cell_id(((PyDapChainLedgerObject*)self)->ledger, - ((PyDapChainCellIdObject*)obj_local_cell_id)->id); + *(((PyDapChainCellIDObject*)obj_local_cell_id)->cell_id)); return PyLong_FromLong(0); } PyObject *dap_chain_node_datum_tx_calc_hash_py(PyObject *self, PyObject *args){ PyObject *obj_tx; if (!PyArg_ParseTuple(args, "O", &obj_tx)) return NULL; - PyObject *obj_h_fast = _PyObject_New(&DapChainHashFastObject_DapChainHashFastObjectType); - ((PyDapChainHashFastObject*)obj_h_fast)->hash_fast = dap_chain_node_datum_tx_calc_hash(((PyDapChainDatumTxObject*)obj_tx)->datum_tx); + PyObject *obj_h_fast = _PyObject_New(&DapHashFastObject_DapHashFastObjectType); + ((PyDapHashFastObject*)obj_h_fast)->hash_fast = dap_chain_node_datum_tx_calc_hash(((PyDapChainDatumTxObject*)obj_tx)->datum_tx); return Py_BuildValue("O", obj_h_fast); } @@ -62,7 +62,7 @@ PyObject *dap_chain_ledger_token_emission_find_py(PyObject *self, PyObject *args return NULL; PyObject *token_emission = _PyObject_New(&DapChainDatumTokenEmission_DapChainDatumTokenEmissionObjectType); ((PyDapChainDatumTokenEmissionObject*)token_emission)->token_emission = dap_chain_ledger_token_emission_find( - ((PyDapChainLedgerObject*)self)->ledger, token_ticker, ((PyDapChainHashFastObject*)h_fast)->hash_fast); + ((PyDapChainLedgerObject*)self)->ledger, token_ticker, ((PyDapHashFastObject*)h_fast)->hash_fast); return Py_BuildValue("O", &token_emission); } PyObject *dap_chain_ledger_tx_get_token_ticker_by_hash_py(PyObject *self, PyObject *args){ @@ -142,7 +142,7 @@ PyObject *dap_chain_ledger_tx_remove_py(PyObject *self, PyObject *args){ PyObject *obj_h_fast; if (!PyArg_ParseTuple(args, "O", &obj_h_fast)) return NULL; - int res = dap_chain_ledger_tx_remove(((PyDapChainLedgerObject*)self)->ledger, ((PyDapChainHashFastObject*)obj_h_fast)->hash_fast); + int res = dap_chain_ledger_tx_remove(((PyDapChainLedgerObject*)self)->ledger, ((PyDapHashFastObject*)obj_h_fast)->hash_fast); return PyLong_FromLong(res); } PyObject *dap_chain_ledger_purge_py(PyObject *self, PyObject *args){ @@ -165,7 +165,7 @@ PyObject *dap_chain_ledger_tx_hash_is_used_out_item_py(PyObject *self, PyObject int idx_out; if (!PyArg_ParseTuple(args, "O|i", &obj_h_fast, &idx_out)) return NULL; - bool res = dap_chain_ledger_tx_hash_is_used_out_item(((PyDapChainLedgerObject*)self)->ledger, ((PyDapChainHashFastObject*)obj_h_fast)->hash_fast, idx_out); + bool res = dap_chain_ledger_tx_hash_is_used_out_item(((PyDapChainLedgerObject*)self)->ledger, ((PyDapHashFastObject*)obj_h_fast)->hash_fast, idx_out); if (res) return Py_BuildValue("O", Py_True); else @@ -192,7 +192,7 @@ PyObject *dap_chain_ledger_tx_find_by_hash_py(PyObject *self, PyObject *args){ if (!PyArg_ParseTuple(args, "O", &h_fast)) return NULL; PyObject *res = _PyObject_New(&DapChainDatumTx_DapChainDatumTxObjectType); - ((PyDapChainDatumTxObject*)res)->datum_tx = dap_chain_ledger_tx_find_by_hash(((PyDapChainLedgerObject*)self)->ledger, ((PyDapChainHashFastObject*)h_fast)->hash_fast); + ((PyDapChainDatumTxObject*)res)->datum_tx = dap_chain_ledger_tx_find_by_hash(((PyDapChainLedgerObject*)self)->ledger, ((PyDapHashFastObject*)h_fast)->hash_fast); return Py_BuildValue("O", res); } PyObject *dap_chain_ledger_tx_find_by_addr_py(PyObject *self, PyObject *args){ @@ -202,7 +202,7 @@ PyObject *dap_chain_ledger_tx_find_by_addr_py(PyObject *self, PyObject *args){ if (!PyArg_ParseTuple(args, "s|O|O", &token, &addr, &first_hash)) return NULL; PyObject *res = _PyObject_New(&DapChainDatumTx_DapChainDatumTxObjectType); - ((PyDapChainDatumTxObject*)res)->datum_tx = dap_chain_ledger_tx_find_by_addr(((PyDapChainLedgerObject*)self)->ledger, token, ((PyDapChainAddrObject*)addr)->addr, ((PyDapChainHashFastObject*)first_hash)->hash_fast); + ((PyDapChainDatumTxObject*)res)->datum_tx = dap_chain_ledger_tx_find_by_addr(((PyDapChainLedgerObject*)self)->ledger, token, ((PyDapChainAddrObject*)addr)->addr, ((PyDapHashFastObject*)first_hash)->hash_fast); return Py_BuildValue("O", res); } PyObject *dap_chain_ledger_tx_find_by_pkey_py(PyObject *self, PyObject *args){ @@ -212,7 +212,7 @@ PyObject *dap_chain_ledger_tx_find_by_pkey_py(PyObject *self, PyObject *args){ if (!PyArg_ParseTuple(args, "s|n|O", &p_key, &p_key_size, &obj_first_hash)) return NULL; PyObject *res = _PyObject_New(&DapChainDatumTx_DapChainDatumTxObjectType); - ((PyDapChainDatumTxObject*)res)->datum_tx = dap_chain_ledger_tx_find_by_pkey(((PyDapChainLedgerObject*)self)->ledger, p_key, p_key_size, ((PyDapChainHashFastObject*)obj_first_hash)->hash_fast); + ((PyDapChainDatumTxObject*)res)->datum_tx = dap_chain_ledger_tx_find_by_pkey(((PyDapChainLedgerObject*)self)->ledger, p_key, p_key_size, ((PyDapHashFastObject*)obj_first_hash)->hash_fast); return Py_BuildValue("O", res); } PyObject *dap_chain_ledger_tx_cache_find_out_cond_py(PyObject *self, PyObject *args){ @@ -221,7 +221,7 @@ PyObject *dap_chain_ledger_tx_cache_find_out_cond_py(PyObject *self, PyObject *a if (!PyArg_ParseTuple(args, "O|O", &obj_addr, &obj_first_hash)) return NULL; PyObject *res = _PyObject_New(&DapChainDatumTx_DapChainDatumTxObjectType); - ((PyDapChainDatumTxObject*)res)->datum_tx = dap_chain_ledger_tx_cache_find_out_cond(((PyDapChainLedgerObject*)self)->ledger, ((PyDapChainAddrObject*)obj_addr)->addr, ((PyDapChainHashFastObject*)obj_first_hash)->hash_fast); + ((PyDapChainDatumTxObject*)res)->datum_tx = dap_chain_ledger_tx_cache_find_out_cond(((PyDapChainLedgerObject*)self)->ledger, ((PyDapChainAddrObject*)obj_addr)->addr, ((PyDapHashFastObject*)obj_first_hash)->hash_fast); return Py_BuildValue("O", res); } PyObject *dap_chain_ledger_tx_cache_get_out_cond_value_py(PyObject *self, PyObject *args){ -- GitLab