Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nucleo
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
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
Miguel Montes
nucleo
Commits
a499e066
Commit
a499e066
authored
6 years ago
by
Robert Martin-Legene
Browse files
Options
Downloads
Patches
Plain Diff
monitor.js will keep trying to unlock locked keys, using an empty passphrase.
parent
a10f02d8
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
+43
-8
43 additions, 8 deletions
bin/monitor.js
with
43 additions
and
8 deletions
bin/monitor.js
+
43
−
8
View file @
a499e066
...
@@ -7,13 +7,7 @@
...
@@ -7,13 +7,7 @@
const
Libbfa
=
require
(
process
.
env
.
BFAHOME
+
'
/bin/libbfa.js
'
);
const
Libbfa
=
require
(
process
.
env
.
BFAHOME
+
'
/bin/libbfa.js
'
);
var
bfa
=
new
Libbfa
();
var
bfa
=
new
Libbfa
();
var
web3
=
bfa
.
newweb3
();
var
web3
=
bfa
.
newweb3
();
var
lastUnlock
=
0
;
function
pluralEnglish
(
num
,
single
,
plural
)
{
if
(
num
==
1
)
return
single
;
return
plural
;
}
function
peerlist
()
function
peerlist
()
{
{
...
@@ -89,7 +83,7 @@ function peerlist()
...
@@ -89,7 +83,7 @@ function peerlist()
console
.
log
(
console
.
log
(
"
We have
"
"
We have
"
+
nowpeers
.
length
+
nowpeers
.
length
+
"
peer
"
+
pluralEnglish
(
nowpeers
.
length
,
''
,
'
s
'
)
+
"
, so will try to connect to
"
+
"
peer
"
+
(
nowpeers
.
length
==
1
?
''
:
'
s
'
)
+
"
, so will try to connect to
"
+
enode
+
enode
);
);
web3
.
eth
.
bfaAdminaddPeer
(
enode
);
web3
.
eth
.
bfaAdminaddPeer
(
enode
);
...
@@ -167,10 +161,51 @@ function mayseal()
...
@@ -167,10 +161,51 @@ function mayseal()
);
);
}
}
function
unlock
()
{
var
now
=
new
Date
();
if
(
lastUnlock
+
600
>
now
)
return
;
lastUnlock
=
now
;
web3
.
eth
.
personal
.
bfalistWallets
()
.
then
(
function
pushone
(
x
)
{
var
i
=
x
.
length
;
var
wallets
=
new
Array
();
while
(
i
--
>
0
)
if
(
x
[
i
].
status
==
"
Locked
"
)
wallets
.
push
(
x
[
i
]
);
i
=
wallets
.
length
;
if
(
i
==
0
)
return
;
var
promises
=
new
Array
();
while
(
i
--
>
0
)
{
var
j
=
wallets
[
i
].
accounts
.
length
;
while
(
j
--
>
0
)
{
var
addr
=
wallets
[
i
].
accounts
[
j
].
address
;
var
promise
=
web3
.
eth
.
personal
.
unlockAccount
(
addr
,
""
,
0
)
.
catch
(
error
=>
{
}
);
promises
.
push
(
promise
);
}
}
}
,
function
err
(
x
)
{
// we don't care?
}
)
}
function
timer
()
function
timer
()
{
{
peerlist
();
peerlist
();
mayseal
();
mayseal
();
unlock
();
}
}
peerlist
();
peerlist
();
...
...
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