pylibswarm

Python3 wrapper for libswarm-ng
git clone git://git.defalsify.org/pylibswarm.git
Log | Files | Refs | Submodules | README | LICENSE

commit 4ff6099dfb27b8772896e84214036eec2d2318d4
parent ab0f1307d833835c2c98ef60648e0f0057415e86
Author: nolash <dev@holbrook.no>
Date:   Fri,  1 Oct 2021 15:23:05 +0200

Fix no outtputter case in soc cli, span in callback

Diffstat:
MREADME | 4++--
Mrequirements.txt | 1+
Msrc/python_swarm.c | 2+-
Mswarm/runnable/soc.py | 8+++++---
4 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/README b/README @@ -5,14 +5,14 @@ $ git submodule update --init --recursive Build: -$ python setup.py build +$ python setup.py build -f Try it out: $ virtualenv .venv $ . .venv/bin/activate -$ python setup.py install +$ python setup.py install -f # pass some data to the BMT hasher: $ python pylibswarm/runnable/bmt.py foo diff --git a/requirements.txt b/requirements.txt @@ -1,2 +1,3 @@ crypto-dev-signer>=0.4.15rc1,<0.5.0 chainlib-eth>=0.0.9a14,<0.1.0 +hexathon>=0.0.1a8 diff --git a/src/python_swarm.c b/src/python_swarm.c @@ -206,7 +206,7 @@ static PyObject* method_soc_create(PyObject *self, PyObject *args) { } if (client_callback != NULL) { -// client_callback_do(soc_hash, soc_serialized, input_length, client_callback); + client_callback_do(soc_hash, soc_serialized, input_length, client_callback); } return Py_BuildValue("y#y#y#", chunk.signature, SWARM_SIGNATURE_SIZE, soc_hash, SWARM_WORD_SIZE, soc_serialized, input_length); diff --git a/swarm/runnable/soc.py b/swarm/runnable/soc.py @@ -117,6 +117,8 @@ if largs.o: outputter = Outputter(largs.o, prepend_hash=largs.prepend_hash) +def outputter_noop(*args, **kwargs): + pass def main(): soc_topic_bytes = bytes.fromhex(soc_topic) @@ -124,8 +126,8 @@ def main(): out_data = None import swarm - #soc_identifier_bytes = swarm.soc_identifier(soc_topic_bytes, soc_index_bytes) - soc_identifier_bytes = bytes(32) + soc_identifier_bytes = swarm.soc_identifier(soc_topic_bytes, soc_index_bytes) + #soc_identifier_bytes = bytes(32) logg.info('generated identifier {}'.format(soc_identifier_bytes.hex())) if largs.id: out_data = soc_identifier_bytes @@ -151,7 +153,7 @@ def main(): input_data_length, data_length, keystore.sign, - None, + outputter_noop, ) #logg.debug('signature {}'.format(soc_sig.hex()))