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
bcbd7003
Unverified
Commit
bcbd7003
authored
Oct 10, 2021
by
aaronbuchwald
Committed by
GitHub
Oct 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth/gasprice: avoid modifying TestChainConfig (#23204)
Co-authored-by:
Felix Lange
<
fjl@twurst.com
>
parent
84bccd09
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
18 deletions
+8
-18
gasprice_test.go
eth/gasprice/gasprice_test.go
+8
-18
No files found.
eth/gasprice/gasprice_test.go
View file @
bcbd7003
...
@@ -99,18 +99,14 @@ func newTestBackend(t *testing.T, londonBlock *big.Int, pending bool) *testBacke
...
@@ -99,18 +99,14 @@ func newTestBackend(t *testing.T, londonBlock *big.Int, pending bool) *testBacke
var
(
var
(
key
,
_
=
crypto
.
HexToECDSA
(
"b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291"
)
key
,
_
=
crypto
.
HexToECDSA
(
"b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291"
)
addr
=
crypto
.
PubkeyToAddress
(
key
.
PublicKey
)
addr
=
crypto
.
PubkeyToAddress
(
key
.
PublicKey
)
config
=
*
params
.
TestChainConfig
// needs copy because it is modified below
gspec
=
&
core
.
Genesis
{
gspec
=
&
core
.
Genesis
{
Config
:
params
.
TestChainC
onfig
,
Config
:
&
c
onfig
,
Alloc
:
core
.
GenesisAlloc
{
addr
:
{
Balance
:
big
.
NewInt
(
math
.
MaxInt64
)}},
Alloc
:
core
.
GenesisAlloc
{
addr
:
{
Balance
:
big
.
NewInt
(
math
.
MaxInt64
)}},
}
}
signer
=
types
.
LatestSigner
(
gspec
.
Config
)
signer
=
types
.
LatestSigner
(
gspec
.
Config
)
)
)
if
londonBlock
!=
nil
{
config
.
LondonBlock
=
londonBlock
gspec
.
Config
.
LondonBlock
=
londonBlock
signer
=
types
.
LatestSigner
(
gspec
.
Config
)
}
else
{
gspec
.
Config
.
LondonBlock
=
nil
}
engine
:=
ethash
.
NewFaker
()
engine
:=
ethash
.
NewFaker
()
db
:=
rawdb
.
NewMemoryDatabase
()
db
:=
rawdb
.
NewMemoryDatabase
()
genesis
,
_
:=
gspec
.
Commit
(
db
)
genesis
,
_
:=
gspec
.
Commit
(
db
)
...
@@ -119,9 +115,9 @@ func newTestBackend(t *testing.T, londonBlock *big.Int, pending bool) *testBacke
...
@@ -119,9 +115,9 @@ func newTestBackend(t *testing.T, londonBlock *big.Int, pending bool) *testBacke
blocks
,
_
:=
core
.
GenerateChain
(
gspec
.
Config
,
genesis
,
engine
,
db
,
testHead
+
1
,
func
(
i
int
,
b
*
core
.
BlockGen
)
{
blocks
,
_
:=
core
.
GenerateChain
(
gspec
.
Config
,
genesis
,
engine
,
db
,
testHead
+
1
,
func
(
i
int
,
b
*
core
.
BlockGen
)
{
b
.
SetCoinbase
(
common
.
Address
{
1
})
b
.
SetCoinbase
(
common
.
Address
{
1
})
var
tx
*
types
.
Transaction
var
tx
data
types
.
TxData
if
londonBlock
!=
nil
&&
b
.
Number
()
.
Cmp
(
londonBlock
)
>=
0
{
if
londonBlock
!=
nil
&&
b
.
Number
()
.
Cmp
(
londonBlock
)
>=
0
{
txdata
:
=
&
types
.
DynamicFeeTx
{
txdata
=
&
types
.
DynamicFeeTx
{
ChainID
:
gspec
.
Config
.
ChainID
,
ChainID
:
gspec
.
Config
.
ChainID
,
Nonce
:
b
.
TxNonce
(
addr
),
Nonce
:
b
.
TxNonce
(
addr
),
To
:
&
common
.
Address
{},
To
:
&
common
.
Address
{},
...
@@ -130,9 +126,8 @@ func newTestBackend(t *testing.T, londonBlock *big.Int, pending bool) *testBacke
...
@@ -130,9 +126,8 @@ func newTestBackend(t *testing.T, londonBlock *big.Int, pending bool) *testBacke
GasTipCap
:
big
.
NewInt
(
int64
(
i
+
1
)
*
params
.
GWei
),
GasTipCap
:
big
.
NewInt
(
int64
(
i
+
1
)
*
params
.
GWei
),
Data
:
[]
byte
{},
Data
:
[]
byte
{},
}
}
tx
=
types
.
NewTx
(
txdata
)
}
else
{
}
else
{
txdata
:
=
&
types
.
LegacyTx
{
txdata
=
&
types
.
LegacyTx
{
Nonce
:
b
.
TxNonce
(
addr
),
Nonce
:
b
.
TxNonce
(
addr
),
To
:
&
common
.
Address
{},
To
:
&
common
.
Address
{},
Gas
:
21000
,
Gas
:
21000
,
...
@@ -140,18 +135,13 @@ func newTestBackend(t *testing.T, londonBlock *big.Int, pending bool) *testBacke
...
@@ -140,18 +135,13 @@ func newTestBackend(t *testing.T, londonBlock *big.Int, pending bool) *testBacke
Value
:
big
.
NewInt
(
100
),
Value
:
big
.
NewInt
(
100
),
Data
:
[]
byte
{},
Data
:
[]
byte
{},
}
}
tx
=
types
.
NewTx
(
txdata
)
}
tx
,
err
:=
types
.
SignTx
(
tx
,
signer
,
key
)
if
err
!=
nil
{
t
.
Fatalf
(
"failed to create tx: %v"
,
err
)
}
}
b
.
AddTx
(
t
x
)
b
.
AddTx
(
t
ypes
.
MustSignNewTx
(
key
,
signer
,
txdata
)
)
})
})
// Construct testing chain
// Construct testing chain
diskdb
:=
rawdb
.
NewMemoryDatabase
()
diskdb
:=
rawdb
.
NewMemoryDatabase
()
gspec
.
Commit
(
diskdb
)
gspec
.
Commit
(
diskdb
)
chain
,
err
:=
core
.
NewBlockChain
(
diskdb
,
&
core
.
CacheConfig
{
TrieCleanNoPrefetch
:
true
},
gspec
.
C
onfig
,
engine
,
vm
.
Config
{},
nil
,
nil
)
chain
,
err
:=
core
.
NewBlockChain
(
diskdb
,
&
core
.
CacheConfig
{
TrieCleanNoPrefetch
:
true
},
&
c
onfig
,
engine
,
vm
.
Config
{},
nil
,
nil
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"Failed to create local chain, %v"
,
err
)
t
.
Fatalf
(
"Failed to create local chain, %v"
,
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