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. 16
      docs/api/wallet-rpc.yaml
  2. 13
      jmclient/jmclient/wallet_rpc.py

16
docs/api/wallet-rpc.yaml

@ -721,6 +721,14 @@ components:
type: boolean type: boolean
coinjoin_in_process: coinjoin_in_process:
type: boolean type: boolean
schedule:
type: array
items:
type: array
items:
oneOf:
- type: string
- type: integer
wallet_name: wallet_name:
type: string type: string
example: wallet.jmdat example: wallet.jmdat
@ -899,9 +907,11 @@ components:
schedule: schedule:
type: array type: array
items: items:
oneOf: type: array
- type: string items:
- type: integer oneOf:
- type: string
- type: integer
LockWalletResponse: LockWalletResponse:
type: object type: object
required: required:

13
jmclient/jmclient/wallet_rpc.py

@ -590,16 +590,27 @@ class JMWalletDaemon(Service):
session = not self.cookie==None session = not self.cookie==None
maker_running = self.coinjoin_state == CJ_MAKER_RUNNING maker_running = self.coinjoin_state == CJ_MAKER_RUNNING
coinjoin_in_process = self.coinjoin_state == CJ_TAKER_RUNNING coinjoin_in_process = self.coinjoin_state == CJ_TAKER_RUNNING
schedule = None
if self.services["wallet"]: if self.services["wallet"]:
if self.services["wallet"].isRunning(): if self.services["wallet"].isRunning():
wallet_name = self.wallet_name 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: else:
wallet_name = "not yet loaded" wallet_name = "not yet loaded"
else: else:
wallet_name = "None" wallet_name = "None"
return make_jmwalletd_response(request,session=session, return make_jmwalletd_response(request,session=session,
maker_running=maker_running, maker_running=maker_running,
coinjoin_in_process=coinjoin_in_process, coinjoin_in_process=coinjoin_in_process,
schedule=schedule,
wallet_name=wallet_name) wallet_name=wallet_name)
@app.route('/wallet/<string:walletname>/taker/direct-send', methods=['POST']) @app.route('/wallet/<string:walletname>/taker/direct-send', methods=['POST'])
@ -1133,7 +1144,7 @@ class JMWalletDaemon(Service):
self.check_cookie(request) self.check_cookie(request)
if self.coinjoin_state is not CJ_NOT_RUNNING or self.tumbler_options is not None: 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) return make_jmwalletd_response(request, status=409)
if not self.services["wallet"]: if not self.services["wallet"]:

Loading…
Cancel
Save