@@ -44,8 +44,8 @@ func (b *bundleFetcher) Run() {
44
44
eventCh := make (chan core.ChainHeadEvent )
45
45
b .backend .BlockChain ().SubscribeChainHeadEvent (eventCh )
46
46
pushBlockNum := func () {
47
- for blockNum := range eventCh {
48
- b .blockNumCh <- blockNum .Block .Header ().Number .Int64 ()
47
+ for currentBlockNum := range eventCh {
48
+ b .blockNumCh <- currentBlockNum .Block .Header ().Number .Int64 ()
49
49
}
50
50
}
51
51
addMevBundle := func () {
@@ -75,37 +75,37 @@ func (b *bundleFetcher) Run() {
75
75
}
76
76
77
77
func (b * bundleFetcher ) fetchAndPush (ctx context.Context , pushMevBundles func (bundles []DbBundle )) {
78
- var blockNum int64
78
+ var currentBlockNum int64
79
79
lowPrioBundleTicker := time .NewTicker (time .Second * 2 )
80
80
defer lowPrioBundleTicker .Stop ()
81
81
82
82
for {
83
83
select {
84
- case blockNum = <- b .blockNumCh :
84
+ case currentBlockNum = <- b .blockNumCh :
85
85
ctxH , cancelH := context .WithTimeout (ctx , time .Second * 3 )
86
- bundles , err := b .db .GetPriorityBundles (ctxH , blockNum , true )
86
+ bundles , err := b .db .GetPriorityBundles (ctxH , currentBlockNum + 1 , true )
87
87
cancelH ()
88
88
if err != nil {
89
89
log .Error ("failed to fetch high prio bundles" , "err" , err )
90
90
continue
91
91
}
92
- log .Info ("Fetching High prio bundles" , "size" , len (bundles ), "blockNum " , blockNum )
92
+ log .Info ("Fetching High prio bundles" , "size" , len (bundles ), "currentlyBuiltBlockNum " , currentBlockNum + 1 )
93
93
if len (bundles ) != 0 {
94
94
pushMevBundles (bundles )
95
95
}
96
96
97
97
case <- lowPrioBundleTicker .C :
98
- if blockNum == 0 {
98
+ if currentBlockNum == 0 {
99
99
continue
100
100
}
101
101
ctxL , cancelL := context .WithTimeout (ctx , time .Second * 3 )
102
- bundles , err := b .db .GetPriorityBundles (ctxL , blockNum , false )
102
+ bundles , err := b .db .GetPriorityBundles (ctxL , currentBlockNum + 1 , false )
103
103
cancelL ()
104
104
if err != nil {
105
105
log .Error ("failed to fetch low prio bundles" , "err" , err )
106
106
continue
107
107
}
108
- log .Info ("Fetching low prio bundles" , "len" , len (bundles ), "blockNum " , blockNum )
108
+ log .Info ("Fetching low prio bundles" , "len" , len (bundles ), "currentlyBuiltBlockNum " , currentBlockNum + 1 )
109
109
if len (bundles ) != 0 {
110
110
pushMevBundles (bundles )
111
111
}
0 commit comments