Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
2f3651a5
Commit
2f3651a5
authored
Feb 20, 2018
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add Listen on last block API
parent
9d4cbb79
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
12 deletions
+19
-12
execution-context.js
remix-lib/src/execution/execution-context.js
+19
-12
No files found.
remix-lib/src/execution/execution-context.js
View file @
2f3651a5
...
@@ -83,6 +83,9 @@ function ExecutionContext () {
...
@@ -83,6 +83,9 @@ function ExecutionContext () {
var
executionContext
=
null
var
executionContext
=
null
this
.
blockGasLimitDefault
=
4300000
this
.
blockGasLimit
=
this
.
blockGasLimitDefault
this
.
init
=
function
(
config
)
{
this
.
init
=
function
(
config
)
{
if
(
config
.
get
(
'settings/always-use-vm'
))
{
if
(
config
.
get
(
'settings/always-use-vm'
))
{
executionContext
=
'vm'
executionContext
=
'vm'
...
@@ -184,17 +187,22 @@ function ExecutionContext () {
...
@@ -184,17 +187,22 @@ function ExecutionContext () {
return
this
.
blockGasLimit
return
this
.
blockGasLimit
}
}
this
.
blockGasLimitDefault
=
4300000
this
.
stopListenOnLastBlock
=
function
()
{
this
.
blockGasLimit
=
this
.
blockGasLimitDefault
if
(
this
.
listenOnLastBlockId
)
clearInterval
(
this
.
listenOnLastBlockId
)
// removing the setinterval cause it cause tape test to hang and we don't need this.
this
.
listenOnLastBlockId
=
null
// there's a copy of this file in remix-ide repo @TODO to refactor
}
if
(
this
.
getProvider
()
!==
'vm'
)
{
web3
.
eth
.
getBlock
(
'latest'
,
(
err
,
block
)
=>
{
this
.
listenOnLastBlock
=
function
()
{
if
(
!
err
)
{
this
.
listenOnLastBlockId
=
setInterval
(()
=>
{
// we can't use the blockGasLimit cause the next blocks could have a lower limit : https://github.com/ethereum/remix/issues/506
if
(
this
.
getProvider
()
!==
'vm'
)
{
this
.
blockGasLimit
=
(
block
&&
block
.
gasLimit
)
?
Math
.
floor
(
block
.
gasLimit
-
(
5
*
block
.
gasLimit
)
/
1024
)
:
this
.
blockGasLimitDefault
web3
.
eth
.
getBlock
(
'latest'
,
(
err
,
block
)
=>
{
}
else
{
if
(
!
err
)
{
this
.
blockGasLimit
=
this
.
blockGasLimitDefault
// we can't use the blockGasLimit cause the next blocks could have a lower limit : https://github.com/ethereum/remix/issues/506
this
.
blockGasLimit
=
(
block
&&
block
.
gasLimit
)
?
Math
.
floor
(
block
.
gasLimit
-
(
5
*
block
.
gasLimit
)
/
1024
)
:
this
.
blockGasLimitDefault
}
else
{
this
.
blockGasLimit
=
this
.
blockGasLimitDefault
}
},
15000
)
}
}
})
})
}
}
...
@@ -224,4 +232,3 @@ function ExecutionContext () {
...
@@ -224,4 +232,3 @@ function ExecutionContext () {
}
}
module
.
exports
=
new
ExecutionContext
()
module
.
exports
=
new
ExecutionContext
()
Write
Preview
Markdown
is supported
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