Add socket test missing warning
This commit is contained in:
@@ -8,6 +8,7 @@ from jsonrpc.exceptions import (
|
||||
JSONRPCParseError,
|
||||
JSONRPCInvalidParams,
|
||||
)
|
||||
from hexathon import add_0x
|
||||
|
||||
# local imports
|
||||
from crypto_dev_signer.eth.transaction import EIP155Transaction
|
||||
@@ -96,12 +97,11 @@ class SignRequestHandler:
|
||||
'raw': '0x' + raw_signed_tx.hex(),
|
||||
'tx': t.serialize(),
|
||||
}
|
||||
logg.debug('signed {}'.format(o))
|
||||
return o
|
||||
|
||||
|
||||
def eth_signTransaction(self, tx):
|
||||
o = personal_signTransaction([tx[0], ''])
|
||||
o = self.personal_signTransaction([tx[0], ''])
|
||||
return o['raw']
|
||||
|
||||
|
||||
@@ -111,5 +111,5 @@ class SignRequestHandler:
|
||||
if message_type != 'str':
|
||||
raise ValueError('invalid message format, must be {}, not {}'.format(message_type))
|
||||
z = self.signer.sign_ethereum_message(p[0], p[1][2:])
|
||||
return str(z)
|
||||
return add_0x(z.hex())
|
||||
|
||||
|
||||
@@ -11,24 +11,33 @@ from .handle import SignRequestHandler
|
||||
logg = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def start_server_socket(s):
|
||||
s.listen(10)
|
||||
logg.debug('server started')
|
||||
handler = SignRequestHandler()
|
||||
while True:
|
||||
(csock, caddr) = s.accept()
|
||||
class SocketHandler:
|
||||
|
||||
def __init__(self):
|
||||
self.handler = SignRequestHandler()
|
||||
|
||||
|
||||
def process(self, csock):
|
||||
d = csock.recv(4096)
|
||||
|
||||
r = None
|
||||
try:
|
||||
r = handler.handle_jsonrpc(d)
|
||||
r = self.handler.handle_jsonrpc(d)
|
||||
except SignerError as e:
|
||||
r = e.to_jsonrpc()
|
||||
|
||||
csock.send(r)
|
||||
|
||||
|
||||
def start_server_socket(s):
|
||||
s.listen(10)
|
||||
logg.debug('server started')
|
||||
handler = SocketHandler()
|
||||
while True:
|
||||
(csock, caddr) = s.accept()
|
||||
handler.process(csock)
|
||||
csock.close()
|
||||
s.close()
|
||||
|
||||
os.unlink(socket_path)
|
||||
|
||||
|
||||
|
||||
@@ -10,10 +10,8 @@ from urllib.parse import urlparse
|
||||
# external imports
|
||||
import confini
|
||||
from jsonrpc.exceptions import *
|
||||
from hexathon import add_0x
|
||||
|
||||
# local imports
|
||||
from crypto_dev_signer.cli.cmd import *
|
||||
from crypto_dev_signer.eth.signer import ReferenceSigner
|
||||
from crypto_dev_signer.keystore.reference import ReferenceKeystore
|
||||
from crypto_dev_signer.cli.handle import SignRequestHandler
|
||||
|
||||
Reference in New Issue
Block a user