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
004da827
Commit
004da827
authored
9 years ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
Fixing
#471
Blockchain generation is no more stuck by wrongly signed identities
parent
765dd2c6
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/lib/blockGenerator.js
+8
-0
8 additions, 0 deletions
app/lib/blockGenerator.js
app/lib/constants.js
+2
-1
2 additions, 1 deletion
app/lib/constants.js
with
10 additions
and
1 deletion
app/lib/blockGenerator.js
+
8
−
0
View file @
004da827
...
@@ -11,6 +11,7 @@ var constants = require('./constants');
...
@@ -11,6 +11,7 @@ var constants = require('./constants');
var
base58
=
require
(
'
./base58
'
);
var
base58
=
require
(
'
./base58
'
);
var
rules
=
require
(
'
./rules
'
);
var
rules
=
require
(
'
./rules
'
);
var
signature
=
require
(
'
./signature
'
);
var
signature
=
require
(
'
./signature
'
);
var
crypto
=
require
(
'
./crypto
'
);
var
Identity
=
require
(
'
./entity/identity
'
);
var
Identity
=
require
(
'
./entity/identity
'
);
var
Certification
=
require
(
'
./entity/certification
'
);
var
Certification
=
require
(
'
./entity/certification
'
);
var
Membership
=
require
(
'
./entity/membership
'
);
var
Membership
=
require
(
'
./entity/membership
'
);
...
@@ -461,6 +462,13 @@ function BlockGenerator(mainContext, prover) {
...
@@ -461,6 +462,13 @@ function BlockGenerator(mainContext, prover) {
throw
'
Too old identity
'
;
throw
'
Too old identity
'
;
}
}
}
}
let
idty
=
new
Identity
(
identity
);
idty
.
currency
=
conf
.
currency
;
let
selfCert
=
idty
.
rawWithoutSig
();
let
verified
=
crypto
.
verify
(
selfCert
,
idty
.
sig
,
idty
.
pubkey
);
if
(
!
verified
)
{
throw
constants
.
ERRORS
.
IDENTITY_WRONGLY_SIGNED
;
}
if
(
!
identity
.
leaving
)
{
if
(
!
identity
.
leaving
)
{
if
(
!
current
)
{
if
(
!
current
)
{
// Look for certifications from initial joiners
// Look for certifications from initial joiners
...
...
This diff is collapsed.
Click to expand it.
app/lib/constants.js
+
2
−
1
View file @
004da827
...
@@ -84,7 +84,8 @@ module.exports = {
...
@@ -84,7 +84,8 @@ module.exports = {
SOURCE_ALREADY_CONSUMED
:
{
httpCode
:
400
,
uerr
:
{
ucode
:
2015
,
message
:
"
Source already consumed
"
}},
SOURCE_ALREADY_CONSUMED
:
{
httpCode
:
400
,
uerr
:
{
ucode
:
2015
,
message
:
"
Source already consumed
"
}},
WRONG_AMOUNTS
:
{
httpCode
:
400
,
uerr
:
{
ucode
:
2016
,
message
:
"
Sum of inputs must equal sum of outputs
"
}},
WRONG_AMOUNTS
:
{
httpCode
:
400
,
uerr
:
{
ucode
:
2016
,
message
:
"
Sum of inputs must equal sum of outputs
"
}},
WRONG_OUTPUT_BASE
:
{
httpCode
:
400
,
uerr
:
{
ucode
:
2017
,
message
:
"
Wrong unit base for outputs
"
}},
WRONG_OUTPUT_BASE
:
{
httpCode
:
400
,
uerr
:
{
ucode
:
2017
,
message
:
"
Wrong unit base for outputs
"
}},
CANNOT_ROOT_BLOCK_NO_MEMBERS
:
{
httpCode
:
400
,
uerr
:
{
ucode
:
2018
,
message
:
"
Wrong new block: cannot make a root block without members
"
}}
CANNOT_ROOT_BLOCK_NO_MEMBERS
:
{
httpCode
:
400
,
uerr
:
{
ucode
:
2018
,
message
:
"
Wrong new block: cannot make a root block without members
"
}},
IDENTITY_WRONGLY_SIGNED
:
{
httpCode
:
400
,
uerr
:
{
ucode
:
2019
,
message
:
"
Weird, the signature is wrong and in the database.
"
}}
},
},
DEBUG
:
{
DEBUG
:
{
...
...
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