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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
typescript
duniter
Commits
fe79d0a6
Commit
fe79d0a6
authored
5 years ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
[fix]
#1394
: implement DUBP v12
parent
e730718f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/lib/dal/indexDAL/leveldb/LevelDBCindex.ts
+2
-1
2 additions, 1 deletion
app/lib/dal/indexDAL/leveldb/LevelDBCindex.ts
test/integration/fork-resolution/coming-back-with-less-than-sigqty.ts
+12
-3
12 additions, 3 deletions
...tion/fork-resolution/coming-back-with-less-than-sigqty.ts
with
14 additions
and
4 deletions
app/lib/dal/indexDAL/leveldb/LevelDBCindex.ts
+
2
−
1
View file @
fe79d0a6
...
...
@@ -223,7 +223,8 @@ export class LevelDBCindex extends LevelDBTable<LevelDBCindexEntry> implements C
const
receiver
=
(
await
this
.
getOrNull
(
pub
))
||
{
issued
:
[],
received
:
[]
}
const
issuers
=
receiver
.
received
return
(
await
Promise
.
all
(
issuers
.
map
(
async
issuer
=>
{
return
(
await
this
.
get
(
issuer
)).
issued
.
filter
(
e
=>
e
.
receiver
===
pub
&&
e
.
expired_on
===
0
)
const
fullEntries
=
Indexer
.
DUP_HELPERS
.
reduceBy
((
await
this
.
get
(
issuer
)).
issued
,
[
'
issuer
'
,
'
receiver
'
])
return
fullEntries
.
filter
(
e
=>
e
.
receiver
===
pub
&&
e
.
expired_on
===
0
)
}))).
reduce
(
reduceConcat
,
[])
}
...
...
This diff is collapsed.
Click to expand it.
test/integration/fork-resolution/coming-back-with-less-than-sigqty.ts
+
12
−
3
View file @
fe79d0a6
...
...
@@ -13,6 +13,7 @@
import
{
assertEqual
,
writeBasicTestWithConfAnd2Users
}
from
"
../tools/test-framework
"
import
{
CommonConstants
}
from
"
../../../app/lib/common-libs/constants
"
import
{
assertThrows
}
from
"
../../unit-tools
"
const
currentVersion
=
CommonConstants
.
BLOCK_GENESIS_VERSION
...
...
@@ -76,17 +77,25 @@ describe('A member coming back with less than `sigQty` valid certs total', () =>
assertEqual
(
b
.
excluded
[
0
],
toc
.
pub
)
})
test
(
'
(t = 13 #1) toc is coming back with 1 cert only!
a renewal counted twice
'
,
async
(
s1
,
cat
,
tac
,
toc
)
=>
{
test
(
'
(t = 13 #1) toc is
NOT
coming back with 1 cert only!
'
,
async
(
s1
,
cat
,
tac
,
toc
)
=>
{
await
s1
.
commit
({
time
:
now
+
13
})
await
s1
.
commit
({
time
:
now
+
13
})
const
c1
=
await
cat
.
makeCert
(
toc
)
// <-- a renewal ==> this is what we want to observe
const
join
=
await
toc
.
makeMembership
(
'
IN
'
)
const
b
=
await
s1
.
commit
({
// toc is **NOT** coming back! not enough certs
await
assertThrows
(
s1
.
commit
({
time
:
now
+
13
,
joiners
:
[
join
],
certifications
:
[
c1
]
}),
'
BLOCK_WASNT_COMMITTED
'
)
// BUT is coming back with 1 more cert
const
c2
=
await
tac
.
makeCert
(
toc
)
const
b
=
await
s1
.
commit
({
time
:
now
+
13
,
joiners
:
[
join
],
certifications
:
[
c1
,
c2
]
})
assertEqual
(
b
.
membersCount
,
3
)
assertEqual
(
b
.
membersCount
,
3
)
// <--- toc is welcome back :)
assertEqual
(
b
.
number
,
12
)
})
...
...
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