good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
6f3cb129
Commit
6f3cb129
authored
Sep 17, 2015
by
Péter Szilágyi
Browse files
Options
Downloads
Patches
Plain Diff
core: allow modifying test-chain block times
parent
58fbcaa7
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/chain_makers.go
+11
-0
11 additions, 0 deletions
core/chain_makers.go
with
11 additions
and
0 deletions
core/chain_makers.go
+
11
−
0
View file @
6f3cb129
...
...
@@ -131,6 +131,17 @@ func (b *BlockGen) PrevBlock(index int) *types.Block {
return
b
.
chain
[
index
]
}
// OffsetTime modifies the time instance of a block, implicitly changing its
// associated difficulty. It's useful to test scenarios where forking is not
// tied to chain length directly.
func
(
b
*
BlockGen
)
OffsetTime
(
seconds
int64
)
{
b
.
header
.
Time
.
Add
(
b
.
header
.
Time
,
new
(
big
.
Int
)
.
SetInt64
(
seconds
))
if
b
.
header
.
Time
.
Cmp
(
b
.
parent
.
Header
()
.
Time
)
<=
0
{
panic
(
"block time out of range"
)
}
b
.
header
.
Difficulty
=
CalcDifficulty
(
b
.
header
.
Time
.
Uint64
(),
b
.
parent
.
Time
()
.
Uint64
(),
b
.
parent
.
Number
(),
b
.
parent
.
Difficulty
())
}
// GenerateChain creates a chain of n blocks. The first block's
// parent will be the provided parent. db is used to store
// intermediate states and should contain the parent's state trie.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment