diff options
Diffstat (limited to 'scripts/prove-utxo.py')
| -rw-r--r-- | scripts/prove-utxo.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/scripts/prove-utxo.py b/scripts/prove-utxo.py index 9f2704b..105e677 100644 --- a/scripts/prove-utxo.py +++ b/scripts/prove-utxo.py | |||
| @@ -14,7 +14,6 @@ from pathlib import Path | |||
| 14 | import bitflash_chain as chain | 14 | import bitflash_chain as chain |
| 15 | 15 | ||
| 16 | SCHEMA = "bitflash-utxo-inclusion-proof-1" | 16 | SCHEMA = "bitflash-utxo-inclusion-proof-1" |
| 17 | NODE_DOMAIN = b"BTFNODE1|" | ||
| 18 | 17 | ||
| 19 | 18 | ||
| 20 | def canonical_bytes(obj): | 19 | def canonical_bytes(obj): |
| @@ -61,7 +60,7 @@ def build_merkle_proof(keys, leaf_hashes, index): | |||
| 61 | for i in range(0, len(layer), 2): | 60 | for i in range(0, len(layer), 2): |
| 62 | left = layer[i] | 61 | left = layer[i] |
| 63 | right = layer[i + 1] if i + 1 < len(layer) else left | 62 | right = layer[i + 1] if i + 1 < len(layer) else left |
| 64 | next_layer.append(hashlib.sha256(NODE_DOMAIN + left + right).digest()) | 63 | next_layer.append(hashlib.sha256(chain.UTXO_NODE_DOMAIN + left + right).digest()) |
| 65 | layer = next_layer | 64 | layer = next_layer |
| 66 | current_index //= 2 | 65 | current_index //= 2 |
| 67 | level += 1 | 66 | level += 1 |
| @@ -106,8 +105,8 @@ def build_proof(args): | |||
| 106 | }, | 105 | }, |
| 107 | "commitment": { | 106 | "commitment": { |
| 108 | "algorithm": "sorted-outpoint-merkle-sha256", | 107 | "algorithm": "sorted-outpoint-merkle-sha256", |
| 109 | "leaf_domain": "BTFUTXO1", | 108 | "leaf_domain": chain.UTXO_LEAF_DOMAIN, |
| 110 | "node_domain": "BTFNODE1", | 109 | "node_domain": chain.UTXO_NODE_DOMAIN_TAG, |
| 111 | "root": root, | 110 | "root": root, |
| 112 | "leaf_count": len(keys), | 111 | "leaf_count": len(keys), |
| 113 | }, | 112 | }, |