File tree Expand file tree Collapse file tree 4 files changed +7
-6
lines changed Expand file tree Collapse file tree 4 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -722,7 +722,7 @@ func (c *Client) handleRollForward(msgGeneric protocol.Message) error {
722
722
}
723
723
}
724
724
if callbackErr != nil {
725
- if callbackErr == StopSyncProcessError {
725
+ if errors . Is ( callbackErr , StopSyncProcessError ) {
726
726
// Signal that we're cancelling the sync
727
727
c .readyForNextBlockChan <- false
728
728
return nil
@@ -751,7 +751,7 @@ func (c *Client) handleRollBackward(msg protocol.Message) error {
751
751
}
752
752
// Call the user callback function
753
753
if callbackErr := c .config .RollBackwardFunc (c .callbackContext , msgRollBackward .Point , msgRollBackward .Tip ); callbackErr != nil {
754
- if callbackErr == StopSyncProcessError {
754
+ if errors . Is ( callbackErr , StopSyncProcessError ) {
755
755
// Signal that we're cancelling the sync
756
756
c .readyForNextBlockChan <- false
757
757
return nil
Original file line number Diff line number Diff line change 1
- // Copyright 2024 Blink Labs Software
1
+ // Copyright 2025 Blink Labs Software
2
2
//
3
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
4
// you may not use this file except in compliance with the License.
15
15
package chainsync_test
16
16
17
17
import (
18
+ "errors"
18
19
"fmt"
19
20
"reflect"
20
21
"testing"
@@ -127,7 +128,7 @@ func TestIntersectNotFound(t *testing.T) {
127
128
if err == nil {
128
129
t .Fatalf ("did not receive expected error" )
129
130
}
130
- if err != chainsync .IntersectNotFoundError {
131
+ if ! errors . Is ( err , chainsync .IntersectNotFoundError ) {
131
132
t .Fatalf (
132
133
"did not receive expected error\n got: %s\n wanted: %s" ,
133
134
err ,
Original file line number Diff line number Diff line change @@ -203,7 +203,7 @@ func (s *Server) handleFindIntersect(msg protocol.Message) error {
203
203
msgFindIntersect .Points ,
204
204
)
205
205
if err != nil {
206
- if err == IntersectNotFoundError {
206
+ if errors . Is ( err , IntersectNotFoundError ) {
207
207
msgResp := NewMsgIntersectNotFound (tip )
208
208
if err := s .SendMessage (msgResp ); err != nil {
209
209
return err
Original file line number Diff line number Diff line change @@ -363,7 +363,7 @@ func (p *Protocol) recvLoop() {
363
363
tmpMsg := []cbor.RawMessage {}
364
364
numBytesRead , err := cbor .Decode (recvBuffer .Bytes (), & tmpMsg )
365
365
if err != nil {
366
- if err == io .ErrUnexpectedEOF && recvBuffer .Len () > 0 {
366
+ if errors . Is ( err , io .ErrUnexpectedEOF ) && recvBuffer .Len () > 0 {
367
367
// This is probably a multi-part message, so we wait until we get more of the message
368
368
// before trying to process it
369
369
p .recvReadyChan <- true
You can’t perform that action at this time.
0 commit comments