Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Scan le Gentil
duniter-currency-monit
Commits
fce39279
Commit
fce39279
authored
Apr 19, 2020
by
Cédric Moreau
Browse files
[fix] `blockCount` crashed
parent
590dd993
Changes
1
Hide whitespace changes
Inline
Side-by-side
routes/blockCount2.ts
View file @
fce39279
...
...
@@ -35,7 +35,7 @@ module.exports = async (req: any, res: any, next: any) => {
// detect fork
if
(
blockchain
.
length
>
0
)
{
let
newHashPreviousCurrentblock
=
(
await
dataFinder
.
get
Block
(
blockchain
.
length
-
1
)
as
{
hash
:
string
}).
hash
let
newHashPreviousCurrentblock
=
(
await
dataFinder
.
get
CurrentBlockOrNull
(
)
as
{
hash
:
string
}).
hash
if
(
hashPreviousCurrentblock
!=
newHashPreviousCurrentblock
)
{
blockchain
.
splice
(
0
,
blockchain
.
length
);
...
...
@@ -65,7 +65,7 @@ module.exports = async (req: any, res: any, next: any) => {
}
// stock hashPreviousCurrentblock and previousBlockchainTime
let
tmpCurrentBlock
=
await
dataFinder
.
get
Block
(
blockchain
.
length
-
1
)
as
DBBlock
let
tmpCurrentBlock
=
await
dataFinder
.
get
CurrentBlockOrNull
(
)
as
DBBlock
hashPreviousCurrentblock
=
tmpCurrentBlock
.
hash
;
previousBlockchainTime
=
tmpCurrentBlock
.
medianTime
;
...
...
Write
Preview
Supports
Markdown
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