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
b96394de
Commit
b96394de
authored
7 years ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
[fix]
#1132
Too many "Could not reach" errors
parent
df535606
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/lib/common-libs/constants.ts
+2
-0
2 additions, 0 deletions
app/lib/common-libs/constants.ts
app/lib/constants.ts
+2
-2
2 additions, 2 deletions
app/lib/constants.ts
app/lib/streams/multicaster.ts
+23
-6
23 additions, 6 deletions
app/lib/streams/multicaster.ts
with
27 additions
and
8 deletions
app/lib/common-libs/constants.ts
+
2
−
0
View file @
b96394de
...
...
@@ -150,6 +150,8 @@ export const CommonConstants = {
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.
"
}},
TOO_OLD_IDENTITY
:
{
httpCode
:
400
,
uerr
:
{
ucode
:
2020
,
message
:
"
Identity has expired and cannot be written in the blockchain anymore.
"
}},
NEWER_PEER_DOCUMENT_AVAILABLE
:
{
httpCode
:
409
,
uerr
:
{
ucode
:
2022
,
message
:
"
A newer peer document is available
"
}},
PEER_DOCUMENT_ALREADY_KNOWN
:
{
httpCode
:
400
,
uerr
:
{
ucode
:
2023
,
message
:
"
Peer document already known
"
}},
TX_INPUTS_OUTPUTS_NOT_EQUAL
:
{
httpCode
:
400
,
uerr
:
{
ucode
:
2024
,
message
:
"
Transaction inputs sum must equal outputs sum
"
}},
TX_OUTPUT_SUM_NOT_EQUALS_PREV_DELTAS
:
{
httpCode
:
400
,
uerr
:
{
ucode
:
2025
,
message
:
"
Transaction output base amount does not equal previous base deltas
"
}},
BLOCKSTAMP_DOES_NOT_MATCH_A_BLOCK
:
{
httpCode
:
400
,
uerr
:
{
ucode
:
2026
,
message
:
"
Blockstamp does not match a block
"
}},
...
...
This diff is collapsed.
Click to expand it.
app/lib/constants.ts
+
2
−
2
View file @
b96394de
...
...
@@ -58,8 +58,8 @@ module.exports = {
IDENTITY_WRONGLY_SIGNED
:
CommonConstants
.
ERRORS
.
IDENTITY_WRONGLY_SIGNED
,
TOO_OLD_IDENTITY
:
CommonConstants
.
ERRORS
.
TOO_OLD_IDENTITY
,
NO_IDTY_MATCHING_PUB_OR_UID
:
{
httpCode
:
404
,
uerr
:
{
ucode
:
2021
,
message
:
"
No identity matching this pubkey or uid
"
}},
NEWER_PEER_DOCUMENT_AVAILABLE
:
{
httpCode
:
409
,
uerr
:
{
ucode
:
2022
,
message
:
"
A newer peer document is available
"
}}
,
PEER_DOCUMENT_ALREADY_KNOWN
:
{
httpCode
:
400
,
uerr
:
{
ucode
:
2023
,
message
:
"
Peer document already known
"
}}
,
NEWER_PEER_DOCUMENT_AVAILABLE
:
CommonConstants
.
ERRORS
.
NEWER_PEER_DOCUMENT_AVAILABLE
,
PEER_DOCUMENT_ALREADY_KNOWN
:
CommonConstants
.
ERRORS
.
PEER_DOCUMENT_ALREADY_KNOWN
,
TX_INPUTS_OUTPUTS_NOT_EQUAL
:
CommonConstants
.
ERRORS
.
TX_INPUTS_OUTPUTS_NOT_EQUAL
,
TX_OUTPUT_SUM_NOT_EQUALS_PREV_DELTAS
:
CommonConstants
.
ERRORS
.
TX_OUTPUT_SUM_NOT_EQUALS_PREV_DELTAS
,
BLOCKSTAMP_DOES_NOT_MATCH_A_BLOCK
:
CommonConstants
.
ERRORS
.
BLOCKSTAMP_DOES_NOT_MATCH_A_BLOCK
,
...
...
This diff is collapsed.
Click to expand it.
app/lib/streams/multicaster.ts
+
23
−
6
View file @
b96394de
...
...
@@ -8,6 +8,7 @@ import {CertificationDTO} from "../dto/CertificationDTO"
import
{
MembershipDTO
}
from
"
../dto/MembershipDTO
"
import
{
TransactionDTO
}
from
"
../dto/TransactionDTO
"
import
{
PeerDTO
}
from
"
../dto/PeerDTO
"
import
{
CommonConstants
}
from
"
../common-libs/constants
"
const
request
=
require
(
'
request
'
);
const
constants
=
require
(
'
../../lib/constants
'
);
...
...
@@ -111,13 +112,29 @@ export class Multicaster extends stream.Transform {
},
getDocID
:
(
doc
:
PeerDTO
)
=>
doc
.
keyID
()
+
'
#
'
+
doc
.
blockNumber
(),
withIsolation
:
WITH_ISOLATION
,
onError
:
(
resJSON
:{
peer
:{
block
:
string
,
endpoints
:
string
[]
}},
peering
:
any
,
to
:
any
)
=>
{
onError
:
(
resJSON
:{
peer
:
{
block
:
string
,
endpoints
:
string
[]
},
ucode
?:
number
,
message
?:
string
},
peering
:
any
,
to
:
any
)
=>
{
if
(
resJSON
.
ucode
!==
undefined
&&
resJSON
.
ucode
!==
CommonConstants
.
ERRORS
.
NEWER_PEER_DOCUMENT_AVAILABLE
.
uerr
.
ucode
)
{
if
(
resJSON
.
ucode
==
CommonConstants
.
ERRORS
.
DOCUMENT_BEING_TREATED
.
uerr
.
ucode
||
resJSON
.
ucode
==
constants
.
ERRORS
.
PEER_DOCUMENT_ALREADY_KNOWN
.
uerr
.
ucode
)
{
return
Promise
.
resolve
()
}
else
{
throw
Error
(
resJSON
.
message
)
}
}
else
{
// Handle possibly outdated peering document
const
sentPeer
=
PeerDTO
.
fromJSONObject
(
peering
)
if
(
PeerDTO
.
blockNumber
(
resJSON
.
peer
.
block
)
>
sentPeer
.
blockNumber
())
{
this
.
push
({
outdated
:
true
,
peer
:
resJSON
.
peer
});
logger
.
warn
(
'
Outdated peer document (%s) sent to %s
'
,
sentPeer
.
keyID
()
+
'
#
'
+
sentPeer
.
blockNumber
(),
to
);
}
return
Promise
.
resolve
();
return
Promise
.
resolve
()
}
}
})(
doc
,
peers
)
}
...
...
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