Don't cache truncated dag hash for spec (#2048)
If Spec.dag_hash was called for the first time with a 'length' specified, the cached hash was truncated. This ensures that the full hash is cached.
This commit is contained in:
parent
0a3cc5e8e3
commit
8111a4bb9d
1 changed files with 2 additions and 2 deletions
|
@ -974,10 +974,10 @@ def dag_hash(self, length=None):
|
|||
yaml_text = syaml.dump(
|
||||
self.to_node_dict(), default_flow_style=True, width=maxint)
|
||||
sha = hashlib.sha1(yaml_text)
|
||||
b32_hash = base64.b32encode(sha.digest()).lower()[:length]
|
||||
b32_hash = base64.b32encode(sha.digest()).lower()
|
||||
if self.concrete:
|
||||
self._hash = b32_hash
|
||||
return b32_hash
|
||||
return b32_hash[:length]
|
||||
|
||||
def dag_hash_bit_prefix(self, bits):
|
||||
"""Get the first <bits> bits of the DAG hash as an integer type."""
|
||||
|
|
Loading…
Reference in a new issue