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
019dca9b
Commit
019dca9b
authored
Sep 15, 2017
by
Dave Appleton
Committed by
Felix Lange
Sep 15, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
accounts/abi/backends: add AdjustTime (#15077)
parent
c197d805
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
simulated.go
accounts/abi/bind/backends/simulated.go
+17
-0
No files found.
accounts/abi/bind/backends/simulated.go
View file @
019dca9b
...
...
@@ -22,6 +22,7 @@ import (
"fmt"
"math/big"
"sync"
"time"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
...
...
@@ -284,6 +285,22 @@ func (b *SimulatedBackend) SendTransaction(ctx context.Context, tx *types.Transa
return
nil
}
// JumpTimeInSeconds adds skip seconds to the clock
func
(
b
*
SimulatedBackend
)
AdjustTime
(
adjustment
time
.
Duration
)
error
{
b
.
mu
.
Lock
()
defer
b
.
mu
.
Unlock
()
blocks
,
_
:=
core
.
GenerateChain
(
b
.
config
,
b
.
blockchain
.
CurrentBlock
(),
b
.
database
,
1
,
func
(
number
int
,
block
*
core
.
BlockGen
)
{
for
_
,
tx
:=
range
b
.
pendingBlock
.
Transactions
()
{
block
.
AddTx
(
tx
)
}
block
.
OffsetTime
(
int64
(
adjustment
.
Seconds
()))
})
b
.
pendingBlock
=
blocks
[
0
]
b
.
pendingState
,
_
=
state
.
New
(
b
.
pendingBlock
.
Root
(),
state
.
NewDatabase
(
b
.
database
))
return
nil
}
// callmsg implements core.Message to allow passing it as a transaction simulator.
type
callmsg
struct
{
ethereum
.
CallMsg
...
...
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