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
84969d2e
Commit
84969d2e
authored
Dec 14, 2021
by
hezhengjun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fetch logs when subscribeEvent again
parent
2b996d48
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
ethereum.go
plugin/dapp/cross2eth/ebrelayer/relayer/ethereum/ethereum.go
+4
-1
No files found.
plugin/dapp/cross2eth/ebrelayer/relayer/ethereum/ethereum.go
View file @
84969d2e
...
@@ -468,7 +468,7 @@ latter:
...
@@ -468,7 +468,7 @@ latter:
case
err
:=
<-
ethRelayer
.
bridgeBankSub
.
Err
()
:
case
err
:=
<-
ethRelayer
.
bridgeBankSub
.
Err
()
:
relayerLog
.
Error
(
"proc"
,
"bridgeBankSub err"
,
err
.
Error
())
relayerLog
.
Error
(
"proc"
,
"bridgeBankSub err"
,
err
.
Error
())
ethRelayer
.
subscribeEvent
()
ethRelayer
.
subscribeEvent
()
ethRelayer
.
filterLogEvents
()
case
vLog
:=
<-
ethRelayer
.
bridgeBankLog
:
case
vLog
:=
<-
ethRelayer
.
bridgeBankLog
:
ethRelayer
.
storeBridgeBankLogs
(
vLog
,
true
)
ethRelayer
.
storeBridgeBankLogs
(
vLog
,
true
)
case
chain33Msg
:=
<-
ethRelayer
.
chain33MsgChan
:
case
chain33Msg
:=
<-
ethRelayer
.
chain33MsgChan
:
...
@@ -718,6 +718,7 @@ func (ethRelayer *Relayer4Ethereum) procBridgeBankLogs(vLog types.Log) {
...
@@ -718,6 +718,7 @@ func (ethRelayer *Relayer4Ethereum) procBridgeBankLogs(vLog types.Log) {
}
}
}
}
//因为订阅事件的功能只会推送在订阅生效的高度之后的事件,之前订阅停止~当前订阅生效高度的这一段只能通过FilterLogs来获取事件信息,否则就会遗漏
func
(
ethRelayer
*
Relayer4Ethereum
)
filterLogEvents
()
{
func
(
ethRelayer
*
Relayer4Ethereum
)
filterLogEvents
()
{
deployHeight
,
_
:=
ethtxs
.
GetDeployHeight
(
ethRelayer
.
clientSpec
,
ethRelayer
.
x2EthDeployInfo
.
BridgeRegistry
.
Address
,
ethRelayer
.
x2EthDeployInfo
.
BridgeRegistry
.
Address
)
deployHeight
,
_
:=
ethtxs
.
GetDeployHeight
(
ethRelayer
.
clientSpec
,
ethRelayer
.
x2EthDeployInfo
.
BridgeRegistry
.
Address
,
ethRelayer
.
x2EthDeployInfo
.
BridgeRegistry
.
Address
)
height4BridgeBankLogAt
:=
int64
(
ethRelayer
.
getHeight4BridgeBankLogAt
())
height4BridgeBankLogAt
:=
int64
(
ethRelayer
.
getHeight4BridgeBankLogAt
())
...
@@ -756,6 +757,7 @@ func (ethRelayer *Relayer4Ethereum) filterLogEvents() {
...
@@ -756,6 +757,7 @@ func (ethRelayer *Relayer4Ethereum) filterLogEvents() {
}
}
}
}
//因为订阅事件的功能只会推送在订阅生效的高度之后的事件,之前订阅停止~当前订阅生效高度的这一段只能通过FilterLogs来获取事件信息,否则就会遗漏
func
(
ethRelayer
*
Relayer4Ethereum
)
filterLogEventsProc
(
logchan
chan
<-
types
.
Log
,
done
chan
<-
int
,
title
string
,
curHeight
,
heightLogProcAt
int64
,
contractAddr
common
.
Address
,
eventSig
map
[
string
]
bool
)
{
func
(
ethRelayer
*
Relayer4Ethereum
)
filterLogEventsProc
(
logchan
chan
<-
types
.
Log
,
done
chan
<-
int
,
title
string
,
curHeight
,
heightLogProcAt
int64
,
contractAddr
common
.
Address
,
eventSig
map
[
string
]
bool
)
{
relayerLog
.
Info
(
title
,
"eventSig"
,
eventSig
,
"heightLogProcAt"
,
heightLogProcAt
,
"curHeight"
,
curHeight
)
relayerLog
.
Info
(
title
,
"eventSig"
,
eventSig
,
"heightLogProcAt"
,
heightLogProcAt
,
"curHeight"
,
curHeight
)
...
@@ -823,6 +825,7 @@ func (ethRelayer *Relayer4Ethereum) subscribeEvent() {
...
@@ -823,6 +825,7 @@ func (ethRelayer *Relayer4Ethereum) subscribeEvent() {
targetAddress
:=
ethRelayer
.
bridgeBankAddr
targetAddress
:=
ethRelayer
.
bridgeBankAddr
// We need the target address in bytes[] for the query
// We need the target address in bytes[] for the query
//因为订阅事件的功能只会推送在订阅生效的高度之后的事件,所以FromBlock只需要填写1就可以了
query
:=
ethereum
.
FilterQuery
{
query
:=
ethereum
.
FilterQuery
{
Addresses
:
[]
common
.
Address
{
targetAddress
},
Addresses
:
[]
common
.
Address
{
targetAddress
},
FromBlock
:
big
.
NewInt
(
int64
(
1
)),
FromBlock
:
big
.
NewInt
(
int64
(
1
)),
...
...
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