Browse Source

Merge #1307: rpc-api: scheduler status flag in session

190d56e fix: update schedule type in API docs (Daniel)
57d1476 fix: remove redundant else branch (Daniel)
2cb41fc review: reaqd schedule from taker object (Daniel)
521189a fix: add auth check (Daniel)
ab2803e fix: include schedule in session instead of status flag (Daniel)
12bcbe1 docs: add flag to session response spec (Daniel)
cde5cfb feat: scheduler status flag in session (Daniel)
master
Adam Gibson 3 years ago
parent
commit
32a4ac5b82
No known key found for this signature in database
GPG Key ID: 141001A1AF77F20B
  1. 10
      docs/api/wallet-rpc.yaml
  2. 13
      jmclient/jmclient/wallet_rpc.py

10
docs/api/wallet-rpc.yaml

@ -721,6 +721,14 @@ components:
type: boolean
coinjoin_in_process:
type: boolean
schedule:
type: array
items:
type: array
items:
oneOf:
- type: string
- type: integer
wallet_name:
type: string
example: wallet.jmdat
@ -897,6 +905,8 @@ components:
- schedule
properties:
schedule:
type: array
items:
type: array
items:
oneOf:

13
jmclient/jmclient/wallet_rpc.py

@ -590,16 +590,27 @@ class JMWalletDaemon(Service):
session = not self.cookie==None
maker_running = self.coinjoin_state == CJ_MAKER_RUNNING
coinjoin_in_process = self.coinjoin_state == CJ_TAKER_RUNNING
schedule = None
if self.services["wallet"]:
if self.services["wallet"].isRunning():
wallet_name = self.wallet_name
if self.coinjoin_state == CJ_TAKER_RUNNING and self.tumbler_options is not None:
auth_header = request.getHeader('Authorization')
if auth_header is not None:
# At this point if an `auth_header` is present, it has been checked
# by the call to `check_cookie_if_present` above.
if self.taker is not None and not self.taker.aborted:
schedule = self.taker.schedule
else:
wallet_name = "not yet loaded"
else:
wallet_name = "None"
return make_jmwalletd_response(request,session=session,
maker_running=maker_running,
coinjoin_in_process=coinjoin_in_process,
schedule=schedule,
wallet_name=wallet_name)
@app.route('/wallet/<string:walletname>/taker/direct-send', methods=['POST'])
@ -1133,7 +1144,7 @@ class JMWalletDaemon(Service):
self.check_cookie(request)
if self.coinjoin_state is not CJ_NOT_RUNNING or self.tumbler_options is not None:
# Tumbler or taker seems to be running already.
# Tumbler, taker, or maker seems to be running already.
return make_jmwalletd_response(request, status=409)
if not self.services["wallet"]:

Loading…
Cancel
Save