Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
timothe
duniter
Commits
6cc4ce5d
Commit
6cc4ce5d
authored
Mar 28, 2018
by
Cédric Moreau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix] #1300 Leave membership is stucking the whole blockchain
parent
5b9034ad
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
+14
-4
app/lib/dal/fileDAL.ts
app/lib/dal/fileDAL.ts
+13
-3
app/modules/prover/lib/blockGenerator.ts
app/modules/prover/lib/blockGenerator.ts
+1
-1
No files found.
app/lib/dal/fileDAL.ts
View file @
6cc4ce5d
...
...
@@ -519,9 +519,19 @@ export class FileDAL {
.
value
()
}
async
findLeavers
()
{
const
mss
=
await
this
.
msDAL
.
getPendingOUT
();
return
_
.
chain
(
mss
).
sortBy
((
ms
:
any
)
=>
-
ms
.
sigDate
).
value
();
async
findLeavers
(
blockMedianTime
=
0
)
{
const
pending
=
await
this
.
msDAL
.
getPendingOUT
();
const
mss
=
await
Promise
.
all
(
pending
.
map
(
async
(
p
:
any
)
=>
{
const
reduced
=
await
this
.
mindexDAL
.
getReducedMS
(
p
.
issuer
)
if
(
!
reduced
||
!
reduced
.
chainable_on
||
blockMedianTime
>=
reduced
.
chainable_on
||
blockMedianTime
<
constants
.
TIME_TO_TURN_ON_BRG_107
)
{
return
p
}
return
null
}))
return
_
.
chain
(
mss
)
.
filter
((
ms
:
any
)
=>
ms
)
.
sortBy
((
ms
:
any
)
=>
-
ms
.
sigDate
)
.
value
();
}
existsNonReplayableLink
(
from
:
string
,
to
:
string
)
{
...
...
app/modules/prover/lib/blockGenerator.ts
View file @
6cc4ce5d
...
...
@@ -151,7 +151,7 @@ export class BlockGenerator {
private
async
findLeavers
(
current
:
DBBlock
)
{
const
leaveData
:
{
[
pub
:
string
]:
any
}
=
{};
const
memberships
=
await
this
.
dal
.
findLeavers
();
const
memberships
=
await
this
.
dal
.
findLeavers
(
current
&&
current
.
medianTime
);
const
leavers
:
string
[]
=
[];
memberships
.
forEach
((
ms
:
any
)
=>
leavers
.
push
(
ms
.
issuer
));
for
(
const
ms
of
memberships
)
{
...
...
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