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
b4eeffa8
Commit
b4eeffa8
authored
Dec 01, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Transaction strictness
parent
2df8ad63
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
transaction_pool.go
chain/transaction_pool.go
+8
-4
No files found.
chain/transaction_pool.go
View file @
b4eeffa8
...
@@ -102,11 +102,15 @@ func (pool *TxPool) ValidateTransaction(tx *Transaction) error {
...
@@ -102,11 +102,15 @@ func (pool *TxPool) ValidateTransaction(tx *Transaction) error {
block
:=
pool
.
Ethereum
.
ChainManager
()
.
CurrentBlock
block
:=
pool
.
Ethereum
.
ChainManager
()
.
CurrentBlock
// Something has gone horribly wrong if this happens
// Something has gone horribly wrong if this happens
if
block
==
nil
{
if
block
==
nil
{
return
fmt
.
Errorf
(
"
[TXPL]
No last block on the block chain"
)
return
fmt
.
Errorf
(
"No last block on the block chain"
)
}
}
if
len
(
tx
.
Recipient
)
!=
0
&&
len
(
tx
.
Recipient
)
!=
20
{
if
len
(
tx
.
Recipient
)
!=
0
&&
len
(
tx
.
Recipient
)
!=
20
{
return
fmt
.
Errorf
(
"[TXPL] Invalid recipient. len = %d"
,
len
(
tx
.
Recipient
))
return
fmt
.
Errorf
(
"Invalid recipient. len = %d"
,
len
(
tx
.
Recipient
))
}
if
tx
.
v
>
28
||
tx
.
v
<
27
{
return
fmt
.
Errorf
(
"tx.v != (28 || 27)"
)
}
}
if
tx
.
GasPrice
.
Cmp
(
MinGasPrice
)
<
0
{
if
tx
.
GasPrice
.
Cmp
(
MinGasPrice
)
<
0
{
...
@@ -120,12 +124,12 @@ func (pool *TxPool) ValidateTransaction(tx *Transaction) error {
...
@@ -120,12 +124,12 @@ func (pool *TxPool) ValidateTransaction(tx *Transaction) error {
// Make sure there's enough in the sender's account. Having insufficient
// Make sure there's enough in the sender's account. Having insufficient
// funds won't invalidate this transaction but simple ignores it.
// funds won't invalidate this transaction but simple ignores it.
if
sender
.
Balance
()
.
Cmp
(
totAmount
)
<
0
{
if
sender
.
Balance
()
.
Cmp
(
totAmount
)
<
0
{
return
fmt
.
Errorf
(
"
[TXPL]
Insufficient amount in sender's (%x) account"
,
tx
.
Sender
())
return
fmt
.
Errorf
(
"Insufficient amount in sender's (%x) account"
,
tx
.
Sender
())
}
}
if
tx
.
IsContract
()
{
if
tx
.
IsContract
()
{
if
tx
.
GasPrice
.
Cmp
(
big
.
NewInt
(
minGasPrice
))
<
0
{
if
tx
.
GasPrice
.
Cmp
(
big
.
NewInt
(
minGasPrice
))
<
0
{
return
fmt
.
Errorf
(
"
[TXPL]
Gasprice too low, %s given should be at least %d."
,
tx
.
GasPrice
,
minGasPrice
)
return
fmt
.
Errorf
(
"Gasprice too low, %s given should be at least %d."
,
tx
.
GasPrice
,
minGasPrice
)
}
}
}
}
...
...
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