Skip to content

Commit

Permalink
improved check
Browse files Browse the repository at this point in the history
  • Loading branch information
fametrano committed Nov 10, 2020
1 parent c845d6f commit c399670
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions btclib/psbt.py
Expand Up @@ -240,7 +240,7 @@ def get_unknown(self, key: String) -> bytes:


def deserialize_map(data: bytes) -> Tuple[Dict[bytes, bytes], bytes]:
assert len(data) != 0, "Malformed psbt: at least a map is missing"
assert len(data) != 0, "malformed psbt: at least a map is missing"
partial_map: Dict[bytes, bytes] = {}
while True:
if data[0] == 0:
Expand All @@ -254,7 +254,7 @@ def deserialize_map(data: bytes) -> Tuple[Dict[bytes, bytes], bytes]:
data = data[len(varint.encode(value_len)) :]
value = data[:value_len]
data = data[value_len:]
assert key not in partial_map.keys(), "Malformed psbt: duplicate keys"
assert key not in partial_map, f"duplicated psbt map: {key.hex()}"
partial_map[key] = value


Expand Down

0 comments on commit c399670

Please sign in to comment.