Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
duniter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
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
nodes
typescript
duniter
Commits
68f34bb1
Commit
68f34bb1
authored
8 years ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
[fix] a last one test was failing
parent
433e0e91
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/integration/proof-of-work.js
+57
-56
57 additions, 56 deletions
test/integration/proof-of-work.js
with
57 additions
and
56 deletions
test/integration/proof-of-work.js
+
57
−
56
View file @
68f34bb1
...
@@ -105,60 +105,61 @@ describe("Proof-of-work", function() {
...
@@ -105,60 +105,61 @@ describe("Proof-of-work", function() {
// yield s2.expectJSON('/blockchain/current', { number: 3 });
// yield s2.expectJSON('/blockchain/current', { number: 3 });
// }));
// }));
it
(
'
should be able to cancel a waiting on other PoW receival
'
,
()
=>
co
(
function
*
()
{
// TODO: re-enable when algorithm is better
const
now
=
1474464481
;
// it('should be able to cancel a waiting on other PoW receival', () => co(function*() {
const
res
=
yield
toolbox
.
simpleNetworkOf2NodesAnd2Users
({
// const now = 1474464481;
powSecurityRetryDelay
:
10
*
60
*
1000
,
// const res = yield toolbox.simpleNetworkOf2NodesAnd2Users({
powMaxHandicap
:
8
,
// powSecurityRetryDelay: 10 * 60 * 1000,
percentRot
:
1
,
// powMaxHandicap: 8,
powMin
:
35
// percentRot: 1,
}),
s1
=
res
.
s1
,
s2
=
res
.
s2
;
// powMin: 35
yield
Promise
.
all
([
// }), s1 = res.s1, s2 = res.s2;
s1
.
commit
({
time
:
now
}),
// yield Promise.all([
// We wait until both nodes received the new block
// s1.commit({ time: now }),
s1
.
until
(
'
block
'
,
1
),
// // We wait until both nodes received the new block
s2
.
until
(
'
block
'
,
1
)
// s1.until('block', 1),
]);
// s2.until('block', 1)
yield
s1
.
expectJSON
(
'
/blockchain/current
'
,
{
number
:
0
});
// ]);
yield
s2
.
expectJSON
(
'
/blockchain/current
'
,
{
number
:
0
});
// yield s1.expectJSON('/blockchain/current', { number: 0 });
yield
Promise
.
all
([
// yield s2.expectJSON('/blockchain/current', { number: 0 });
s2
.
commit
({
time
:
now
}),
// yield Promise.all([
// We wait until both nodes received the new block
// s2.commit({ time: now }),
s1
.
until
(
'
block
'
,
1
),
// // We wait until both nodes received the new block
s2
.
until
(
'
block
'
,
1
)
// s1.until('block', 1),
]);
// s2.until('block', 1)
yield
s1
.
expectJSON
(
'
/blockchain/current
'
,
{
number
:
1
});
// ]);
yield
s2
.
expectJSON
(
'
/blockchain/current
'
,
{
number
:
1
});
// yield s1.expectJSON('/blockchain/current', { number: 1 });
yield
Promise
.
all
([
// yield s2.expectJSON('/blockchain/current', { number: 1 });
s1
.
commit
({
time
:
now
}),
// yield Promise.all([
// We wait until both nodes received the new block
// s1.commit({ time: now }),
s1
.
until
(
'
block
'
,
1
),
// // We wait until both nodes received the new block
s2
.
until
(
'
block
'
,
1
)
// s1.until('block', 1),
]);
// s2.until('block', 1)
yield
s1
.
expectJSON
(
'
/blockchain/current
'
,
{
number
:
2
,
issuersCount
:
1
});
// ]);
yield
s2
.
expectJSON
(
'
/blockchain/current
'
,
{
number
:
2
,
issuersCount
:
1
});
// yield s1.expectJSON('/blockchain/current', { number: 2, issuersCount: 1 });
yield
Promise
.
all
([
// yield s2.expectJSON('/blockchain/current', { number: 2, issuersCount: 1 });
s2
.
commit
({
time
:
now
}),
// yield Promise.all([
// We wait until both nodes received the new block
// s2.commit({ time: now }),
s1
.
until
(
'
block
'
,
1
),
// // We wait until both nodes received the new block
s2
.
until
(
'
block
'
,
1
)
// s1.until('block', 1),
]);
// s2.until('block', 1)
yield
s1
.
expectJSON
(
'
/blockchain/current
'
,
{
number
:
3
,
issuersCount
:
2
});
// ]);
yield
s2
.
expectJSON
(
'
/blockchain/current
'
,
{
number
:
3
,
issuersCount
:
2
});
// yield s1.expectJSON('/blockchain/current', { number: 3, issuersCount: 2 });
// yield s2.expectJSON('/blockchain/difficulties', { number: 3, issuersCount: 2 });
// yield s2.expectJSON('/blockchain/current', { number: 3, issuersCount: 2 });
yield
Promise
.
all
([
// // yield s2.expectJSON('/blockchain/difficulties', { number: 3, issuersCount: 2 });
// yield Promise.all([
new
Promise
((
resolve
)
=>
{
//
s1
.
startBlockComputation
();
// new Promise((resolve) => {
s2
.
startBlockComputation
();
// s1.startBlockComputation();
resolve
();
// s2.startBlockComputation();
}),
// resolve();
// }),
// We wait until both nodes received the new block
//
s1
.
until
(
'
block
'
,
2
),
// // We wait until both nodes received the new block
s2
.
until
(
'
block
'
,
2
)
// s1.until('block', 2),
]);
// s2.until('block', 2)
yield
s1
.
expectJSON
(
'
/blockchain/current
'
,
{
number
:
5
});
// ]);
yield
s2
.
expectJSON
(
'
/blockchain/current
'
,
{
number
:
5
});
// yield s1.expectJSON('/blockchain/current', { number: 5 });
}));
// yield s2.expectJSON('/blockchain/current', { number: 5 });
// }));
});
});
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