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
a87242b2
Commit
a87242b2
authored
Dec 22, 2021
by
hezhengjun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set gas directly for transfer
parent
d5ca6be9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
+13
-13
ethereum.go
plugin/dapp/cross2eth/ebrelayer/relayer/ethereum/ethereum.go
+1
-1
utils.go
...dapp/cross2eth/ebrelayer/relayer/ethereum/ethtxs/utils.go
+12
-12
No files found.
plugin/dapp/cross2eth/ebrelayer/relayer/ethereum/ethereum.go
View file @
a87242b2
...
@@ -664,7 +664,7 @@ func (ethRelayer *Relayer4Ethereum) handleLogWithdraw(chain33Msg *events.Chain33
...
@@ -664,7 +664,7 @@ func (ethRelayer *Relayer4Ethereum) handleLogWithdraw(chain33Msg *events.Chain33
}
}
//param: from,to,evm-packdata,amount
//param: from,to,evm-packdata,amount
//交易构造
//交易构造
tx
,
err
:=
ethtxs
.
NewTx
(
ethRelayer
.
clientSpec
,
ethRelayer
.
ethSender
,
toAddr
,
intputData
,
value
)
tx
,
err
:=
ethtxs
.
NewT
ransferT
x
(
ethRelayer
.
clientSpec
,
ethRelayer
.
ethSender
,
toAddr
,
intputData
,
value
)
if
err
!=
nil
{
if
err
!=
nil
{
relayerLog
.
Error
(
"handleLogWithdraw"
,
"newTx err"
,
err
)
relayerLog
.
Error
(
"handleLogWithdraw"
,
"newTx err"
,
err
)
err
=
errors
.
New
(
"ErrNewTx"
)
err
=
errors
.
New
(
"ErrNewTx"
)
...
...
plugin/dapp/cross2eth/ebrelayer/relayer/ethereum/ethtxs/utils.go
View file @
a87242b2
...
@@ -148,7 +148,7 @@ func GetEthTxStatus(client ethinterface.EthClientSpec, txhash common.Hash) strin
...
@@ -148,7 +148,7 @@ func GetEthTxStatus(client ethinterface.EthClientSpec, txhash common.Hash) strin
return
status
return
status
}
}
func
NewTx
(
clientSpec
ethinterface
.
EthClientSpec
,
from
,
to
common
.
Address
,
input
[]
byte
,
value
*
big
.
Int
)
(
*
types
.
Transaction
,
error
)
{
func
NewT
ransferT
x
(
clientSpec
ethinterface
.
EthClientSpec
,
from
,
to
common
.
Address
,
input
[]
byte
,
value
*
big
.
Int
)
(
*
types
.
Transaction
,
error
)
{
price
,
err
:=
clientSpec
.
SuggestGasPrice
(
context
.
Background
())
price
,
err
:=
clientSpec
.
SuggestGasPrice
(
context
.
Background
())
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
@@ -160,17 +160,17 @@ func NewTx(clientSpec ethinterface.EthClientSpec, from, to common.Address, input
...
@@ -160,17 +160,17 @@ func NewTx(clientSpec ethinterface.EthClientSpec, from, to common.Address, input
}
}
var
gas
uint64
=
21000
var
gas
uint64
=
21000
if
input
!=
nil
{
if
input
!=
nil
{
var
msg
ethereum
.
CallMsg
//
var msg ethereum.CallMsg
msg
.
To
=
&
to
//
msg.To = &to
msg
.
Data
=
input
//
msg.Data = input
gas
,
err
=
clientSpec
.
EstimateGas
(
context
.
Background
(),
msg
)
//
gas, err = clientSpec.EstimateGas(context.Background(), msg)
if
err
!=
nil
{
//
if err != nil {
//return nil,err
//
//return nil,err
txslog
.
Error
(
"handleLogWithdraw"
,
"EstimateGas err"
,
err
)
//
txslog.Error("handleLogWithdraw", "EstimateGas err", err)
gas
=
80000
//
gas = 80000
}
//
}
//
略微增加gas数量,>=120%
//
实际测试"cumulativeGasUsed": "0xdc82",
gas
=
uint64
(
float64
(
gas
)
*
1.2
)
gas
=
uint64
(
80000
)
}
}
ntx
:=
types
.
NewTx
(
&
types
.
LegacyTx
{
ntx
:=
types
.
NewTx
(
&
types
.
LegacyTx
{
...
...
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