Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
hnt-pub
Miner
Commits
d0d5223a
Commit
d0d5223a
authored
4 years ago
by
Evan Vigil-McClanahan
Browse files
Options
Download
Email Patches
Plain Diff
fix targeting on newer nodes, increase test stability
parent
79e0c0fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/miner.erl
+18
-17
src/miner.erl
test/miner_blockchain_SUITE.erl
+16
-1
test/miner_blockchain_SUITE.erl
with
34 additions
and
18 deletions
+34
-18
src/miner.erl
+
18
-
17
View file @
d0d5223a
...
...
@@ -601,27 +601,28 @@ set_next_block_timer(State=#state{blockchain=Chain, start_block_time=StartBlockT
StartHeight0
=
application
:
get_env
(
miner
,
stabilization_period
,
0
),
StartHeight
=
max
(
1
,
Height
-
StartHeight0
),
StartBlockTime
=
case
StartBlockTime0
of
undefined
->
case
Height
>
StartHeight
of
true
->
case
blockchain
:
find_first_block_after
(
StartHeight
,
Chain
)
of
{
ok
,
_,
StartBlock
}
->
blockchain_block
:
time
(
StartBlock
);
_
->
undefined
end
;
false
->
undefined
end
;
Time
->
Time
end
,
{
ActualStartHeight
,
StartBlockTime
}
=
case
StartBlockTime0
of
undefined
->
case
Height
>
StartHeight
of
true
->
case
blockchain
:
find_first_block_after
(
StartHeight
,
Chain
)
of
{
ok
,
Actual
,
StartBlock
}
->
{
Actual
,
blockchain_block
:
time
(
StartBlock
)};
_
->
{
0
,
undefined
}
end
;
false
->
{
0
,
undefined
}
end
;
Time
->
{
StartHeight
,
Time
}
end
,
AvgBlockTime
=
case
StartBlockTime
of
undefined
->
BlockTime
;
_
->
(
LastBlockTimestamp
-
StartBlockTime
)
/
(
Height
-
StartHeight
)
(
LastBlockTimestamp
-
StartBlockTime
)
/
(
Height
-
Actual
StartHeight
)
end
,
BlockTimeDeviation0
=
BlockTime
-
AvgBlockTime
,
lager
:
info
(
"average
~p
block times
~p
difference
~p
"
,
[
Height
,
AvgBlockTime
,
BlockTime
-
AvgBlockTime
]),
...
...
This diff is collapsed.
Click to expand it.
test/miner_blockchain_SUITE.erl
+
16
-
1
View file @
d0d5223a
...
...
@@ -105,6 +105,12 @@ init_per_testcase(TestCase, Config0) ->
true
=
lists
:
all
(
fun
(
Res
)
->
Res
==
ok
end
,
DKGResults
),
%% Get both consensus and non consensus miners
true
=
miner_ct_utils
:
wait_until
(
fun
()
->
{_
ConsensusMiners
,
NCMiners
}
=
miner_ct_utils
:
miners_by_consensus_state
(
Miners
),
length
(
NCMiners
)
==
1
end
,
25
,
200
),
{
ConsensusMiners
,
NonConsensusMiners
}
=
miner_ct_utils
:
miners_by_consensus_state
(
Miners
),
ct
:
pal
(
"ConsensusMiners:
~p
, NonConsensusMiners:
~p
"
,
[
ConsensusMiners
,
NonConsensusMiners
]),
...
...
@@ -790,9 +796,18 @@ snapshot_test(Config) ->
miner_ct_utils
:
start_miners
([{
Target
,
NewTargetEnv
}]),
timer
:
sleep
(
5000
),
miner_ct_utils
:
wait_until
(
fun
()
->
try
undefined
=/=
ct_rpc
:
call
(
Target
,
blockchain_worker
,
blockchain
,
[])
catch
_:_
->
false
end
end
,
50
,
200
),
ok
=
ct_rpc
:
call
(
Target
,
blockchain
,
reset_ledger_to_snap
,
[]),
ok
=
miner_ct_utils
:
wait_for_gte
(
height
,
Miners0
,
25
,
all
,
20
),
ok
.
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets