Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
5b1424ea
Commit
5b1424ea
authored
Nov 13, 2019
by
harrylee
Committed by
vipwzw
Nov 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add auto_rollback for evm exec_local
parent
57929eaf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
18 deletions
+5
-18
exec_del_local.go
plugin/dapp/evm/executor/exec_del_local.go
+4
-17
exec_local.go
plugin/dapp/evm/executor/exec_local.go
+1
-1
No files found.
plugin/dapp/evm/executor/exec_del_local.go
View file @
5b1424ea
...
@@ -20,24 +20,11 @@ func (evm *EVMExecutor) ExecDelLocal(tx *types.Transaction, receipt *types.Recei
...
@@ -20,24 +20,11 @@ func (evm *EVMExecutor) ExecDelLocal(tx *types.Transaction, receipt *types.Recei
}
}
cfg
:=
evm
.
GetAPI
()
.
GetConfig
()
cfg
:=
evm
.
GetAPI
()
.
GetConfig
()
if
cfg
.
IsDappFork
(
evm
.
GetHeight
(),
"evm"
,
evmtypes
.
ForkEVMState
)
{
if
cfg
.
IsDappFork
(
evm
.
GetHeight
(),
"evm"
,
evmtypes
.
ForkEVMState
)
{
// 需要将Exec中生成的合约状态变更信息从localdb中恢复
kvs
,
err
:=
evm
.
DelRollbackKV
(
tx
,
[]
byte
(
evmtypes
.
ExecutorName
))
for
_
,
logItem
:=
range
receipt
.
Logs
{
if
err
!=
nil
{
if
evmtypes
.
TyLogEVMStateChangeItem
==
logItem
.
Ty
{
return
nil
,
err
data
:=
logItem
.
Log
var
changeItem
evmtypes
.
EVMStateChangeItem
err
=
types
.
Decode
(
data
,
&
changeItem
)
if
err
!=
nil
{
return
set
,
err
}
set
.
KV
=
append
(
set
.
KV
,
&
types
.
KeyValue
{
Key
:
[]
byte
(
changeItem
.
Key
),
Value
:
changeItem
.
PreValue
})
}
}
}
set
.
KV
=
kvs
}
}
kvs
:=
set
.
KV
//reverse kvs
for
left
,
right
:=
0
,
len
(
kvs
)
-
1
;
left
<
right
;
left
,
right
=
left
+
1
,
right
-
1
{
kvs
[
left
],
kvs
[
right
]
=
kvs
[
right
],
kvs
[
left
]
}
set
.
KV
=
kvs
return
set
,
err
return
set
,
err
}
}
plugin/dapp/evm/executor/exec_local.go
View file @
5b1424ea
...
@@ -43,6 +43,6 @@ func (evm *EVMExecutor) ExecLocal(tx *types.Transaction, receipt *types.ReceiptD
...
@@ -43,6 +43,6 @@ func (evm *EVMExecutor) ExecLocal(tx *types.Transaction, receipt *types.ReceiptD
}
}
}
}
}
}
set
.
KV
=
evm
.
AddRollbackKV
(
tx
,
[]
byte
(
evmtypes
.
ExecutorName
),
set
.
KV
)
return
set
,
err
return
set
,
err
}
}
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