Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sakia
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
clients
python
sakia
Commits
f39a5c63
Commit
f39a5c63
authored
9 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Handle errors when connecting to first node
parent
dd8c5093
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/sakia/core/txhistory.py
+10
-3
10 additions, 3 deletions
src/sakia/core/txhistory.py
src/sakia/gui/process_cfg_community.py
+9
-6
9 additions, 6 deletions
src/sakia/gui/process_cfg_community.py
with
19 additions
and
9 deletions
src/sakia/core/txhistory.py
+
10
−
3
View file @
f39a5c63
...
...
@@ -61,9 +61,16 @@ class TxHistory():
data_sources
.
append
(
s
)
data_dividends
=
[]
for
d
in
self
.
_dividends
.
copy
():
d
[
'
state
'
]
=
d
[
'
state
'
].
name
data_dividends
.
append
(
d
)
for
d
in
self
.
_dividends
:
dividend
=
{
'
block_number
'
:
d
[
'
block_number
'
],
"
consumed
"
:
d
[
'
consumed
'
],
'
time
'
:
d
[
'
time
'
],
'
amount
'
:
d
[
'
amount
'
],
'
base
'
:
d
[
'
base
'
],
'
state
'
:
d
[
'
state
'
].
name
}
data_dividends
.
append
(
dividend
)
return
{
'
latest_block
'
:
self
.
latest_block
,
'
transfers
'
:
data_transfer
,
...
...
This diff is collapsed.
Click to expand it.
src/sakia/gui/process_cfg_community.py
+
9
−
6
View file @
f39a5c63
...
...
@@ -8,6 +8,7 @@ import logging
import
asyncio
import
aiohttp
from
ucoinpy.api.bma
import
UcoinError
from
ucoinpy.documents
import
MalformedDocumentError
from
PyQt5.QtWidgets
import
QDialog
,
QMenu
,
QApplication
from
PyQt5.QtGui
import
QCursor
...
...
@@ -20,6 +21,7 @@ from ..core.net import Node
from
.widgets
import
toast
from
.widgets.dialogs
import
QAsyncMessageBox
from
..tools.decorators
import
asyncify
from
..tools.exceptions
import
NoPeerAvailable
class
Step
(
QObject
):
...
...
@@ -111,7 +113,8 @@ Yours : {0}, the network : {1}""".format(registered[1], registered[2])))
port
=
self
.
config_dialog
.
spinbox_port
.
value
()
logging
.
debug
(
"
Is valid ?
"
)
try
:
self
.
node
=
await
Node
.
from_address
(
None
,
server
,
port
,
session
=
aiohttp
.
ClientSession
())
session
=
aiohttp
.
ClientSession
()
self
.
node
=
await
Node
.
from_address
(
None
,
server
,
port
,
session
=
session
)
community
=
Community
.
create
(
self
.
node
)
self
.
config_dialog
.
button_connect
.
setEnabled
(
False
)
self
.
config_dialog
.
button_register
.
setEnabled
(
False
)
...
...
@@ -141,12 +144,12 @@ Yours : {0}, the network : {1}""".format(registered[1], registered[2])))
Yours : {0}, the network : {1}
"""
.
format
(
registered
[
1
],
registered
[
2
])))
else
:
self
.
config_dialog
.
label_error
.
setText
(
self
.
tr
(
"
Your account already exists on the network
"
))
except
aiohttp
.
errors
.
DisconnectedError
as
e
:
self
.
config_dialog
.
label_error
.
setText
(
str
(
e
))
except
aiohttp
.
errors
.
ClientError
as
e
:
except
(
MalformedDocumentError
,
ValueError
,
UcoinError
,
aiohttp
.
errors
.
ClientError
,
aiohttp
.
errors
.
DisconnectedError
)
as
e
:
session
.
close
()
self
.
config_dialog
.
label_error
.
setText
(
str
(
e
))
#
except
(MalformedDocumentError, ValueError) as
e:
#
self.config_dialog.label_error.setText(s
tr(e
))
except
NoPeerAvailabl
e
:
self
.
config_dialog
.
label_error
.
setText
(
s
elf
.
tr
(
"
Could not connect. Check node peering entry
"
))
def
is_valid
(
self
):
return
self
.
node
is
not
None
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment