commit e55e11faaf793f3bf8dd13e19a9aafa08712aef0
parent 151c736804f58f94af5ee49557b65ce49893d14a
Author: nolash <dev@holbrook.no>
Date: Sat, 10 Apr 2021 22:19:28 +0200
Remove commented code, var for buffer size
Diffstat:
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/rlpstream/encode.py b/rlpstream/encode.py
@@ -6,18 +6,16 @@ import ctypes.util
logg = logging.getLogger().getChild(__name__)
path_librlp = ctypes.util.find_library('rlp')
-#print(path_librlp)
librlp = ctypes.CDLL(path_librlp)
-#print(librlp)
-#print(dir(librlp))
LIBRLP_RLP_MAX_LIST_DEPTH = 1024
+RLP_BUFFER_SIZE = 1024
class RLPEncoderBackend(ctypes.Structure):
_fields_ = [
- ('buf', ctypes.POINTER(ctypes.c_char * 1024)),
+ ('buf', ctypes.POINTER(ctypes.c_char * RLP_BUFFER_SIZE)),
('depth', ctypes.c_int),
('list_ptr', ctypes.POINTER(ctypes.POINTER(ctypes.c_char) * LIBRLP_RLP_MAX_LIST_DEPTH)),
('ptr', ctypes.POINTER(ctypes.c_char)),
@@ -29,7 +27,7 @@ class RLPEncoder:
def __init__(self):
self.backend = RLPEncoderBackend()
self.encoder = ctypes.pointer(self.backend)
- librlp.rlp_init(self.encoder, 1024);
+ librlp.rlp_init(self.encoder, RLP_BUFFER_SIZE);
def __del__(self):