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
c234cc28
Commit
c234cc28
authored
9 years ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
Fix: synchronization issues
parent
f96109e2
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/entity/block.js
+3
-3
3 additions, 3 deletions
app/lib/entity/block.js
app/service/BlockchainService.js
+2
-6
2 additions, 6 deletions
app/service/BlockchainService.js
with
5 additions
and
9 deletions
app/lib/entity/block.js
+
3
−
3
View file @
c234cc28
...
...
@@ -45,7 +45,8 @@ function Block(json) {
"
time
"
,
"
medianTime
"
,
"
membersCount
"
,
"
monetaryMass
"
"
monetaryMass
"
,
"
unitbase
"
].
forEach
(
function
(
field
){
json
[
field
]
=
parseInt
(
that
[
field
],
10
);
});
...
...
@@ -66,8 +67,7 @@ function Block(json) {
json
[
field
]
=
that
[
field
]
||
null
;
});
[
"
dividend
"
,
"
unitbase
"
"
dividend
"
].
forEach
(
function
(
field
){
json
[
field
]
=
parseInt
(
that
[
field
])
||
null
;
});
...
...
This diff is collapsed.
Click to expand it.
app/service/BlockchainService.js
+
2
−
6
View file @
c234cc28
...
...
@@ -452,17 +452,13 @@ function BlockchainService () {
};
// Insert a bunch of blocks
let
lastPrevious
=
blocks
[
0
].
number
==
0
?
null
:
yield
dal
.
getBlock
(
blocks
[
0
].
number
-
1
);
let
rootBlock
=
(
blocks
[
0
].
number
==
0
?
blocks
[
0
]
:
null
)
||
(
yield
dal
.
getBlockOrNull
(
0
));
let
rootConf
=
getParameters
(
rootBlock
);
let
maxBlock
=
getMaxBlocksToStoreAsFile
(
rootConf
);
let
lastBlockToSave
=
blocks
[
blocks
.
length
-
1
];
for
(
let
i
=
0
;
i
<
blocks
.
length
;
i
++
)
{
let
previous
=
i
>
0
?
blocks
[
i
-
1
]
:
lastPrevious
;
let
block
=
blocks
[
i
];
block
.
fork
=
false
;
//console.log('Block #%s', block.number);
// Monetary mass & UD Time recording before inserting elements
block
.
monetaryMass
=
(
previous
&&
previous
.
monetaryMass
)
||
0
;
block
.
unitbase
=
block
.
unitbase
||
0
;
block
.
dividend
=
block
.
dividend
||
0
;
// UD Time update
let
previousBlock
=
i
>
0
?
blocks
[
i
-
1
]
:
lastPrevious
;
...
...
@@ -493,7 +489,7 @@ function BlockchainService () {
yield
mainContext
.
updateCertificationsForBlocks
(
blocks
);
// Create / Update sources
yield
mainContext
.
updateTransactionSourcesForBlocks
(
blocks
);
yield
dal
.
blockDAL
.
saveBunch
(
blocks
,
(
targetLastNumber
-
lastBlockToSave
.
number
)
>
maxBlock
);
yield
dal
.
blockDAL
.
saveBunch
(
blocks
);
yield
pushStatsForBlocks
(
blocks
);
});
...
...
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