Browse Source

Clarify peername() logic

master
Neil Booth 8 years ago
parent
commit
83674b1b7b
  1. 12
      server/protocol.py

12
server/protocol.py

@ -244,12 +244,12 @@ class Session(JSONRPC):
self.manager.add_task(self, request) self.manager.add_task(self, request)
def peername(self, *, for_log=True): def peername(self, *, for_log=True):
# Anonymi{z, s}e all IP addresses that will be stored in a log if not self.peer_info:
if for_log and self.env.anon_logs and self.peer_info: return 'unknown'
info = ["XX.XX.XX.XX", "XX"] # Anonymize IP addresses that will be logged
else: if for_log and self.env.anon_logs:
info = self.peer_info return 'xx.xx.xx.xx:xx'
return 'unknown' if not info else '{}:{}'.format(info[0], info[1]) return '{}:{}'.format(self.peer_info[0], self.peer_info[1])
def tx_hash_from_param(self, param): def tx_hash_from_param(self, param):
'''Raise an RPCError if the parameter is not a valid transaction '''Raise an RPCError if the parameter is not a valid transaction

Loading…
Cancel
Save