Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
81e2124e
Commit
81e2124e
authored
Jul 28, 2015
by
Bas van Kervel
Committed by
Bas van Kervel
Jul 29, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved error detection and handling for NewTransactionFromBytes
integrated review comments
parent
a281df78
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
12 deletions
+14
-12
transaction.go
core/types/transaction.go
+0
-9
xeth.go
xeth/xeth.go
+14
-3
No files found.
core/types/transaction.go
View file @
81e2124e
...
...
@@ -97,15 +97,6 @@ func NewTransaction(nonce uint64, to common.Address, amount, gasLimit, gasPrice
return
&
Transaction
{
data
:
d
}
}
func
NewTransactionFromBytes
(
data
[]
byte
)
*
Transaction
{
// TODO: remove this function if possible. callers would
// much better off decoding into transaction directly.
// it's not that hard.
tx
:=
new
(
Transaction
)
rlp
.
DecodeBytes
(
data
,
tx
)
return
tx
}
func
(
tx
*
Transaction
)
EncodeRLP
(
w
io
.
Writer
)
error
{
return
rlp
.
Encode
(
w
,
&
tx
.
data
)
}
...
...
xeth/xeth.go
View file @
81e2124e
...
...
@@ -310,7 +310,12 @@ func (self *XEth) EthTransactionByHash(hash string) (tx *types.Transaction, blha
// some chain, this probably needs to be refactored for more expressiveness
data
,
_
:=
self
.
backend
.
ExtraDb
()
.
Get
(
common
.
FromHex
(
hash
))
if
len
(
data
)
!=
0
{
tx
=
types
.
NewTransactionFromBytes
(
data
)
dtx
:=
new
(
types
.
Transaction
)
if
err
:=
rlp
.
DecodeBytes
(
data
,
dtx
);
err
!=
nil
{
glog
.
V
(
logger
.
Error
)
.
Infoln
(
err
)
return
}
tx
=
dtx
}
else
{
// check pending transactions
tx
=
self
.
backend
.
TxPool
()
.
GetTransaction
(
common
.
HexToHash
(
hash
))
}
...
...
@@ -773,8 +778,14 @@ func (self *XEth) FromNumber(str string) string {
}
func
(
self
*
XEth
)
PushTx
(
encodedTx
string
)
(
string
,
error
)
{
tx
:=
types
.
NewTransactionFromBytes
(
common
.
FromHex
(
encodedTx
))
err
:=
self
.
backend
.
TxPool
()
.
Add
(
tx
)
tx
:=
new
(
types
.
Transaction
)
err
:=
rlp
.
DecodeBytes
(
common
.
FromHex
(
encodedTx
),
tx
)
if
err
!=
nil
{
glog
.
V
(
logger
.
Error
)
.
Infoln
(
err
)
return
""
,
err
}
err
=
self
.
backend
.
TxPool
()
.
Add
(
tx
)
if
err
!=
nil
{
return
""
,
err
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment