Beispiel #1
0
 def address_to_hashX(self, address):
     try:
         return self.coin.address_to_hashX(address)
     except Exception:
         pass
     raise RPCError('{} is not a valid address'.format(address))
 async def daemon_request(self, method, *args):
     '''Catch a DaemonError and convert it to an RPCError.'''
     try:
         return await getattr(self.daemon, method)(*args)
     except DaemonError as e:
         raise RPCError('daemon error: {}'.format(e))
Beispiel #3
0
 async def address_get_proof(self, address):
     '''Return the UTXO proof of an address.'''
     hashX = self.address_to_hashX(address)
     raise RPCError('address.get_proof is not yet implemented')
 def assert_boolean(self, value):
     '''Return param value it is boolean otherwise raise an RPCError.'''
     if value in (False, True):
         return value
     raise RPCError('{} should be a boolean value'.format(value))
 def raw_header(self, height):
     '''Return the binary header at the given height.'''
     header, n = self.bp.read_headers(height, 1)
     if n != 1:
         raise RPCError('height {:,d} out of range'.format(height))
     return header