-
Notifications
You must be signed in to change notification settings - Fork 342
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: panic on stewardship endpoints in dev mode (#2640)
- Loading branch information
Showing
4 changed files
with
50 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright 2021 The Swarm Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package mock | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/ethersphere/bee/pkg/swarm" | ||
) | ||
|
||
// Steward represents steward.Interface mock. | ||
type Steward struct { | ||
addr swarm.Address | ||
} | ||
|
||
// Reupload implements steward.Interface Reupload method. | ||
// The given address is recorded. | ||
func (s *Steward) Reupload(_ context.Context, addr swarm.Address) error { | ||
s.addr = addr | ||
return nil | ||
} | ||
|
||
// IsRetrievable implements steward.Interface IsRetrievable method. | ||
// The method always returns true. | ||
func (s *Steward) IsRetrievable(_ context.Context, _ swarm.Address) (bool, error) { | ||
return true, nil | ||
} | ||
|
||
// LastAddress returns the last address given to the Reupload method call. | ||
func (s *Steward) LastAddress() swarm.Address { | ||
return s.addr | ||
} |