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
20e54006
Unverified
Commit
20e54006
authored
Feb 27, 2018
by
yann300
Committed by
GitHub
Feb 27, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #701 from yann300/executionContext_ListenOnLastBlock
Execution context: listen on last block API
parents
8f6cd8f9
2f3651a5
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 @
20e54006
...
...
@@ -83,6 +83,9 @@ function ExecutionContext () {
var
executionContext
=
null
this
.
blockGasLimitDefault
=
4300000
this
.
blockGasLimit
=
this
.
blockGasLimitDefault
this
.
init
=
function
(
config
)
{
if
(
config
.
get
(
'settings/always-use-vm'
))
{
executionContext
=
'vm'
...
...
@@ -184,17 +187,22 @@ function ExecutionContext () {
return
this
.
blockGasLimit
}
this
.
blockGasLimitDefault
=
4300000
this
.
blockGasLimit
=
this
.
blockGasLimitDefault
// removing the setinterval cause it cause tape test to hang and we don't need this.
// there's a copy of this file in remix-ide repo @TODO to refactor
if
(
this
.
getProvider
()
!==
'vm'
)
{
web3
.
eth
.
getBlock
(
'latest'
,
(
err
,
block
)
=>
{
if
(
!
err
)
{
// 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
this
.
stopListenOnLastBlock
=
function
()
{
if
(
this
.
listenOnLastBlockId
)
clearInterval
(
this
.
listenOnLastBlockId
)
this
.
listenOnLastBlockId
=
null
}
this
.
listenOnLastBlock
=
function
()
{
this
.
listenOnLastBlockId
=
setInterval
(()
=>
{
if
(
this
.
getProvider
()
!==
'vm'
)
{
web3
.
eth
.
getBlock
(
'latest'
,
(
err
,
block
)
=>
{
if
(
!
err
)
{
// 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 () {
}
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