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
be1093af
Commit
be1093af
authored
Dec 05, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
run tx synced way if javascript vm
parent
b7b09951
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
txRunner.js
src/app/execution/txRunner.js
+11
-1
universal-dapp.js
src/universal-dapp.js
+0
-2
No files found.
src/app/execution/txRunner.js
View file @
be1093af
...
@@ -6,14 +6,16 @@ var BN = ethJSUtil.BN
...
@@ -6,14 +6,16 @@ var BN = ethJSUtil.BN
var
executionContext
=
require
(
'../../execution-context'
)
var
executionContext
=
require
(
'../../execution-context'
)
function
TxRunner
(
vmaccounts
,
opts
)
{
function
TxRunner
(
vmaccounts
,
opts
)
{
this
.
queueTxs
=
opts
.
queueTxs
this
.
personalMode
=
opts
.
personalMode
this
.
personalMode
=
opts
.
personalMode
this
.
blockNumber
=
0
this
.
blockNumber
=
0
this
.
runAsync
=
true
if
(
executionContext
.
isVM
())
{
if
(
executionContext
.
isVM
())
{
this
.
blockNumber
=
1150000
// The VM is running in Homestead mode, which started at this block.
this
.
blockNumber
=
1150000
// The VM is running in Homestead mode, which started at this block.
this
.
runAsync
=
false
}
}
this
.
pendingTxs
=
{}
this
.
pendingTxs
=
{}
this
.
vmaccounts
=
vmaccounts
this
.
vmaccounts
=
vmaccounts
this
.
queusTxs
=
[]
}
}
TxRunner
.
prototype
.
rawRun
=
function
(
args
,
cb
)
{
TxRunner
.
prototype
.
rawRun
=
function
(
args
,
cb
)
{
...
@@ -147,11 +149,19 @@ function tryTillResponse (txhash, done) {
...
@@ -147,11 +149,19 @@ function tryTillResponse (txhash, done) {
}
}
function
run
(
self
,
tx
,
stamp
,
callback
)
{
function
run
(
self
,
tx
,
stamp
,
callback
)
{
if
(
!
self
.
runAsync
&&
Object
.
keys
(
self
.
pendingTxs
).
length
)
{
self
.
queusTxs
.
push
({
tx
,
stamp
,
callback
})
}
else
{
self
.
pendingTxs
[
stamp
]
=
tx
self
.
pendingTxs
[
stamp
]
=
tx
self
.
execute
(
tx
,
(
error
,
result
)
=>
{
self
.
execute
(
tx
,
(
error
,
result
)
=>
{
delete
self
.
pendingTxs
[
stamp
]
delete
self
.
pendingTxs
[
stamp
]
callback
(
error
,
result
)
callback
(
error
,
result
)
if
(
Object
.
keys
(
self
.
pendingTxs
).
length
)
{
var
next
=
self
.
pendingTxs
.
pop
()
run
(
self
,
next
.
tx
,
next
.
stamp
,
next
.
callback
)
}
})
})
}
}
}
module
.
exports
=
TxRunner
module
.
exports
=
TxRunner
src/universal-dapp.js
View file @
be1093af
...
@@ -172,7 +172,6 @@ function UniversalDApp (opts = {}) {
...
@@ -172,7 +172,6 @@ function UniversalDApp (opts = {}) {
self
.
reset
(
self
.
contracts
)
self
.
reset
(
self
.
contracts
)
})
})
self
.
txRunner
=
new
TxRunner
({},
{
self
.
txRunner
=
new
TxRunner
({},
{
queueTxs
:
true
,
personalMode
:
this
.
personalMode
personalMode
:
this
.
personalMode
})
})
}
}
...
@@ -193,7 +192,6 @@ UniversalDApp.prototype.reset = function (contracts, transactionContextAPI) {
...
@@ -193,7 +192,6 @@ UniversalDApp.prototype.reset = function (contracts, transactionContextAPI) {
executionContext
.
vm
().
stateManager
.
cache
.
flush
(
function
()
{})
executionContext
.
vm
().
stateManager
.
cache
.
flush
(
function
()
{})
}
}
this
.
txRunner
=
new
TxRunner
(
this
.
accounts
,
{
this
.
txRunner
=
new
TxRunner
(
this
.
accounts
,
{
queueTxs
:
true
,
personalMode
:
this
.
personalMode
personalMode
:
this
.
personalMode
})
})
}
}
...
...
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