Fix comment parsing; Comment is optionnal
This commit is contained in:
parent
925da50f64
commit
516ee8e69f
9
pay.py
9
pay.py
|
@ -20,7 +20,10 @@ client = Client(transport=transport, fetch_schema_from_transport=True)
|
|||
|
||||
recipient = sys.argv[1]
|
||||
amount = int(sys.argv[2])
|
||||
comment = sys.argv[3]
|
||||
if len(sys.argv) > 3:
|
||||
comment = sys.argv[3]
|
||||
else:
|
||||
comment = ""
|
||||
|
||||
## GraphQL queries
|
||||
# Build the TX Document
|
||||
|
@ -52,7 +55,7 @@ except Exception as e:
|
|||
|
||||
# Check document
|
||||
|
||||
#print(txDoc) # For debug
|
||||
# print(txDoc) # For debug
|
||||
|
||||
docList = txDoc.splitlines()
|
||||
for i, line in enumerate(docList):
|
||||
|
@ -63,7 +66,7 @@ for i, line in enumerate(docList):
|
|||
outAmount = outputRaw[0]
|
||||
outPubkey = outputRaw[2].split("SIG(")[1].replace(')','')
|
||||
if re.search("Comment:", line):
|
||||
commentRaw = line.split(': ')[-1]
|
||||
commentRaw = line.split(': ', 1)[1]
|
||||
|
||||
if issuerRaw != issuer or int(outAmount) != amount or outPubkey != recipient or commentRaw != comment:
|
||||
sys.stderr.write(colored("Le document généré est corrompu !\nNe fait plus confiance au noeud " + node + "\n", 'red'))
|
||||
|
|
Reference in New Issue