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
3b6c9902
Commit
3b6c9902
authored
5 years ago
by
Rob Mulholand
Committed by
Péter Szilágyi
5 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: remove unused gas return in ApplyTransaction (#20065)
parent
efe12375
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
8 deletions
+8
-8
retesteth.go
cmd/geth/retesteth.go
+1
-1
chain_makers.go
core/chain_makers.go
+1
-1
state_processor.go
core/state_processor.go
+5
-5
worker.go
miner/worker.go
+1
-1
No files found.
cmd/geth/retesteth.go
View file @
3b6c9902
...
...
@@ -508,7 +508,7 @@ func (api *RetestethAPI) mineBlock() error {
statedb
.
Prepare
(
tx
.
Hash
(),
common
.
Hash
{},
txCount
)
snap
:=
statedb
.
Snapshot
()
receipt
,
_
,
err
:=
core
.
ApplyTransaction
(
receipt
,
err
:=
core
.
ApplyTransaction
(
api
.
chainConfig
,
api
.
blockchain
,
&
api
.
author
,
...
...
This diff is collapsed.
Click to expand it.
core/chain_makers.go
View file @
3b6c9902
...
...
@@ -103,7 +103,7 @@ func (b *BlockGen) AddTxWithChain(bc *BlockChain, tx *types.Transaction) {
b
.
SetCoinbase
(
common
.
Address
{})
}
b
.
statedb
.
Prepare
(
tx
.
Hash
(),
common
.
Hash
{},
len
(
b
.
txs
))
receipt
,
_
,
err
:=
ApplyTransaction
(
b
.
config
,
bc
,
&
b
.
header
.
Coinbase
,
b
.
gasPool
,
b
.
statedb
,
b
.
header
,
tx
,
&
b
.
header
.
GasUsed
,
vm
.
Config
{})
receipt
,
err
:=
ApplyTransaction
(
b
.
config
,
bc
,
&
b
.
header
.
Coinbase
,
b
.
gasPool
,
b
.
statedb
,
b
.
header
,
tx
,
&
b
.
header
.
GasUsed
,
vm
.
Config
{})
if
err
!=
nil
{
panic
(
err
)
}
...
...
This diff is collapsed.
Click to expand it.
core/state_processor.go
View file @
3b6c9902
...
...
@@ -68,7 +68,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
// Iterate over and process the individual transactions
for
i
,
tx
:=
range
block
.
Transactions
()
{
statedb
.
Prepare
(
tx
.
Hash
(),
block
.
Hash
(),
i
)
receipt
,
_
,
err
:=
ApplyTransaction
(
p
.
config
,
p
.
bc
,
nil
,
gp
,
statedb
,
header
,
tx
,
usedGas
,
cfg
)
receipt
,
err
:=
ApplyTransaction
(
p
.
config
,
p
.
bc
,
nil
,
gp
,
statedb
,
header
,
tx
,
usedGas
,
cfg
)
if
err
!=
nil
{
return
nil
,
nil
,
0
,
err
}
...
...
@@ -85,10 +85,10 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
// and uses the input parameters for its environment. It returns the receipt
// for the transaction, gas used and an error if the transaction failed,
// indicating the block was invalid.
func
ApplyTransaction
(
config
*
params
.
ChainConfig
,
bc
ChainContext
,
author
*
common
.
Address
,
gp
*
GasPool
,
statedb
*
state
.
StateDB
,
header
*
types
.
Header
,
tx
*
types
.
Transaction
,
usedGas
*
uint64
,
cfg
vm
.
Config
)
(
*
types
.
Receipt
,
uint64
,
error
)
{
func
ApplyTransaction
(
config
*
params
.
ChainConfig
,
bc
ChainContext
,
author
*
common
.
Address
,
gp
*
GasPool
,
statedb
*
state
.
StateDB
,
header
*
types
.
Header
,
tx
*
types
.
Transaction
,
usedGas
*
uint64
,
cfg
vm
.
Config
)
(
*
types
.
Receipt
,
error
)
{
msg
,
err
:=
tx
.
AsMessage
(
types
.
MakeSigner
(
config
,
header
.
Number
))
if
err
!=
nil
{
return
nil
,
0
,
err
return
nil
,
err
}
// Create a new context to be used in the EVM environment
context
:=
NewEVMContext
(
msg
,
header
,
bc
,
author
)
...
...
@@ -98,7 +98,7 @@ func ApplyTransaction(config *params.ChainConfig, bc ChainContext, author *commo
// Apply the transaction to the current state (included in the env)
_
,
gas
,
failed
,
err
:=
ApplyMessage
(
vmenv
,
msg
,
gp
)
if
err
!=
nil
{
return
nil
,
0
,
err
return
nil
,
err
}
// Update the state with pending changes
var
root
[]
byte
...
...
@@ -125,5 +125,5 @@ func ApplyTransaction(config *params.ChainConfig, bc ChainContext, author *commo
receipt
.
BlockNumber
=
header
.
Number
receipt
.
TransactionIndex
=
uint
(
statedb
.
TxIndex
())
return
receipt
,
gas
,
err
return
receipt
,
err
}
This diff is collapsed.
Click to expand it.
miner/worker.go
View file @
3b6c9902
...
...
@@ -704,7 +704,7 @@ func (w *worker) updateSnapshot() {
func
(
w
*
worker
)
commitTransaction
(
tx
*
types
.
Transaction
,
coinbase
common
.
Address
)
([]
*
types
.
Log
,
error
)
{
snap
:=
w
.
current
.
state
.
Snapshot
()
receipt
,
_
,
err
:=
core
.
ApplyTransaction
(
w
.
chainConfig
,
w
.
chain
,
&
coinbase
,
w
.
current
.
gasPool
,
w
.
current
.
state
,
w
.
current
.
header
,
tx
,
&
w
.
current
.
header
.
GasUsed
,
*
w
.
chain
.
GetVMConfig
())
receipt
,
err
:=
core
.
ApplyTransaction
(
w
.
chainConfig
,
w
.
chain
,
&
coinbase
,
w
.
current
.
gasPool
,
w
.
current
.
state
,
w
.
current
.
header
,
tx
,
&
w
.
current
.
header
.
GasUsed
,
*
w
.
chain
.
GetVMConfig
())
if
err
!=
nil
{
w
.
current
.
state
.
RevertToSnapshot
(
snap
)
return
nil
,
err
...
...
This diff is collapsed.
Click to expand it.
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