Browse Source

set timeout to 30s for synchronous operations

283 2.6.3
ThomasV 9 years ago
parent
commit
753a28b452
  1. 2
      lib/commands.py
  2. 4
      lib/network.py

2
lib/commands.py

@ -231,7 +231,7 @@ class Commands:
return tx.deserialize() return tx.deserialize()
@command('n') @command('n')
def broadcast(self, tx, timeout=10): def broadcast(self, tx, timeout=30):
"""Broadcast a transaction to the network. """ """Broadcast a transaction to the network. """
return self.network.broadcast(tx, timeout) return self.network.broadcast(tx, timeout)

4
lib/network.py

@ -821,7 +821,7 @@ class Network(util.DaemonThread):
def get_local_height(self): def get_local_height(self):
return self.blockchain.height() return self.blockchain.height()
def synchronous_get(self, request, timeout=100000000): def synchronous_get(self, request, timeout=30):
queue = Queue.Queue() queue = Queue.Queue()
self.send([request], queue.put) self.send([request], queue.put)
try: try:
@ -832,7 +832,7 @@ class Network(util.DaemonThread):
raise BaseException(r.get('error')) raise BaseException(r.get('error'))
return r.get('result') return r.get('result')
def broadcast(self, tx, timeout=10): def broadcast(self, tx, timeout=30):
tx_hash = tx.hash() tx_hash = tx.hash()
try: try:
out = self.synchronous_get(('blockchain.transaction.broadcast', [str(tx)]), timeout) out = self.synchronous_get(('blockchain.transaction.broadcast', [str(tx)]), timeout)

Loading…
Cancel
Save