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
fa9eb441
Commit
fa9eb441
authored
9 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Adding node summary (Issue
#133
)
parent
50dfd1a4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/ucoinpy/api/bma/__init__.py
+1
-1
1 addition, 1 deletion
lib/ucoinpy/api/bma/__init__.py
src/cutecoin/core/net/node.py
+43
-5
43 additions, 5 deletions
src/cutecoin/core/net/node.py
src/cutecoin/models/network.py
+6
-2
6 additions, 2 deletions
src/cutecoin/models/network.py
with
50 additions
and
8 deletions
lib/ucoinpy/api/bma/__init__.py
+
1
−
1
View file @
fa9eb441
...
...
@@ -141,4 +141,4 @@ class API(object):
for
leaf
in
root
[
'
leaves
'
][
begin
:
end
]:
yield
self
.
requests_get
(
path
,
leaf
=
leaf
).
json
()[
'
leaf
'
]
from
.
import
network
,
blockchain
,
tx
,
wot
from
.
import
network
,
blockchain
,
tx
,
wot
,
node
This diff is collapsed.
Click to expand it.
src/cutecoin/core/net/node.py
+
43
−
5
View file @
fa9eb441
...
...
@@ -36,7 +36,7 @@ class Node(QObject):
changed
=
pyqtSignal
()
def
__init__
(
self
,
currency
,
endpoints
,
uid
,
pubkey
,
block
,
state
,
last_change
):
state
,
last_change
,
software
,
version
):
'''
Constructor
'''
...
...
@@ -44,6 +44,8 @@ class Node(QObject):
self
.
_endpoints
=
endpoints
self
.
_uid
=
uid
self
.
_pubkey
=
pubkey
self
.
_software
=
software
self
.
_version
=
version
self
.
block
=
block
self
.
_state
=
state
self
.
_neighbours
=
[]
...
...
@@ -70,7 +72,7 @@ class Node(QObject):
raise
InvalidNodeCurrency
(
peer
.
currency
,
currency
)
node
=
cls
(
peer
.
currency
,
peer
.
endpoints
,
""
,
peer
.
pubkey
,
0
,
Node
.
ONLINE
,
time
.
time
())
Node
.
ONLINE
,
time
.
time
()
,
""
,
""
)
logging
.
debug
(
"
Node from address : {:}
"
.
format
(
str
(
node
)))
return
node
...
...
@@ -88,7 +90,7 @@ class Node(QObject):
raise
InvalidNodeCurrency
(
peer
.
currency
,
currency
)
node
=
cls
(
peer
.
currency
,
peer
.
endpoints
,
""
,
""
,
0
,
Node
.
ONLINE
,
time
.
time
())
Node
.
ONLINE
,
time
.
time
()
,
""
,
""
)
logging
.
debug
(
"
Node from peer : {:}
"
.
format
(
str
(
node
)))
return
node
...
...
@@ -100,6 +102,8 @@ class Node(QObject):
block
=
0
last_change
=
time
.
time
()
state
=
Node
.
ONLINE
software
=
''
version
=
''
logging
.
debug
(
data
)
for
endpoint_data
in
data
[
'
endpoints
'
]:
endpoints
.
append
(
Endpoint
.
from_inline
(
endpoint_data
))
...
...
@@ -124,8 +128,18 @@ class Node(QObject):
else
:
logging
.
debug
(
"
Error : no state in node
"
)
if
'
software
'
in
data
:
software
=
data
[
'
software
'
]
else
:
logging
.
debug
(
"
Error : no software in node
"
)
if
'
version
'
in
data
:
version
=
data
[
'
version
'
]
else
:
logging
.
debug
(
"
Error : no version in node
"
)
node
=
cls
(
currency
,
endpoints
,
uid
,
pubkey
,
block
,
state
,
last_change
)
state
,
last_change
,
software
,
version
)
logging
.
debug
(
"
Node from json : {:}
"
.
format
(
str
(
node
)))
return
node
...
...
@@ -147,7 +161,9 @@ class Node(QObject):
'
currency
'
:
self
.
_currency
,
'
state
'
:
self
.
_state
,
'
last_change
'
:
self
.
_last_change
,
'
block
'
:
self
.
block
}
'
block
'
:
self
.
block
,
'
software
'
:
self
.
software
,
'
version
'
:
self
.
version
}
endpoints
=
[]
for
e
in
self
.
_endpoints
:
endpoints
.
append
(
e
.
inline
())
...
...
@@ -166,6 +182,14 @@ class Node(QObject):
def
block
(
self
):
return
self
.
_block
@property
def
version
(
self
):
return
self
.
_version
@property
def
software
(
self
):
return
self
.
_software
@block.setter
def
block
(
self
,
new_block
):
self
.
_block
=
new_block
...
...
@@ -253,6 +277,10 @@ class Node(QObject):
node_currency
=
informations
[
"
currency
"
]
node_uid
=
self
.
_request_uid
()
implementation
=
bma
.
node
.
Summary
(
self
.
endpoint
.
conn_handler
()).
get
()
software
=
implementation
[
"
ucoin
"
][
"
software
"
]
version
=
implementation
[
"
ucoin
"
][
"
version
"
]
#If the nodes goes back online...
if
self
.
state
in
(
Node
.
OFFLINE
,
Node
.
CORRUPTED
):
self
.
state
=
Node
.
ONLINE
...
...
@@ -309,6 +337,16 @@ class Node(QObject):
self
.
_uid
=
node_uid
emit_change
=
True
if
software
!=
self
.
_software
:
logging
.
debug
(
"
Change : new software
"
)
self
.
_software
=
software
emit_change
=
True
if
version
!=
self
.
_version
:
logging
.
debug
(
"
Change : new version
"
)
self
.
_version
=
version
emit_change
=
True
logging
.
debug
(
neighbours
)
new_inlines
=
[
e
.
inline
()
for
n
in
neighbours
for
e
in
n
]
last_inlines
=
[
e
.
inline
()
for
n
in
self
.
_neighbours
for
e
in
n
]
...
...
This diff is collapsed.
Click to expand it.
src/cutecoin/models/network.py
+
6
−
2
View file @
fa9eb441
...
...
@@ -41,7 +41,9 @@ class NetworkFilterProxyModel(QSortFilterProxyModel):
'
current_block
'
:
self
.
tr
(
'
Block
'
),
'
uid
'
:
self
.
tr
(
'
UID
'
),
'
is_member
'
:
self
.
tr
(
'
Member
'
),
'
pubkey
'
:
self
.
tr
(
'
Pubkey
'
)
'
pubkey
'
:
self
.
tr
(
'
Pubkey
'
),
'
software
'
:
self
.
tr
(
'
Software
'
),
'
version
'
:
self
.
tr
(
'
Version
'
)
}
_type
=
self
.
sourceModel
().
headerData
(
section
,
orientation
,
role
)
return
header_names
[
_type
]
...
...
@@ -92,6 +94,8 @@ class NetworkTableModel(QAbstractTableModel):
'
uid
'
,
'
is_member
'
,
'
pubkey
'
,
'
software
'
,
'
version
'
,
'
is_root
'
)
self
.
node_colors
=
{
...
...
@@ -147,7 +151,7 @@ class NetworkTableModel(QAbstractTableModel):
is_root
=
self
.
community
.
network
.
is_root_node
(
node
)
return
(
address
,
port
,
node
.
block
,
node
.
uid
,
is_member
,
node
.
pubkey
,
is_root
)
is_member
,
node
.
pubkey
,
node
.
software
,
node
.
version
,
is_root
)
def
data
(
self
,
index
,
role
):
row
=
index
.
row
()
...
...
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