Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
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
exchain
nebula
Commits
27e4077e
Unverified
Commit
27e4077e
authored
Aug 25, 2021
by
Mark Tyneway
Committed by
GitHub
Aug 25, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1389 from TransmissionsDev/patch-2
Watcher: Make blocks to fetch a config option
parents
9c99393f
2aa4416e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
real-cooks-lick.md
.changeset/real-cooks-lick.md
+5
-0
watcher.ts
packages/core-utils/src/watcher.ts
+6
-2
No files found.
.changeset/real-cooks-lick.md
0 → 100644
View file @
27e4077e
---
"
@eth-optimism/core-utils"
:
patch
---
Watcher: Make blocks to fetch a config option
packages/core-utils/src/watcher.ts
View file @
27e4077e
...
...
@@ -11,13 +11,14 @@ export interface WatcherOptions {
l1
:
Layer
l2
:
Layer
pollInterval
?:
number
blocksToFetch
?:
number
}
export
class
Watcher
{
public
l1
:
Layer
public
l2
:
Layer
public
pollInterval
=
3000
public
NUM_BLOCKS_TO_FETCH
=
9
_999
public
blocksToFetch
=
2000
constructor
(
opts
:
WatcherOptions
)
{
this
.
l1
=
opts
.
l1
...
...
@@ -25,6 +26,9 @@ export class Watcher {
if
(
opts
.
pollInterval
)
{
this
.
pollInterval
=
opts
.
pollInterval
}
if
(
opts
.
blocksToFetch
)
{
this
.
blocksToFetch
=
opts
.
blocksToFetch
}
}
public
async
getMessageHashesFromL1Tx
(
l1TxHash
:
string
):
Promise
<
string
[]
>
{
...
...
@@ -83,7 +87,7 @@ export class Watcher {
// scan for transaction with specified message
while
(
matches
.
length
===
0
)
{
const
blockNumber
=
await
layer
.
provider
.
getBlockNumber
()
const
startingBlock
=
Math
.
max
(
blockNumber
-
this
.
NUM_BLOCKS_TO_FETCH
,
0
)
const
startingBlock
=
Math
.
max
(
blockNumber
-
this
.
blocksToFetch
,
0
)
const
successFilter
:
ethers
.
providers
.
Filter
=
{
address
:
layer
.
messengerAddress
,
topics
:
[
ethers
.
utils
.
id
(
`RelayedMessage(bytes32)`
)],
...
...
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