Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nucleo
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
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
blockchain
nucleo
Commits
89cc3810
Commit
89cc3810
authored
5 years ago
by
Robert Martin-Legene
Browse files
Options
Downloads
Patches
Plain Diff
usa carpeta cache si existe
parent
9e0e5775
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/monitor.js
+11
-5
11 additions, 5 deletions
bin/monitor.js
with
11 additions
and
5 deletions
bin/monitor.js
+
11
−
5
View file @
89cc3810
...
@@ -10,12 +10,15 @@ var bfa = new Libbfa();
...
@@ -10,12 +10,15 @@ var bfa = new Libbfa();
var
web3
=
bfa
.
newweb3
();
var
web3
=
bfa
.
newweb3
();
var
lastUnlock
=
0
;
var
lastUnlock
=
0
;
var
netid
=
0
;
var
netid
=
0
;
var
peerscache
=
bfa
.
networkdir
+
'
/peers.cache
'
;
if
(
bfa
.
fs
.
existsSync
(
bfa
.
networkdir
+
'
/cache
'
)
)
peerscache
=
bfa
.
networkdir
+
'
/cache/peers.cache
'
;
function
readPeersCache
()
function
readPeersCache
()
{
{
if
(
!
bfa
.
fs
.
existsSync
(
bfa
.
networkdir
+
'
/
peers
.
cache
'
)
)
if
(
!
bfa
.
fs
.
existsSync
(
peerscache
)
)
return
[];
return
[];
var
data
=
bfa
.
fs
.
readFileSync
(
bfa
.
networkdir
+
'
/
peers
.
cache
'
).
toString
();
var
data
=
bfa
.
fs
.
readFileSync
(
peerscache
).
toString
();
var
p
=
[];
var
p
=
[];
if
(
data
.
length
>
0
)
if
(
data
.
length
>
0
)
p
=
data
.
split
(
/
\r?\n
/
);
p
=
data
.
split
(
/
\r?\n
/
);
...
@@ -32,11 +35,10 @@ function writePeersCache( peers )
...
@@ -32,11 +35,10 @@ function writePeersCache( peers )
if
(
peers
.
length
>
100
)
if
(
peers
.
length
>
100
)
peers
.
splice
(
0
,
peers
.
length
-
100
);
peers
.
splice
(
0
,
peers
.
length
-
100
);
// peers.cache is a list of peers we have connected out to in the past.
// peers.cache is a list of peers we have connected out to in the past.
var
filename
=
bfa
.
networkdir
+
'
/peers.cache
'
;
var
txt
=
peers
.
join
(
"
\n
"
);
var
txt
=
peers
.
join
(
"
\n
"
);
if
(
txt
.
length
>
0
&&
(
txt
.
substring
(
txt
.
length
-
1
)
!=
"
\n
"
))
if
(
txt
.
length
>
0
&&
(
txt
.
substring
(
txt
.
length
-
1
)
!=
"
\n
"
))
txt
+=
"
\n
"
;
txt
+=
"
\n
"
;
bfa
.
fs
.
writeFileSync
(
filenam
e
,
txt
,
{
mode
:
0o644
}
);
bfa
.
fs
.
writeFileSync
(
peerscach
e
,
txt
,
{
mode
:
0o644
}
);
}
}
function
dnspeercachelookup
()
function
dnspeercachelookup
()
...
@@ -212,7 +214,11 @@ function mayseal()
...
@@ -212,7 +214,11 @@ function mayseal()
web3
.
bfa
.
clique
.
getSigners
(
web3
.
bfa
.
clique
.
getSigners
(
function
gotListOfSealers
(
e
,
x
)
function
gotListOfSealers
(
e
,
x
)
{
{
if
(
e
)
return
;
if
(
e
)
{
console
.
error
(
e
);
return
;
}
var
lcsealers
=
x
.
map
(
name
=>
name
.
toLowerCase
()
);
var
lcsealers
=
x
.
map
(
name
=>
name
.
toLowerCase
()
);
var
isSigner
=
(
lcsealers
.
indexOf
(
me
)
>
-
1
);
var
isSigner
=
(
lcsealers
.
indexOf
(
me
)
>
-
1
);
if
(
isSigner
)
if
(
isSigner
)
...
...
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