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
03035fca
Commit
03035fca
authored
10 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Send back a transaction now save the comment too
parent
bc3e23a4
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/cutecoin/core/transfer.py
+6
-4
6 additions, 4 deletions
src/cutecoin/core/transfer.py
src/cutecoin/core/wallet.py
+20
-25
20 additions, 25 deletions
src/cutecoin/core/wallet.py
src/cutecoin/gui/currency_tab.py
+1
-0
1 addition, 0 deletions
src/cutecoin/gui/currency_tab.py
with
27 additions
and
29 deletions
src/cutecoin/core/transfer.py
+
6
−
4
View file @
03035fca
...
@@ -28,12 +28,13 @@ class Transfer(object):
...
@@ -28,12 +28,13 @@ class Transfer(object):
self
.
metadata
=
metadata
self
.
metadata
=
metadata
@classmethod
@classmethod
def
initiate
(
cls
,
txdoc
,
block
,
time
,
amount
,
issuer
,
receiver
):
def
initiate
(
cls
,
block
,
time
,
amount
,
issuer
,
receiver
,
comment
):
return
cls
(
txdoc
,
Transfer
.
TO_SEND
,
{
'
block
'
:
block
,
return
cls
(
None
,
Transfer
.
TO_SEND
,
{
'
block
'
:
block
,
'
time
'
:
time
,
'
time
'
:
time
,
'
amount
'
:
amount
,
'
amount
'
:
amount
,
'
issuer
'
:
issuer
,
'
issuer
'
:
issuer
,
'
receiver
'
:
receiver
})
'
receiver
'
:
receiver
,
'
comment
'
:
comment
})
@classmethod
@classmethod
def
create_validated
(
cls
,
txdoc
,
metadata
):
def
create_validated
(
cls
,
txdoc
,
metadata
):
...
@@ -56,8 +57,9 @@ class Transfer(object):
...
@@ -56,8 +57,9 @@ class Transfer(object):
'
state
'
:
self
.
state
,
'
state
'
:
self
.
state
,
'
metadata
'
:
self
.
metadata
}
'
metadata
'
:
self
.
metadata
}
def
send
(
self
,
community
):
def
send
(
self
,
txdoc
,
community
):
try
:
try
:
self
.
txdoc
=
txdoc
community
.
broadcast
(
bma
.
tx
.
Process
,
community
.
broadcast
(
bma
.
tx
.
Process
,
post_args
=
{
'
transaction
'
:
self
.
txdoc
.
signed_raw
()})
post_args
=
{
'
transaction
'
:
self
.
txdoc
.
signed_raw
()})
self
.
state
=
Transfer
.
AWAITING
self
.
state
=
Transfer
.
AWAITING
...
...
This diff is collapsed.
Click to expand it.
src/cutecoin/core/wallet.py
+
20
−
25
View file @
03035fca
...
@@ -238,6 +238,7 @@ class Wallet(object):
...
@@ -238,6 +238,7 @@ class Wallet(object):
def
send_money
(
self
,
salt
,
password
,
community
,
def
send_money
(
self
,
salt
,
password
,
community
,
recipient
,
amount
,
message
):
recipient
,
amount
,
message
):
time
=
community
.
get_block
().
time
time
=
community
.
get_block
().
time
block_number
=
community
.
current_blockid
()[
'
number
'
]
block_number
=
community
.
current_blockid
()[
'
number
'
]
key
=
None
key
=
None
...
@@ -248,31 +249,25 @@ class Wallet(object):
...
@@ -248,31 +249,25 @@ class Wallet(object):
key
=
SigningKey
(
"
{0}{1}
"
.
format
(
salt
,
self
.
walletid
),
password
)
key
=
SigningKey
(
"
{0}{1}
"
.
format
(
salt
,
self
.
walletid
),
password
)
logging
.
debug
(
"
Sender pubkey:{0}
"
.
format
(
key
.
pubkey
))
logging
.
debug
(
"
Sender pubkey:{0}
"
.
format
(
key
.
pubkey
))
try
:
transfer
=
Transfer
.
initiate
(
block_number
,
time
,
amount
,
result
=
self
.
tx_inputs
(
int
(
amount
),
community
)
key
.
pubkey
,
recipient
,
message
)
inputs
=
result
[
0
]
self
.
caches
[
community
.
currency
].
_transfers
.
append
(
transfer
)
self
.
caches
[
community
.
currency
].
available_sources
=
result
[
1
]
logging
.
debug
(
"
Inputs : {0}
"
.
format
(
inputs
))
result
=
self
.
tx_inputs
(
int
(
amount
),
community
)
inputs
=
result
[
0
]
outputs
=
self
.
tx_outputs
(
recipient
,
amount
,
inputs
)
self
.
caches
[
community
.
currency
].
available_sources
=
result
[
1
]
logging
.
debug
(
"
Outputs : {0}
"
.
format
(
outputs
))
logging
.
debug
(
"
Inputs : {0}
"
.
format
(
inputs
))
tx
=
Transaction
(
PROTOCOL_VERSION
,
community
.
currency
,
[
self
.
pubkey
],
inputs
,
outputs
=
self
.
tx_outputs
(
recipient
,
amount
,
inputs
)
outputs
,
message
,
None
)
logging
.
debug
(
"
Outputs : {0}
"
.
format
(
outputs
))
logging
.
debug
(
"
TX : {0}
"
.
format
(
tx
.
raw
()))
tx
=
Transaction
(
PROTOCOL_VERSION
,
community
.
currency
,
[
self
.
pubkey
],
inputs
,
tx
.
sign
([
key
])
outputs
,
message
,
None
)
logging
.
debug
(
"
Transaction : {0}
"
.
format
(
tx
.
signed_raw
()))
logging
.
debug
(
"
TX : {0}
"
.
format
(
tx
.
raw
()))
transfer
=
Transfer
.
initiate
(
tx
,
block_number
,
time
,
amount
,
tx
.
sign
([
key
])
key
.
pubkey
,
recipient
)
logging
.
debug
(
"
Transaction : {0}
"
.
format
(
tx
.
signed_raw
()))
transfer
.
send
(
community
)
transfer
.
send
(
tx
,
community
)
self
.
caches
[
community
.
currency
].
_transfers
.
append
(
transfer
)
except
NotEnoughMoneyError
:
transfer
=
Transfer
.
initiate
(
None
,
block_number
,
time
,
amount
,
key
.
pubkey
,
recipient
)
self
.
caches
[
community
.
currency
].
_transfers
.
append
(
transfer
)
raise
def
sources
(
self
,
community
):
def
sources
(
self
,
community
):
data
=
community
.
request
(
bma
.
tx
.
Sources
,
data
=
community
.
request
(
bma
.
tx
.
Sources
,
...
...
This diff is collapsed.
Click to expand it.
src/cutecoin/gui/currency_tab.py
+
1
−
0
View file @
03035fca
...
@@ -254,6 +254,7 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget):
...
@@ -254,6 +254,7 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget):
dialog
.
combo_community
.
setCurrentText
(
self
.
community
.
name
())
dialog
.
combo_community
.
setCurrentText
(
self
.
community
.
name
())
dialog
.
spinbox_amount
.
setValue
(
transfer
.
metadata
[
'
amount
'
])
dialog
.
spinbox_amount
.
setValue
(
transfer
.
metadata
[
'
amount
'
])
dialog
.
radio_pubkey
.
setChecked
(
True
)
dialog
.
radio_pubkey
.
setChecked
(
True
)
dialog
.
edit_message
.
setText
(
transfer
.
metadata
[
'
comment
'
])
result
=
dialog
.
exec_
()
result
=
dialog
.
exec_
()
if
result
==
QDialog
.
Accepted
:
if
result
==
QDialog
.
Accepted
:
transfer
.
drop
()
transfer
.
drop
()
...
...
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