Generalize the way to setup the server to use Litecoin.
[electrum-server.git] / server.py
index 1111521..bfbeecd 100755 (executable)
--- a/server.py
+++ b/server.py
@@ -21,6 +21,10 @@ import ConfigParser
 import logging
 logging.basicConfig()
 
+if sys.maxsize <= 2**32:
+    print "Warning: it looks like you are using a 32bit system. You may experience crashes caused by mmap"
+
+
 def attempt_read_config(config, filename):
     try:
         with open(filename, 'r') as f:
@@ -39,9 +43,12 @@ def create_config():
     config.set('server', 'password', '')
     config.set('server', 'irc', 'yes')
     config.set('server', 'irc_nick', '')
+    config.set('server', 'coin', '')
+    config.set('server', 'datadir', '')
     config.add_section('database')
     config.set('database', 'type', 'psycopg2')
     config.set('database', 'database', 'abe')
+    config.set('database', 'limit', '1000')
     config.set('server', 'backend', 'abe')
 
     for path in ('/etc/', ''):
@@ -70,8 +77,8 @@ def run_rpc_command(command, stratum_tcp_port):
         if msg.find('\n') != -1: break
     s.close()
     r = json.loads(msg).get('result')
-    if command == 'stop': print r
-    elif command == 'info': 
+
+    if command == 'info': 
         now = time.time()
         print 'type           address   sub  version  time' 
         for item in r:
@@ -80,6 +87,8 @@ def run_rpc_command(command, stratum_tcp_port):
                                                   item.get('subscriptions'), 
                                                   item.get('version'), 
                                                   (now - item.get('time')) )
+    else:
+        print r
 
 if __name__ == '__main__':
     config = create_config()
@@ -103,6 +112,8 @@ if __name__ == '__main__':
         sys.stderr.write("Unknown backend '%s' specified\n" % backend_name)
         raise
 
+    print "Starting Electrum server on", host
+
     # Create hub
     dispatcher = Dispatcher()
     shared = dispatcher.shared
@@ -129,7 +140,6 @@ if __name__ == '__main__':
     for server in transports:
         server.start()
 
-    print "Starting Electrum server on", host
     while not shared.stopped():
         time.sleep(1)
     print "Server stopped"