commit af6eedf87e29e4c5c59586a6dcc3bce1c015405e parent 8527901e6c5b12a1bd06f1d9f231196c9c736f72 Author: lash <dev@holbrook.no> Date: Wed, 30 Mar 2022 08:13:34 +0000 Set defaults for common name and sum in filter Diffstat:
M | chainsyncer/filter.py | | | 18 | +++++++++++++----- |
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/chainsyncer/filter.py b/chainsyncer/filter.py @@ -1,12 +1,20 @@ -class SyncFilter: +# standard imports +import hashlib - def common_name(self): - raise NotImplementedError() +class SyncFilter: def sum(self): - raise NotImplementedError() - + s = self.common_name() + h = hashlib.sha256() + h.update(s.encode('utf-8')) + return h.digest() + def filter(self, conn, block, tx): raise NotImplementedError() + + + def common_name(self): + s = self.__module__ + '.' + self.__class__.__name__ + return s.replace('.', '_')