Correct db names and ports
This commit is contained in:
@@ -35,6 +35,10 @@ def unpack_signed_raw_tx(tx_raw_bytes, chain_id):
|
||||
if chain_id != 0:
|
||||
v = int.from_bytes(d[6], 'big')
|
||||
vb = v - (chain_id * 2) - 35
|
||||
while len(d[7]) < 32:
|
||||
d[7] = b'\x00' + d[7]
|
||||
while len(d[8]) < 32:
|
||||
d[8] = b'\x00' + d[8]
|
||||
s = b''.join([d[7], d[8], bytes([vb])])
|
||||
so = KeyAPI.Signature(signature_bytes=s)
|
||||
|
||||
|
||||
@@ -557,27 +557,26 @@ def get_upcoming_tx(status=StatusEnum.READYSEND, recipient=None, before=None, ch
|
||||
:rtype: dict, with transaction hash as key, signed raw transaction as value
|
||||
"""
|
||||
session = SessionBase.create_session()
|
||||
q = session.query(
|
||||
q_outer = session.query(
|
||||
TxCache.sender,
|
||||
func.min(Otx.nonce).label('nonce'),
|
||||
)
|
||||
q = q.join(TxCache)
|
||||
q = q.join(Lock, isouter=True)
|
||||
q = q.filter(or_(Lock.flags==None, Lock.flags.op('&')(LockEnum.SEND.value)==0))
|
||||
q_outer = q_outer.join(TxCache)
|
||||
q_outer = q_outer.join(Lock, isouter=True)
|
||||
q_outer = q_outer.filter(or_(Lock.flags==None, Lock.flags.op('&')(LockEnum.SEND.value)==0))
|
||||
|
||||
if status >= StatusEnum.SENT:
|
||||
raise ValueError('not a valid non-final tx value: {}'.format(s))
|
||||
q = q.filter(Otx.status==status)
|
||||
q_outer = q_outer.filter(Otx.status==status.value)
|
||||
|
||||
if recipient != None:
|
||||
q = q.filter(TxCache.recipient==recipient)
|
||||
q_outer = q_outer.filter(TxCache.recipient==recipient)
|
||||
|
||||
q = q.group_by(TxCache.sender)
|
||||
q_outer = q_outer.group_by(TxCache.sender)
|
||||
|
||||
txs = {}
|
||||
|
||||
results = q.all()
|
||||
for r in results:
|
||||
for r in q_outer.all():
|
||||
q = session.query(Otx)
|
||||
q = q.join(TxCache)
|
||||
q = q.filter(TxCache.sender==r.sender)
|
||||
@@ -587,7 +586,6 @@ def get_upcoming_tx(status=StatusEnum.READYSEND, recipient=None, before=None, ch
|
||||
q = q.filter(TxCache.date_checked<before)
|
||||
|
||||
q = q.order_by(TxCache.date_created.desc())
|
||||
|
||||
o = q.first()
|
||||
|
||||
# TODO: audit; should this be possible if a row is found in the initial query? If not, at a minimum log error.
|
||||
@@ -602,7 +600,6 @@ def get_upcoming_tx(status=StatusEnum.READYSEND, recipient=None, before=None, ch
|
||||
q = q.filter(TxCache.otx_id==o.id)
|
||||
o = q.first()
|
||||
|
||||
logg.debug('oooo {}'.format(o))
|
||||
o.date_checked = datetime.datetime.now()
|
||||
session.add(o)
|
||||
session.commit()
|
||||
|
||||
@@ -68,7 +68,7 @@ app = celery.Celery(backend=config.get('CELERY_RESULT_URL'), broker=config.get(
|
||||
queue = args.q
|
||||
|
||||
dsn = dsn_from_config(config)
|
||||
SessionBase.connect(dsn)
|
||||
SessionBase.connect(dsn, debug=config.true('DATABASE_DEBUG'))
|
||||
|
||||
|
||||
re_websocket = re.compile('^wss?://')
|
||||
|
||||
Reference in New Issue
Block a user