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
GitLab 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
1de513fa
Commit
1de513fa
authored
10 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Added broadcast to known peers
parent
1769f9ce
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/cutecoin/core/account.py
+3
-3
3 additions, 3 deletions
src/cutecoin/core/account.py
src/cutecoin/core/community.py
+13
-1
13 additions, 1 deletion
src/cutecoin/core/community.py
src/cutecoin/core/wallet.py
+1
-1
1 addition, 1 deletion
src/cutecoin/core/wallet.py
with
17 additions
and
5 deletions
src/cutecoin/core/account.py
+
3
−
3
View file @
1de513fa
...
@@ -130,7 +130,7 @@ class Account(object):
...
@@ -130,7 +130,7 @@ class Account(object):
'
self_
'
:
selfcert
.
signed_raw
(),
'
self_
'
:
selfcert
.
signed_raw
(),
'
other
'
:
"
{0}
\n
"
.
format
(
certification
.
inline
())}
'
other
'
:
"
{0}
\n
"
.
format
(
certification
.
inline
())}
logging
.
debug
(
"
Posted data : {0}
"
.
format
(
data
))
logging
.
debug
(
"
Posted data : {0}
"
.
format
(
data
))
community
.
po
st
(
bma
.
wot
.
Add
,
{},
data
)
community
.
broadca
st
(
bma
.
wot
.
Add
,
{},
data
)
def
sources
(
self
,
community
):
def
sources
(
self
,
community
):
sources
=
[]
sources
=
[]
...
@@ -189,7 +189,7 @@ class Account(object):
...
@@ -189,7 +189,7 @@ class Account(object):
key
=
SigningKey
(
self
.
salt
,
password
)
key
=
SigningKey
(
self
.
salt
,
password
)
selfcert
.
sign
([
key
])
selfcert
.
sign
([
key
])
logging
.
debug
(
"
Key publish : {0}
"
.
format
(
selfcert
.
signed_raw
()))
logging
.
debug
(
"
Key publish : {0}
"
.
format
(
selfcert
.
signed_raw
()))
community
.
po
st
(
bma
.
wot
.
Add
,
{},
{
'
pubkey
'
:
self
.
pubkey
,
community
.
broadca
st
(
bma
.
wot
.
Add
,
{},
{
'
pubkey
'
:
self
.
pubkey
,
'
self_
'
:
selfcert
.
signed_raw
(),
'
self_
'
:
selfcert
.
signed_raw
(),
'
other
'
:
[]})
'
other
'
:
[]})
...
@@ -206,7 +206,7 @@ class Account(object):
...
@@ -206,7 +206,7 @@ class Account(object):
key
=
SigningKey
(
self
.
salt
,
password
)
key
=
SigningKey
(
self
.
salt
,
password
)
membership
.
sign
([
key
])
membership
.
sign
([
key
])
logging
.
debug
(
"
Membership : {0}
"
.
format
(
membership
.
signed_raw
()))
logging
.
debug
(
"
Membership : {0}
"
.
format
(
membership
.
signed_raw
()))
community
.
po
st
(
bma
.
blockchain
.
Membership
,
{},
community
.
broadca
st
(
bma
.
blockchain
.
Membership
,
{},
{
'
membership
'
:
membership
.
signed_raw
()})
{
'
membership
'
:
membership
.
signed_raw
()})
def
jsonify
(
self
):
def
jsonify
(
self
):
...
...
This diff is collapsed.
Click to expand it.
src/cutecoin/core/community.py
+
13
−
1
View file @
1de513fa
...
@@ -141,7 +141,6 @@ class Community(object):
...
@@ -141,7 +141,6 @@ class Community(object):
for
d
in
data
:
for
d
in
data
:
cached_data
.
append
(
d
)
cached_data
.
append
(
d
)
self
.
requests_cache
[
cache_key
]
=
cached_data
self
.
requests_cache
[
cache_key
]
=
cached_data
logging
.
debug
(
"
Got a generator !
"
)
else
:
else
:
self
.
requests_cache
[
cache_key
]
=
data
self
.
requests_cache
[
cache_key
]
=
data
return
self
.
requests_cache
[
cache_key
]
return
self
.
requests_cache
[
cache_key
]
...
@@ -159,6 +158,19 @@ class Community(object):
...
@@ -159,6 +158,19 @@ class Community(object):
pass
pass
return
return
def
broadcast
(
self
,
request
,
req_args
=
{},
post_args
=
{}):
for
peer
in
self
.
peers
:
e
=
next
(
e
for
e
in
peer
.
endpoints
if
type
(
e
)
is
BMAEndpoint
)
logging
.
debug
(
"
Trying to connect to :
"
+
peer
.
pubkey
)
req
=
request
(
e
.
conn_handler
(),
**
req_args
)
try
:
req
.
post
(
**
post_args
)
except
ValueError
as
e
:
if
peer
==
self
.
peers
[
0
]:
raise
except
:
pass
def
jsonify_peers_list
(
self
):
def
jsonify_peers_list
(
self
):
data
=
[]
data
=
[]
for
peer
in
self
.
peers
:
for
peer
in
self
.
peers
:
...
...
This diff is collapsed.
Click to expand it.
src/cutecoin/core/wallet.py
+
1
−
1
View file @
1de513fa
...
@@ -216,7 +216,7 @@ class Wallet(object):
...
@@ -216,7 +216,7 @@ class Wallet(object):
tx
.
sign
([
key
])
tx
.
sign
([
key
])
logging
.
debug
(
"
Transaction : {0}
"
.
format
(
tx
.
signed_raw
()))
logging
.
debug
(
"
Transaction : {0}
"
.
format
(
tx
.
signed_raw
()))
try
:
try
:
community
.
po
st
(
bma
.
tx
.
Process
,
community
.
broadca
st
(
bma
.
tx
.
Process
,
post_args
=
{
'
transaction
'
:
tx
.
signed_raw
()})
post_args
=
{
'
transaction
'
:
tx
.
signed_raw
()})
self
.
cache
.
awaiting_tx
.
append
(
tx
)
self
.
cache
.
awaiting_tx
.
append
(
tx
)
except
:
except
:
...
...
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