Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion protocol/txsubmission/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,17 @@ func (c *Client) handleRequestTxIds(msg protocol.Message) error {
msgRequestTxIds.Req,
)
if err != nil {
return err
if !errors.Is(err, ErrStopServerProcess) {
return err
}
if !msgRequestTxIds.Blocking {
return errors.New("cannot stop server process during a non-blocking operation")
}
resp := NewMsgDone()
if err := c.SendMessage(resp); err != nil {
return err
}
return nil
}
resp := NewMsgReplyTxIds(txIds)
if err := c.SendMessage(resp); err != nil {
Expand Down
21 changes: 21 additions & 0 deletions protocol/txsubmission/error.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2025 Blink Labs Software
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package txsubmission

import "errors"

// ErrStopServerProcess is used as a special return value from a RequestTxIds handler function to signify
// that the server should stop asking for transactions. This should only be used when the request is blocking
var ErrStopServerProcess = errors.New("stop server process")
Loading