mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-11-27 07:48:44 +00:00
Just some name changes, put in a stand in emission amount, and started copying the algo from Karlsen. Not release worthy yet. Therefore Dev branch exists now. Also, for now this is for research purposes only. I got no clue what to build on top of Kaspa yet. Help would be appreciated for ideas and implementations.
25 lines
628 B
Go
25 lines
628 B
Go
package testing
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/zoomy-network/zoomyd/app/protocol/protocolerrors"
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
func checkFlowError(t *testing.T, err error, isProtocolError bool, shouldBan bool, contains string) {
|
|
pErr := protocolerrors.ProtocolError{}
|
|
if errors.As(err, &pErr) != isProtocolError {
|
|
t.Fatalf("Unexepcted error %+v", err)
|
|
}
|
|
|
|
if pErr.ShouldBan != shouldBan {
|
|
t.Fatalf("Exepcted shouldBan %t but got %t", shouldBan, pErr.ShouldBan)
|
|
}
|
|
|
|
if !strings.Contains(err.Error(), contains) {
|
|
t.Fatalf("Unexpected error. Expected error to contain '%s' but got: %+v", contains, err)
|
|
}
|
|
}
|