Skip to content

Commit

Permalink
Namecoin: Minimize single IPv4 to string
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyRand committed Dec 12, 2019
1 parent 29a7aea commit 54b41bb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions electrum_nmc/electrum/names.py
Original file line number Diff line number Diff line change
Expand Up @@ -1060,9 +1060,17 @@ def add_domain_record_address_ip4(value, data):
if "ip" not in value:
value["ip"] = []

# Make sure the field is an array
if type(value["ip"]) == str:
value["ip"] = [value["ip"]]

# Add the record
value["ip"].append(data)

# Minimize to string form if possible
if len(value["ip"]) == 1:
value["ip"] = value["ip"][0]

def add_domain_record_address_ip6(value, data):
# Make sure the field exists
if "ip6" not in value:
Expand Down

0 comments on commit 54b41bb

Please sign in to comment.