Django Broken pipe-Errno 32 Ошибка Broken pipe как ее исправить?
У меня есть страница с несколькими приемами монет
.
У меня есть в models.py
def updatedeposit(self, dp):
if dp.coin == Coins.BTC:
return self.updatedeposit_btc(dp)
elif dp.coin == Coins.XMR:
return self.updatedeposit_xmr(dp)
elif dp.coin == Coins.LC:
return self.updatedeposit_ltc(dp)
else:
raise WalletException('No such deposit option')
def updatedeposit_btc(self, dp):
if dp.wallet != self:
raise WalletException("Can't update a deposit created by another wallet")
if dp.status not in STATUS_TO_UPDATE:
return dp
try:
address = self.bitcoind.validate(dp.recv_address)
except:
raise WalletException("Invalid BTC address")
try:
unconf_amount = self.bitcoind.unconf_by_addr(address)
conf_amount = self.bitcoind.conf_by_addr(address)
except:
raise WalletException('Bitcoind error')
if unconf_amount > conf_amount:
dp.status = Status.UNCONFIRMED
dp.sats_amount = unconf_amount
dp.save()
return dp
if conf_amount == 0:
delta = timedelta(minutes=settings.DEPOSIT_EXPIRATION)
if dp.date < timezone.now() - delta:
dp.status = Status.EXPIRED
dp.save()
return dp
delta = timedelta(minutes=settings.DEPOSIT_EXPIRATION+40)
if dp.date < timezone.now() - delta:
dp.status = Status.CANCELLED
dp.save()
return dp
dp.status = Status.WAITING
dp.sats_amount = 0
dp.save()
return dp
и в настройках bitcoin core fille bitcoind.py
def create_address(self):
return self.proxy.getnewaddress(account=self.ACC)
def unconf_by_addr(self, addr):
return self.proxy.getreceivedbyaddress(addr, minconf=0)
мне удалось создать новый адрес btc из кошелька bitcoin-core на странице, но когда страница обновляется, чтобы проверить, есть ли новая транзакция, я получаю эту 2 ошибку
first
Django Version: 3.2.6
Python Version: 3.7.3
Installed Applications:
['django.contrib.admin.apps.SimpleAdminConfig',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'captcha',
'django_countries',
'django_filters',
'crispy_forms',
'mptt',
'core',
'wallet',
'market',
'support']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'core.middleware.last_visit_middleware']
Traceback (most recent call last):
File "./wallet/models.py", line 237, in updatedeposit_btc
unconf_amount = self.bitcoind.unconf_by_addr(address)
File "./wallet/bitcoind.py", line 69, in unconf_by_addr
return self.proxy.getreceivedbyaddress(addr, minconf=0)
File "/usr/local/lib/python3.7/dist-packages/bitcoin/rpc.py", line 600, in getreceivedbyaddress
r = self._call('getreceivedbyaddress', str(addr), minconf)
File "/usr/local/lib/python3.7/dist-packages/bitcoin/rpc.py", line 231, in _call
self.__conn.request('POST', self.__url.path, postdata, headers)
File "/usr/lib/python3.7/http/client.py", line 1260, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.7/http/client.py", line 1271, in _send_request
self.putrequest(method, url, **skips)
File "/usr/lib/python3.7/http/client.py", line 1112, in putrequest
raise CannotSendRequest(self.__state)
During handling of the above exception (Request-sent), another exception occurred:
File "/usr/local/lib/python3.7/dist-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/usr/local/lib/python3.7/dist-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python3.7/dist-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
return view_func(request, *args, **kwargs)
File "./wallet/views.py", line 106, in deposit
dp = request.user.wallet.updatedeposit(dp)
File "./wallet/models.py", line 217, in updatedeposit
return self.updatedeposit_btc(dp)
File "./wallet/models.py", line 240, in updatedeposit_btc
raise WalletException('Bitcoind error')
Exception Type: WalletException at /wallet/deposit/33/
Exception Value: Bitcoind error
чем через некоторое время
Traceback (most recent call last):
File "./wallet/models.py", line 237, in updatedeposit_btc
unconf_amount = self.bitcoind.unconf_by_addr(address)
File "./wallet/bitcoind.py", line 69, in unconf_by_addr
return self.proxy.getreceivedbyaddress(addr, minconf=0)
File "/usr/local/lib/python3.7/dist-packages/bitcoin/rpc.py", line 600, in getreceivedbyaddress
r = self._call('getreceivedbyaddress', str(addr), minconf)
File "/usr/local/lib/python3.7/dist-packages/bitcoin/rpc.py", line 231, in _call
self.__conn.request('POST', self.__url.path, postdata, headers)
File "/usr/lib/python3.7/http/client.py", line 1260, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.7/http/client.py", line 1306, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.7/http/client.py", line 1255, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.7/http/client.py", line 1069, in _send_output
self.send(chunk)
File "/usr/lib/python3.7/http/client.py", line 991, in send
self.sock.sendall(data)
During handling of the above exception ([Errno 32] Broken pipe), another exception occurred:
File "/usr/local/lib/python3.7/dist-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/usr/local/lib/python3.7/dist-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python3.7/dist-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
return view_func(request, *args, **kwargs)
File "./wallet/views.py", line 106, in deposit
dp = request.user.wallet.updatedeposit(dp)
File "./wallet/models.py", line 217, in updatedeposit
return self.updatedeposit_btc(dp)
File "./wallet/models.py", line 240, in updatedeposit_btc
raise WalletException('Bitcoind error')
Exception Type: WalletException at /wallet/deposit/33/
Exception Value: Bitcoind error
что я должен сделать, чтобы исправить эту ошибку