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
6 changes: 5 additions & 1 deletion ledger/common/script_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ func TestScriptRefDecode(t *testing.T) {
t.Fatalf("unexpected error decoding script ref CBOR: %s", err)
}
if !reflect.DeepEqual(testScriptRef.Script, &expectedScript) {
t.Fatalf("did not get expected script\n got: %#v\n wanted: %#v", testScriptRef.Script, &expectedScript)
t.Fatalf(
"did not get expected script\n got: %#v\n wanted: %#v",
testScriptRef.Script,
&expectedScript,
)
}
}
22 changes: 18 additions & 4 deletions ledger/conway/block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ func TestConwayBlock_CborRoundTrip_UsingCborEncode(t *testing.T) {
// Decode the hex string into CBOR bytes
dataBytes, err := hex.DecodeString(hexStr)
if err != nil {
t.Fatalf("Failed to decode Conway block hex string into CBOR bytes: %v", err)
t.Fatalf(
"Failed to decode Conway block hex string into CBOR bytes: %v",
err,
)
}

// Deserialize CBOR bytes into ConwayBlock struct
Expand All @@ -48,15 +51,22 @@ func TestConwayBlock_CborRoundTrip_UsingCborEncode(t *testing.T) {
// Re-encode using the cbor Encode function
encoded, err := cbor.Encode(block)
if err != nil {
t.Fatalf("Failed to marshal ConwayBlock using custom encode function: %v", err)
t.Fatalf(
"Failed to marshal ConwayBlock using custom encode function: %v",
err,
)
}
if encoded == nil || len(encoded) == 0 {
t.Fatal("Custom encoded CBOR from ConwayBlock is nil or empty")
}

// Ensure the original and re-encoded CBOR bytes are identical
if !bytes.Equal(dataBytes, encoded) {
t.Errorf("Custom CBOR round-trip mismatch for Conway block\nOriginal CBOR (hex): %x\nCustom Encoded CBOR (hex): %x", dataBytes, encoded)
t.Errorf(
"Custom CBOR round-trip mismatch for Conway block\nOriginal CBOR (hex): %x\nCustom Encoded CBOR (hex): %x",
dataBytes,
encoded,
)

// Check from which byte it differs
diffIndex := -1
Expand All @@ -68,7 +78,11 @@ func TestConwayBlock_CborRoundTrip_UsingCborEncode(t *testing.T) {
}
if diffIndex != -1 {
t.Logf("First mismatch at byte index: %d", diffIndex)
t.Logf("Original byte: 0x%02x, Re-encoded byte: 0x%02x", dataBytes[diffIndex], encoded[diffIndex])
t.Logf(
"Original byte: 0x%02x, Re-encoded byte: 0x%02x",
dataBytes[diffIndex],
encoded[diffIndex],
)
} else {
t.Logf("Length mismatch: original length = %d, re-encoded length = %d", len(dataBytes), len(encoded))
}
Expand Down
17 changes: 14 additions & 3 deletions muxer/muxer.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ type ConnectionClosedError struct {
}

func (e *ConnectionClosedError) Error() string {
return fmt.Sprintf("peer closed the connection while %s: %v", e.Context, e.Err)
return fmt.Sprintf(
"peer closed the connection while %s: %v",
e.Context,
e.Err,
)
}

func (e *ConnectionClosedError) Unwrap() error {
Expand Down Expand Up @@ -301,7 +305,9 @@ func (m *Muxer) readLoop() {
err = io.EOF
}
if errors.Is(err, io.EOF) {
m.sendError(&ConnectionClosedError{Context: "reading header", Err: err})
m.sendError(
&ConnectionClosedError{Context: "reading header", Err: err},
)
} else {
m.sendError(err)
}
Expand All @@ -318,7 +324,12 @@ func (m *Muxer) readLoop() {
err = io.EOF
}
if errors.Is(err, io.EOF) {
m.sendError(&ConnectionClosedError{Context: "reading payload", Err: err})
m.sendError(
&ConnectionClosedError{
Context: "reading payload",
Err: err,
},
)
} else {
m.sendError(err)
}
Expand Down
4 changes: 3 additions & 1 deletion protocol/txsubmission/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ func (c *Client) handleRequestTxIds(msg protocol.Message) error {
return err
}
if !msgRequestTxIds.Blocking {
return errors.New("cannot stop server process during a non-blocking operation")
return errors.New(
"cannot stop server process during a non-blocking operation",
)
}
resp := NewMsgDone()
if err := c.SendMessage(resp); err != nil {
Expand Down
Loading