adds id to return value of spend rpcs
This commit is contained in:
parent
180a24ec76
commit
44114d60f0
|
@ -201,12 +201,14 @@ class WalletRpcApi:
|
||||||
data = {
|
data = {
|
||||||
"status": "FAILED",
|
"status": "FAILED",
|
||||||
"reason": f"Failed to generate signed transaction. Error: {e}",
|
"reason": f"Failed to generate signed transaction. Error: {e}",
|
||||||
|
"id": wallet_id
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
if tx is None:
|
if tx is None:
|
||||||
data = {
|
data = {
|
||||||
"status": "FAILED",
|
"status": "FAILED",
|
||||||
"reason": "Failed to generate signed transaction",
|
"reason": "Failed to generate signed transaction",
|
||||||
|
"id": wallet_id
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
try:
|
try:
|
||||||
|
@ -215,6 +217,7 @@ class WalletRpcApi:
|
||||||
data = {
|
data = {
|
||||||
"status": "FAILED",
|
"status": "FAILED",
|
||||||
"reason": f"Failed to push transaction {e}",
|
"reason": f"Failed to push transaction {e}",
|
||||||
|
"id": wallet_id
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
sent = False
|
sent = False
|
||||||
|
@ -231,23 +234,24 @@ class WalletRpcApi:
|
||||||
continue
|
continue
|
||||||
status, err = sent_to[0][1], sent_to[0][2]
|
status, err = sent_to[0][1], sent_to[0][2]
|
||||||
if status == MempoolInclusionStatus.SUCCESS:
|
if status == MempoolInclusionStatus.SUCCESS:
|
||||||
data = {"status": "SUCCESS"}
|
data = {"status": "SUCCESS", "id": wallet_id}
|
||||||
sent = True
|
sent = True
|
||||||
break
|
break
|
||||||
elif status == MempoolInclusionStatus.PENDING:
|
elif status == MempoolInclusionStatus.PENDING:
|
||||||
assert err is not None
|
assert err is not None
|
||||||
data = {"status": "PENDING", "reason": err}
|
data = {"status": "PENDING", "reason": err, "id": wallet_id}
|
||||||
sent = True
|
sent = True
|
||||||
break
|
break
|
||||||
elif status == MempoolInclusionStatus.FAILED:
|
elif status == MempoolInclusionStatus.FAILED:
|
||||||
assert err is not None
|
assert err is not None
|
||||||
data = {"status": "FAILED", "reason": err}
|
data = {"status": "FAILED", "reason": err, "id": wallet_id}
|
||||||
sent = True
|
sent = True
|
||||||
break
|
break
|
||||||
if not sent:
|
if not sent:
|
||||||
data = {
|
data = {
|
||||||
"status": "FAILED",
|
"status": "FAILED",
|
||||||
"reason": "Timed out. Transaction may or may not have been sent.",
|
"reason": "Timed out. Transaction may or may not have been sent.",
|
||||||
|
"id": wallet_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
@ -432,6 +436,7 @@ class WalletRpcApi:
|
||||||
data = {
|
data = {
|
||||||
"status": "FAILED",
|
"status": "FAILED",
|
||||||
"reason": f"{e}",
|
"reason": f"{e}",
|
||||||
|
"id": wallet_id
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
@ -439,6 +444,7 @@ class WalletRpcApi:
|
||||||
data = {
|
data = {
|
||||||
"status": "FAILED",
|
"status": "FAILED",
|
||||||
"reason": "Failed to generate signed transaction",
|
"reason": "Failed to generate signed transaction",
|
||||||
|
"id": wallet_id
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
try:
|
try:
|
||||||
|
@ -464,23 +470,25 @@ class WalletRpcApi:
|
||||||
continue
|
continue
|
||||||
status, err = sent_to[0][1], sent_to[0][2]
|
status, err = sent_to[0][1], sent_to[0][2]
|
||||||
if status == MempoolInclusionStatus.SUCCESS:
|
if status == MempoolInclusionStatus.SUCCESS:
|
||||||
data = {"status": "SUCCESS"}
|
data = {"status": "SUCCESS",
|
||||||
|
"id": wallet_id}
|
||||||
sent = True
|
sent = True
|
||||||
break
|
break
|
||||||
elif status == MempoolInclusionStatus.PENDING:
|
elif status == MempoolInclusionStatus.PENDING:
|
||||||
assert err is not None
|
assert err is not None
|
||||||
data = {"status": "PENDING", "reason": err}
|
data = {"status": "PENDING", "reason": err, "id": wallet_id}
|
||||||
sent = True
|
sent = True
|
||||||
break
|
break
|
||||||
elif status == MempoolInclusionStatus.FAILED:
|
elif status == MempoolInclusionStatus.FAILED:
|
||||||
assert err is not None
|
assert err is not None
|
||||||
data = {"status": "FAILED", "reason": err}
|
data = {"status": "FAILED", "reason": err, "id": wallet_id}
|
||||||
sent = True
|
sent = True
|
||||||
break
|
break
|
||||||
if not sent:
|
if not sent:
|
||||||
data = {
|
data = {
|
||||||
"status": "FAILED",
|
"status": "FAILED",
|
||||||
"reason": "Timed out. Transaction may or may not have been sent.",
|
"reason": "Timed out. Transaction may or may not have been sent.",
|
||||||
|
"id": wallet_id
|
||||||
}
|
}
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
Loading…
Reference in New Issue