Skip to content

Commit caefe9e

Browse files
authored
chore(backport): backport changes from main to v0.16.1 release branch (#3776)
Updates v16 release branch with recent man changes
2 parents a4739e8 + 8ee3b73 commit caefe9e

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

core/listener.go

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ type Listener struct {
5151

5252
listenerTimeout time.Duration
5353
cancel context.CancelFunc
54+
closed chan struct{}
5455
}
5556

5657
func NewListener(
@@ -99,6 +100,7 @@ func (cl *Listener) Start(context.Context) error {
99100

100101
ctx, cancel := context.WithCancel(context.Background())
101102
cl.cancel = cancel
103+
cl.closed = make(chan struct{})
102104

103105
sub, err := cl.fetcher.SubscribeNewBlockEvent(ctx)
104106
if err != nil {
@@ -116,13 +118,25 @@ func (cl *Listener) Stop(ctx context.Context) error {
116118
}
117119

118120
cl.cancel()
119-
cl.cancel = nil
120-
return cl.metrics.Close()
121+
select {
122+
case <-cl.closed:
123+
cl.cancel = nil
124+
cl.closed = nil
125+
case <-ctx.Done():
126+
return ctx.Err()
127+
}
128+
129+
err = cl.metrics.Close()
130+
if err != nil {
131+
log.Warnw("listener: closing metrics", "err", err)
132+
}
133+
return nil
121134
}
122135

123136
// runSubscriber runs a subscriber to receive event data of new signed blocks. It will attempt to
124137
// resubscribe in case error happens during listening of subscription
125138
func (cl *Listener) runSubscriber(ctx context.Context, sub <-chan types.EventDataSignedBlock) {
139+
defer close(cl.closed)
126140
for {
127141
err := cl.listen(ctx, sub)
128142
if ctx.Err() != nil {
@@ -131,7 +145,7 @@ func (cl *Listener) runSubscriber(ctx context.Context, sub <-chan types.EventDat
131145
}
132146
if errors.Is(err, errInvalidSubscription) {
133147
// stop node if there is a critical issue with the block subscription
134-
log.Fatalf("listener: %v", err)
148+
log.Fatalf("listener: %v", err) //nolint:gocritic
135149
}
136150

137151
log.Warnw("listener: subscriber error, resubscribing...", "err", err)

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
github.com/BurntSushi/toml v1.4.0
1111
github.com/alecthomas/jsonschema v0.0.0-20220216202328-9eeeec9d044b
1212
github.com/benbjohnson/clock v1.3.5
13-
github.com/celestiaorg/celestia-app/v2 v2.1.2
13+
github.com/celestiaorg/celestia-app/v2 v2.2.0-arabica
1414
github.com/celestiaorg/go-fraud v0.2.1
1515
github.com/celestiaorg/go-header v0.6.2
1616
github.com/celestiaorg/go-libp2p-messenger v0.2.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,8 @@ github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOC
354354
github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
355355
github.com/celestiaorg/blobstream-contracts/v3 v3.1.0 h1:h1Y4V3EMQ2mFmNtWt2sIhZIuyASInj1a9ExI8xOsTOw=
356356
github.com/celestiaorg/blobstream-contracts/v3 v3.1.0/go.mod h1:x4DKyfKOSv1ZJM9NwV+Pw01kH2CD7N5zTFclXIVJ6GQ=
357-
github.com/celestiaorg/celestia-app/v2 v2.1.2 h1:/3NhEPkVHahKrJ3blehDPjy7AzWq8z68afgvEmor/tk=
358-
github.com/celestiaorg/celestia-app/v2 v2.1.2/go.mod h1:qraGN1WNAtIFwGWB0NWnZ3tGPL5joPlbLStSZ4k6niQ=
357+
github.com/celestiaorg/celestia-app/v2 v2.2.0-arabica h1:EbcV7BVOs8oaN4DFO76B9dKOJtZu1DH8yLSGcwejIKU=
358+
github.com/celestiaorg/celestia-app/v2 v2.2.0-arabica/go.mod h1:+7xlXlBA3Tx9u1LxZF/4QAaAGfBIXv8JPrrFQAbLiWA=
359359
github.com/celestiaorg/celestia-core v1.40.0-tm-v0.34.29 h1:J79TAjizxwIvm7/k+WI3PPH1aFj4AjOSjajoq5UzAwI=
360360
github.com/celestiaorg/celestia-core v1.40.0-tm-v0.34.29/go.mod h1:5jJ5magtH7gQOwSYfS/m5fliIS7irKunLV7kLNaD8o0=
361361
github.com/celestiaorg/cosmos-sdk v1.24.1-sdk-v0.46.16 h1:SeQ7Y/CyOcUMKo7mQiexaj/pZ/xIgyuZFIwYZwpSkWE=

header/header.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ func (eh *ExtendedHeader) Verify(untrst *ExtendedHeader) error {
201201
if err := eh.ValidatorSet.VerifyCommitLightTrusting(eh.ChainID(), untrst.Commit, light.DefaultTrustLevel); err != nil {
202202
return &libhead.VerifyError{
203203
Reason: fmt.Errorf("%w: %w", ErrVerifyCommitLightTrustingFailed, err),
204-
SoftFailure: true,
204+
SoftFailure: core.IsErrNotEnoughVotingPowerSigned(err),
205205
}
206206
}
207207
return nil

0 commit comments

Comments
 (0)