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
16fcea5c
Commit
16fcea5c
authored
8 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Fix dividends parsing
parent
c3017a91
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/sakia/data/processors/dividends.py
+3
-3
3 additions, 3 deletions
src/sakia/data/processors/dividends.py
src/sakia/services/transactions.py
+12
-2
12 additions, 2 deletions
src/sakia/services/transactions.py
with
15 additions
and
5 deletions
src/sakia/data/processors/dividends.py
+
3
−
3
View file @
16fcea5c
...
...
@@ -61,7 +61,7 @@ class DividendsProcessor:
for
tx
in
transactions
:
txdoc
=
Transaction
.
from_signed_raw
(
tx
.
raw
)
for
input
in
txdoc
.
inputs
:
if
input
.
source
==
"
D
"
and
input
.
index
not
in
block_numbers
:
if
input
.
source
==
"
D
"
and
input
.
origin_id
==
identity
.
pubkey
and
input
.
index
not
in
block_numbers
:
block
=
await
self
.
_bma_connector
.
get
(
identity
.
currency
,
bma
.
blockchain
.
block
,
req_args
=
{
'
number
'
:
input
.
index
})
...
...
@@ -69,8 +69,8 @@ class DividendsProcessor:
pubkey
=
identity
.
pubkey
,
block_number
=
input
.
index
,
timestamp
=
block
[
"
medianTime
"
],
amount
=
input
.
amount
,
base
=
input
.
base
)
amount
=
block
[
"
dividend
"
]
,
base
=
block
[
"
unit
base
"
]
)
log_stream
(
"
Dividend of block {0}
"
.
format
(
dividend
.
block_number
))
try
:
self
.
_repo
.
insert
(
dividend
)
...
...
This diff is collapsed.
Click to expand it.
src/sakia/services/transactions.py
+
12
−
2
View file @
16fcea5c
from
PyQt5.QtCore
import
QObject
from
sakia.data.entities.transaction
import
parse_transaction_doc
from
duniterpy.documents
import
SimpleTransaction
from
sakia.data.entities
import
Dividend
import
logging
...
...
@@ -47,8 +48,17 @@ class TransactionsService(QObject):
if
not
self
.
_transactions_processor
.
find_by_hash
(
t
.
sha_hash
)
and
SimpleTransaction
.
is_simple
(
t
)]
connections_pubkeys
=
[
c
.
pubkey
for
c
in
self
.
_connections_processor
.
connections_to
(
self
.
currency
)]
for
(
i
,
tx_doc
)
in
enumerate
(
new_transactions
):
for
pubkey
in
connections_pubkeys
:
for
pubkey
in
connections_pubkeys
:
if
block_doc
.
ud
:
dividend
=
Dividend
(
currency
=
self
.
currency
,
pubkey
=
pubkey
,
block_number
=
block_doc
.
number
,
timestamp
=
block_doc
.
mediantime
,
amount
=
block_doc
.
ud
,
base
=
block_doc
.
unit_base
)
self
.
_dividends_processor
.
commit
(
dividend
)
for
(
i
,
tx_doc
)
in
enumerate
(
new_transactions
):
tx
=
parse_transaction_doc
(
tx_doc
,
pubkey
,
block_doc
.
blockUID
.
number
,
block_doc
.
mediantime
,
txid
+
i
)
if
tx
:
new_transfers
.
append
(
tx
)
...
...
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