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
ac2026ad
Commit
ac2026ad
authored
9 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Handle simple transactions
parent
114a93c0
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sakia/core/txhistory.py
+8
-8
8 additions, 8 deletions
src/sakia/core/txhistory.py
with
8 additions
and
8 deletions
src/sakia/core/txhistory.py
+
8
−
8
View file @
ac2026ad
import
asyncio
import
asyncio
import
logging
import
logging
import
hashlib
import
hashlib
from
ucoinpy.documents.transaction
import
InputSource
from
ucoinpy.documents.transaction
import
SimpleTransaction
from
ucoinpy.documents.block
import
Block
from
ucoinpy.documents.block
import
Block
from
ucoinpy.api
import
bma
from
ucoinpy.api
import
bma
from
.transfer
import
Transfer
,
TransferState
from
.transfer
import
Transfer
,
TransferState
...
@@ -121,8 +121,8 @@ class TxHistory():
...
@@ -121,8 +121,8 @@ class TxHistory():
:param int txid: The latest txid
:param int txid: The latest txid
:return: the found transaction
:return: the found transaction
"""
"""
receivers
=
[
o
.
pubkey
for
o
in
tx
.
outputs
receivers
=
[
o
.
conditions
.
left
.
pubkey
for
o
in
tx
.
outputs
if
o
.
pubkey
!=
tx
.
issuers
[
0
]]
if
o
.
conditions
.
left
.
pubkey
!=
tx
.
issuers
[
0
]]
if
len
(
receivers
)
==
0
:
if
len
(
receivers
)
==
0
:
receivers
=
[
tx
.
issuers
[
0
]]
receivers
=
[
tx
.
issuers
[
0
]]
...
@@ -152,7 +152,7 @@ class TxHistory():
...
@@ -152,7 +152,7 @@ class TxHistory():
in_issuers
=
len
([
i
for
i
in
tx
.
issuers
in_issuers
=
len
([
i
for
i
in
tx
.
issuers
if
i
==
self
.
wallet
.
pubkey
])
>
0
if
i
==
self
.
wallet
.
pubkey
])
>
0
in_outputs
=
len
([
o
for
o
in
tx
.
outputs
in_outputs
=
len
([
o
for
o
in
tx
.
outputs
if
o
.
pubkey
==
self
.
wallet
.
pubkey
])
>
0
if
o
.
conditions
.
left
.
pubkey
==
self
.
wallet
.
pubkey
])
>
0
# We check if the transaction correspond to one we sent
# We check if the transaction correspond to one we sent
# but not from this sakia Instance
# but not from this sakia Instance
...
@@ -160,7 +160,7 @@ class TxHistory():
...
@@ -160,7 +160,7 @@ class TxHistory():
# If the wallet pubkey is in the issuers we sent this transaction
# If the wallet pubkey is in the issuers we sent this transaction
if
in_issuers
:
if
in_issuers
:
outputs
=
[
o
for
o
in
tx
.
outputs
outputs
=
[
o
for
o
in
tx
.
outputs
if
o
.
pubkey
!=
self
.
wallet
.
pubkey
]
if
o
.
conditions
.
left
.
pubkey
!=
self
.
wallet
.
pubkey
]
amount
=
0
amount
=
0
for
o
in
outputs
:
for
o
in
outputs
:
amount
+=
o
.
amount
amount
+=
o
.
amount
...
@@ -170,10 +170,10 @@ class TxHistory():
...
@@ -170,10 +170,10 @@ class TxHistory():
metadata
.
copy
())
metadata
.
copy
())
return
transfer
return
transfer
# If we are not in the issuers,
# If we are not in the issuers,
# maybe
it
we are in the recipients of this transaction
# maybe we are in the recipients of this transaction
elif
in_outputs
:
elif
in_outputs
:
outputs
=
[
o
for
o
in
tx
.
outputs
outputs
=
[
o
for
o
in
tx
.
outputs
if
o
.
pubkey
==
self
.
wallet
.
pubkey
]
if
o
.
conditions
.
left
.
pubkey
==
self
.
wallet
.
pubkey
]
amount
=
0
amount
=
0
for
o
in
outputs
:
for
o
in
outputs
:
amount
+=
o
.
amount
amount
+=
o
.
amount
...
@@ -203,7 +203,7 @@ class TxHistory():
...
@@ -203,7 +203,7 @@ class TxHistory():
new_tx
=
[
t
for
t
in
block_doc
.
transactions
new_tx
=
[
t
for
t
in
block_doc
.
transactions
if
t
.
sha_hash
not
in
[
trans
.
sha_hash
for
trans
in
self
.
_transfers
]
if
t
.
sha_hash
not
in
[
trans
.
sha_hash
for
trans
in
self
.
_transfers
]
]
and
SimpleTransaction
.
is_simple
(
t
)
]
for
(
txid
,
tx
)
in
enumerate
(
new_tx
):
for
(
txid
,
tx
)
in
enumerate
(
new_tx
):
transfer
=
await
self
.
_parse_transaction
(
community
,
tx
,
block_doc
.
blockUID
,
transfer
=
await
self
.
_parse_transaction
(
community
,
tx
,
block_doc
.
blockUID
,
...
...
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