Skip to content

Commit 0300026

Browse files
Fix: linter
1 parent 4a23018 commit 0300026

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

node/monitor.go

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ const (
1919
filterRefused = "refused"
2020
filterBranchRefused = "branch_refused"
2121
filterBranchDelayed = "branch_delayed"
22-
filterUnprocessed = "unprocessed"
2322
)
2423

2524
// Monitor -
@@ -40,8 +39,8 @@ type Monitor struct {
4039
}
4140

4241
// NewMonitor -
43-
func NewMonitor(url string) Monitor {
44-
return Monitor{
42+
func NewMonitor(url string) *Monitor {
43+
return &Monitor{
4544
url: strings.TrimSuffix(url, "/"),
4645
applied: make(chan []*Applied, 4096),
4746
refused: make(chan []*Applied, 4096),
@@ -51,7 +50,7 @@ func NewMonitor(url string) Monitor {
5150
}
5251

5352
// SubscribeOnMempoolApplied -
54-
func (monitor Monitor) SubscribeOnMempoolApplied(ctx context.Context) {
53+
func (monitor *Monitor) SubscribeOnMempoolApplied(ctx context.Context) {
5554
if monitor.subscribedOnApplied {
5655
return
5756
}
@@ -62,7 +61,7 @@ func (monitor Monitor) SubscribeOnMempoolApplied(ctx context.Context) {
6261
}
6362

6463
// SubscribeOnMempoolRefused -
65-
func (monitor Monitor) SubscribeOnMempoolRefused(ctx context.Context) {
64+
func (monitor *Monitor) SubscribeOnMempoolRefused(ctx context.Context) {
6665
if monitor.subscribedOnRefused {
6766
return
6867
}
@@ -73,7 +72,7 @@ func (monitor Monitor) SubscribeOnMempoolRefused(ctx context.Context) {
7372
}
7473

7574
// SubscribeOnMempoolBranchRefused -
76-
func (monitor Monitor) SubscribeOnMempoolBranchRefused(ctx context.Context) {
75+
func (monitor *Monitor) SubscribeOnMempoolBranchRefused(ctx context.Context) {
7776
if monitor.subscribedOnBranchRefused {
7877
return
7978
}
@@ -84,7 +83,7 @@ func (monitor Monitor) SubscribeOnMempoolBranchRefused(ctx context.Context) {
8483
}
8584

8685
// SubscribeOnMempoolBranchDelayed -
87-
func (monitor Monitor) SubscribeOnMempoolBranchDelayed(ctx context.Context) {
86+
func (monitor *Monitor) SubscribeOnMempoolBranchDelayed(ctx context.Context) {
8887
if monitor.subscribedOnBranchDelayed {
8988
return
9089
}
@@ -94,7 +93,7 @@ func (monitor Monitor) SubscribeOnMempoolBranchDelayed(ctx context.Context) {
9493
go monitor.pollingMempool(ctx, filterBranchDelayed)
9594
}
9695

97-
func (monitor Monitor) Close() error {
96+
func (monitor *Monitor) Close() error {
9897
monitor.wg.Wait()
9998

10099
close(monitor.applied)
@@ -105,26 +104,26 @@ func (monitor Monitor) Close() error {
105104
}
106105

107106
// Applied -
108-
func (monitor Monitor) Applied() <-chan []*Applied {
107+
func (monitor *Monitor) Applied() <-chan []*Applied {
109108
return monitor.applied
110109
}
111110

112111
// BranchRefused -
113-
func (monitor Monitor) BranchRefused() <-chan []*Applied {
112+
func (monitor *Monitor) BranchRefused() <-chan []*Applied {
114113
return monitor.branchRefused
115114
}
116115

117116
// BranchDelayed -
118-
func (monitor Monitor) BranchDelayed() <-chan []*Applied {
117+
func (monitor *Monitor) BranchDelayed() <-chan []*Applied {
119118
return monitor.branchDelayed
120119
}
121120

122121
// Refused -
123-
func (monitor Monitor) Refused() <-chan []*Applied {
122+
func (monitor *Monitor) Refused() <-chan []*Applied {
124123
return monitor.refused
125124
}
126125

127-
func (monitor Monitor) pollingMempool(ctx context.Context, filter string) {
126+
func (monitor *Monitor) pollingMempool(ctx context.Context, filter string) {
128127
defer monitor.wg.Done()
129128

130129
if filter == "" {
@@ -151,7 +150,7 @@ func (monitor Monitor) pollingMempool(ctx context.Context, filter string) {
151150
}
152151
}
153152

154-
func (monitor Monitor) selectChannel(filter string) (interface{}, error) {
153+
func (monitor *Monitor) selectChannel(filter string) (interface{}, error) {
155154
switch filter {
156155
case filterApplied:
157156
return monitor.applied, nil
@@ -166,7 +165,7 @@ func (monitor Monitor) selectChannel(filter string) (interface{}, error) {
166165
}
167166
}
168167

169-
func (monitor Monitor) longPolling(ctx context.Context, url string, ch interface{}) error {
168+
func (monitor *Monitor) longPolling(ctx context.Context, url string, ch interface{}) error {
170169
link := fmt.Sprintf("%s/%s", monitor.url, url)
171170
req, err := http.NewRequest(http.MethodGet, link, nil)
172171
if err != nil {
@@ -183,7 +182,7 @@ func (monitor Monitor) longPolling(ctx context.Context, url string, ch interface
183182
return monitor.parseLongPollingResponse(ctx, resp, ch)
184183
}
185184

186-
func (monitor Monitor) parseLongPollingResponse(ctx context.Context, resp *http.Response, ch interface{}) error {
185+
func (monitor *Monitor) parseLongPollingResponse(ctx context.Context, resp *http.Response, ch interface{}) error {
187186
if resp == nil {
188187
return errors.New("nil response on mempool long polling request")
189188
}

0 commit comments

Comments
 (0)