Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
burrow
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hang Yu
burrow
Commits
b2d0b4d4
Commit
b2d0b4d4
authored
8 years ago
by
Benjamin Bollen
Browse files
Options
Downloads
Patches
Plain Diff
remove from pipe Send, and SendAndHold
Signed-off-by:
Benjamin Bollen
<
ben@erisindustries.com
>
parent
5b490cf6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
erisdb/pipe/transactor.go
+0
-86
0 additions, 86 deletions
erisdb/pipe/transactor.go
with
0 additions
and
86 deletions
erisdb/pipe/transactor.go
+
0
−
86
View file @
b2d0b4d4
...
@@ -212,92 +212,6 @@ func (this *transactor) TransactAndHold(privKey, address, data []byte, gasLimit,
...
@@ -212,92 +212,6 @@ func (this *transactor) TransactAndHold(privKey, address, data []byte, gasLimit,
return
ret
,
rErr
return
ret
,
rErr
}
}
func
(
this
*
transactor
)
Send
(
privKey
,
toAddress
[]
byte
,
amount
int64
)
(
*
Receipt
,
error
)
{
var
toAddr
[]
byte
if
len
(
toAddress
)
==
0
{
toAddr
=
nil
}
else
if
len
(
toAddress
)
!=
20
{
return
nil
,
fmt
.
Errorf
(
"To-address is not of the right length: %d
\n
"
,
len
(
toAddress
))
}
else
{
toAddr
=
toAddress
}
if
len
(
privKey
)
!=
64
{
return
nil
,
fmt
.
Errorf
(
"Private key is not of the right length: %d
\n
"
,
len
(
privKey
))
}
pk
:=
&
[
64
]
byte
{}
copy
(
pk
[
:
],
privKey
)
this
.
txMtx
.
Lock
()
defer
this
.
txMtx
.
Unlock
()
pa
:=
account
.
GenPrivAccountFromPrivKeyBytes
(
privKey
)
cache
:=
this
.
mempoolReactor
.
Mempool
.
GetCache
()
acc
:=
cache
.
GetAccount
(
pa
.
Address
)
var
sequence
int
if
acc
==
nil
{
sequence
=
1
}
else
{
sequence
=
acc
.
Sequence
+
1
}
tx
:=
types
.
NewSendTx
()
txInput
:=
&
types
.
TxInput
{
Address
:
pa
.
Address
,
Amount
:
amount
,
Sequence
:
sequence
,
PubKey
:
pa
.
PubKey
,
}
tx
.
Inputs
=
append
(
tx
.
Inputs
,
txInput
)
txOutput
:=
&
types
.
TxOutput
{
toAddr
,
amount
}
tx
.
Outputs
=
append
(
tx
.
Outputs
,
txOutput
)
// Got ourselves a tx.
txS
,
errS
:=
this
.
SignTx
(
tx
,
[]
*
account
.
PrivAccount
{
pa
})
if
errS
!=
nil
{
return
nil
,
errS
}
return
this
.
BroadcastTx
(
txS
)
}
func
(
this
*
transactor
)
SendAndHold
(
privKey
,
toAddress
[]
byte
,
amount
int64
)
(
*
Receipt
,
error
)
{
rec
,
tErr
:=
this
.
Send
(
privKey
,
toAddress
,
amount
)
if
tErr
!=
nil
{
return
nil
,
tErr
}
wc
:=
make
(
chan
*
types
.
SendTx
)
subId
:=
fmt
.
Sprintf
(
"%X"
,
rec
.
TxHash
)
this
.
eventEmitter
.
Subscribe
(
subId
,
types
.
EventStringAccOutput
(
toAddress
),
func
(
evt
types
.
EventData
)
{
event
:=
evt
.
(
types
.
EventDataTx
)
tx
:=
event
.
Tx
.
(
*
types
.
SendTx
)
wc
<-
tx
})
timer
:=
time
.
NewTimer
(
300
*
time
.
Second
)
toChan
:=
timer
.
C
var
rErr
error
pa
:=
account
.
GenPrivAccountFromPrivKeyBytes
(
privKey
)
select
{
case
<-
toChan
:
rErr
=
fmt
.
Errorf
(
"Transaction timed out. Hash: "
+
subId
)
case
e
:=
<-
wc
:
if
bytes
.
Equal
(
e
.
Inputs
[
0
]
.
Address
,
pa
.
Address
)
&&
e
.
Inputs
[
0
]
.
Amount
==
amount
{
timer
.
Stop
()
this
.
eventEmitter
.
Unsubscribe
(
subId
)
return
rec
,
rErr
}
}
return
nil
,
rErr
}
func
(
this
*
transactor
)
TransactNameReg
(
privKey
[]
byte
,
name
,
data
string
,
amount
,
fee
int64
)
(
*
Receipt
,
error
)
{
func
(
this
*
transactor
)
TransactNameReg
(
privKey
[]
byte
,
name
,
data
string
,
amount
,
fee
int64
)
(
*
Receipt
,
error
)
{
if
len
(
privKey
)
!=
64
{
if
len
(
privKey
)
!=
64
{
...
...
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