(cls, filename)
| 50 | |
| 51 | @classmethod |
| 52 | def load_cache(cls, filename): |
| 53 | disk_cache = json.loads(open(filename, 'r').read()) |
| 54 | for k, raw_hex in disk_cache.items(): |
| 55 | raw = bytes.fromhex(raw_hex) |
| 56 | if raw[4] == 0: |
| 57 | raw = raw[:4] + raw[6:] |
| 58 | tx = Tx.parse(BytesIO(raw)) |
| 59 | tx.locktime = little_endian_to_int(raw[-4:]) |
| 60 | else: |
| 61 | tx = Tx.parse(BytesIO(raw)) |
| 62 | cls.cache[k] = tx |
| 63 | |
| 64 | @classmethod |
| 65 | def dump_cache(cls, filename): |
no test coverage detected