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
e80678c4
Commit
e80678c4
authored
Dec 21, 2021
by
hezhengjun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add status descption
parent
30c2103a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
10 deletions
+34
-10
ethereum.go
plugin/dapp/cross2eth/ebrelayer/relayer/ethereum/ethereum.go
+8
-6
types.go
...dapp/cross2eth/ebrelayer/relayer/ethereum/ethtxs/types.go
+17
-3
store.go
plugin/dapp/cross2eth/ebrelayer/relayer/ethereum/store.go
+9
-1
No files found.
plugin/dapp/cross2eth/ebrelayer/relayer/ethereum/ethereum.go
View file @
e80678c4
...
@@ -476,18 +476,17 @@ func (ethRelayer *Relayer4Ethereum) proc() {
...
@@ -476,18 +476,17 @@ func (ethRelayer *Relayer4Ethereum) proc() {
ethRelayer
.
rwLock
.
RUnlock
()
ethRelayer
.
rwLock
.
RUnlock
()
if
nil
!=
privateKey4Ethereum
&&
nilAddr
!=
ethRelayer
.
bridgeRegistryAddr
{
if
nil
!=
privateKey4Ethereum
&&
nilAddr
!=
ethRelayer
.
bridgeRegistryAddr
{
relayerLog
.
Info
(
"Ethereum relayer starts to run..."
)
relayerLog
.
Info
(
"Ethereum relayer starts to run..."
)
timer
=
time
.
NewTicker
(
time
.
Duration
(
ethRelayer
.
fetchHeightPeriodMs
)
*
time
.
Millisecond
)
ethRelayer
.
prePareSubscribeEvent
()
ethRelayer
.
prePareSubscribeEvent
()
//向bridgeBank订阅事件
//向bridgeBank订阅事件
ethRelayer
.
subscribeEvent
()
ethRelayer
.
subscribeEvent
()
ethRelayer
.
filterLogEvents
()
ethRelayer
.
filterLogEvents
()
relayerLog
.
Info
(
"Ethereum relayer starts to process online log event..."
)
relayerLog
.
Info
(
"Ethereum relayer starts to process online log event..."
)
goto
burnLockWithProc
timer
=
time
.
NewTicker
(
time
.
Duration
(
ethRelayer
.
fetchHeightPeriodMs
)
*
time
.
Millisecond
)
goto
burnLockWithdrawProc
}
}
}
}
burnLockWithProc
:
burnLockWith
draw
Proc
:
for
{
for
{
select
{
select
{
case
<-
timer
.
C
:
case
<-
timer
.
C
:
...
@@ -562,13 +561,15 @@ func (ethRelayer *Relayer4Ethereum) handleLogWithdraw(chain33Msg *events.Chain33
...
@@ -562,13 +561,15 @@ func (ethRelayer *Relayer4Ethereum) handleLogWithdraw(chain33Msg *events.Chain33
Month
:
int32
(
month
),
Month
:
int32
(
month
),
Day
:
int32
(
day
),
Day
:
int32
(
day
),
}
}
//非代理提币人模式,则不处理代理提币
if
!
ethRelayer
.
processWithDraw
{
if
!
ethRelayer
.
processWithDraw
{
relayerLog
.
Info
(
"handleLogWithdraw"
,
"Needn't process withdraw for this relay validator"
,
ethRelayer
.
ethSender
)
relayerLog
.
Info
(
"handleLogWithdraw"
,
"Needn't process withdraw for this relay validator"
,
ethRelayer
.
ethSender
)
return
return
}
}
defer
func
()
{
defer
func
()
{
if
err
!=
nil
{
if
err
!=
nil
{
withdrawTx
.
Status
=
int32
(
ethtxs
.
WDError
)
withdrawTx
.
StatusDescription
=
ethtxs
.
WDError
.
String
()
withdrawTx
.
ErrorDescription
=
err
.
Error
()
withdrawTx
.
ErrorDescription
=
err
.
Error
()
relayerLog
.
Error
(
"handleLogWithdraw"
,
"Failed to withdraw due to:"
,
err
.
Error
())
relayerLog
.
Error
(
"handleLogWithdraw"
,
"Failed to withdraw due to:"
,
err
.
Error
())
}
}
...
@@ -687,7 +688,8 @@ func (ethRelayer *Relayer4Ethereum) handleLogWithdraw(chain33Msg *events.Chain33
...
@@ -687,7 +688,8 @@ func (ethRelayer *Relayer4Ethereum) handleLogWithdraw(chain33Msg *events.Chain33
}
}
relayerLog
.
Info
(
"handleLogWithdraw"
,
"SendTransaction Hash"
,
signedTx
.
Hash
())
relayerLog
.
Info
(
"handleLogWithdraw"
,
"SendTransaction Hash"
,
signedTx
.
Hash
())
withdrawTx
.
StatusDescription
=
"Withdraw Tx has been sent to Ethereum"
withdrawTx
.
Status
=
int32
(
ethtxs
.
WDPending
)
withdrawTx
.
StatusDescription
=
ethtxs
.
WDPending
.
String
()
withdrawTx
.
TxHashOnEthereum
=
signedTx
.
Hash
()
.
String
()
withdrawTx
.
TxHashOnEthereum
=
signedTx
.
Hash
()
.
String
()
return
return
}
}
...
...
plugin/dapp/cross2eth/ebrelayer/relayer/ethereum/ethtxs/types.go
View file @
e80678c4
...
@@ -9,9 +9,9 @@ import (
...
@@ -9,9 +9,9 @@ import (
//const ...
//const ...
const
(
const
(
X2Eth
=
"x2ethereum"
X2Eth
=
"x2ethereum"
BurnAction
=
"Chain33ToEthBurn"
BurnAction
=
"Chain33ToEthBurn"
LockAction
=
"Chain33ToEthLock"
LockAction
=
"Chain33ToEthLock"
EthNullAddr
=
"0x0000000000000000000000000000000000000000"
EthNullAddr
=
"0x0000000000000000000000000000000000000000"
)
)
...
@@ -32,3 +32,17 @@ type ProphecyClaim struct {
...
@@ -32,3 +32,17 @@ type ProphecyClaim struct {
Amount
*
big
.
Int
Amount
*
big
.
Int
chain33TxHash
[]
byte
chain33TxHash
[]
byte
}
}
type
WithdrawStatus
int32
const
(
WDError
=
WithdrawStatus
(
1
)
WDPending
=
WithdrawStatus
(
2
)
WDFailed
=
WithdrawStatus
(
3
)
WDSuccess
=
WithdrawStatus
(
4
)
)
// 此处的名字命令不能随意改动,需要与合约event中的命名完全一致
func
(
d
WithdrawStatus
)
String
()
string
{
return
[
...
]
string
{
"undefined"
,
"Error,not submitted to ethereum"
,
"Pending"
,
"Submitted to ethereum, but Failed"
,
"Success"
}[
d
]
}
plugin/dapp/cross2eth/ebrelayer/relayer/ethereum/store.go
View file @
e80678c4
...
@@ -449,7 +449,15 @@ func (ethRelayer *Relayer4Ethereum) setWithdraw(withdrawTx *ebTypes.WithdrawTx)
...
@@ -449,7 +449,15 @@ func (ethRelayer *Relayer4Ethereum) setWithdraw(withdrawTx *ebTypes.WithdrawTx)
key
:=
calcWithdrawKey
(
chain33Sender
,
symbol
,
int
(
year
),
int
(
month
),
int
(
day
),
withdrawTx
.
Nonce
)
key
:=
calcWithdrawKey
(
chain33Sender
,
symbol
,
int
(
year
),
int
(
month
),
int
(
day
),
withdrawTx
.
Nonce
)
bytes
:=
chain33Types
.
Encode
(
withdrawTx
)
bytes
:=
chain33Types
.
Encode
(
withdrawTx
)
return
ethRelayer
.
db
.
Set
(
key
,
bytes
)
if
err
:=
ethRelayer
.
db
.
Set
(
key
,
bytes
);
nil
!=
err
{
return
err
}
//保存按照次序提币的交易,方便查询
listKey
:=
calcWithdrawListKey
(
withdrawTx
.
Nonce
)
listData
:=
key
return
ethRelayer
.
db
.
Set
(
listKey
,
listData
)
}
}
func
(
ethRelayer
*
Relayer4Ethereum
)
getWithdrawsWithinSameDay
(
withdrawTx
*
ebTypes
.
WithdrawTx
)
(
*
big
.
Int
,
error
)
{
func
(
ethRelayer
*
Relayer4Ethereum
)
getWithdrawsWithinSameDay
(
withdrawTx
*
ebTypes
.
WithdrawTx
)
(
*
big
.
Int
,
error
)
{
...
...
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