Skip to content

Commit

Permalink
fixed error checking based on feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
ClaytonNorthey92 committed Jul 17, 2024
1 parent 98536d3 commit 91414b9
Showing 1 changed file with 10 additions and 21 deletions.
31 changes: 10 additions & 21 deletions service/tbc/rpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ func TestBlockHeadersByHeight(t *testing.T) {
}

var v protocol.Message
err = wsjson.Read(ctx, c, &v)
if err != nil {
if err := wsjson.Read(ctx, c, &v); err != nil {
t.Fatal(err)
}

Expand Down Expand Up @@ -205,8 +204,7 @@ func TestBlockHeadersByHeightDoesNotExist(t *testing.T) {
}

var v protocol.Message
err = wsjson.Read(ctx, c, &v)
if err != nil {
if err := wsjson.Read(ctx, c, &v); err != nil {
t.Fatal(err)
}

Expand Down Expand Up @@ -262,8 +260,7 @@ func TestBlockHeaderBestRaw(t *testing.T) {
}

var v protocol.Message
err = wsjson.Read(ctx, c, &v)
if err != nil {
if err := wsjson.Read(ctx, c, &v); err != nil {
t.Fatal(err)
}

Expand Down Expand Up @@ -333,8 +330,7 @@ func TestBtcBlockHeaderBest(t *testing.T) {
}

var v protocol.Message
err = wsjson.Read(ctx, c, &v)
if err != nil {
if err := wsjson.Read(ctx, c, &v); err != nil {
t.Fatal(err)
}

Expand Down Expand Up @@ -1034,8 +1030,7 @@ func TestTxByIdRaw(t *testing.T) {
}

var v protocol.Message
err = wsjson.Read(ctx, c, &v)
if err != nil {
if err := wsjson.Read(ctx, c, &v); err != nil {
t.Fatal(err)
}

Expand Down Expand Up @@ -1125,8 +1120,7 @@ func TestTxByIdRawInvalid(t *testing.T) {
}

var v protocol.Message
err = wsjson.Read(ctx, c, &v)
if err != nil {
if err := wsjson.Read(ctx, c, &v); err != nil {
t.Fatal(err)
}

Expand Down Expand Up @@ -1223,8 +1217,7 @@ func TestTxByIdRawNotFound(t *testing.T) {
}

var v protocol.Message
err = wsjson.Read(ctx, c, &v)
if err != nil {
if err := wsjson.Read(ctx, c, &v); err != nil {
t.Fatal(err)
}

Expand Down Expand Up @@ -1304,8 +1297,7 @@ func TestTxById(t *testing.T) {
}

var v protocol.Message
err = wsjson.Read(ctx, c, &v)
if err != nil {
if err := wsjson.Read(ctx, c, &v); err != nil {
t.Fatal(err)
}

Expand Down Expand Up @@ -1390,13 +1382,11 @@ func TestTxByIdInvalid(t *testing.T) {
}

var v protocol.Message
err = wsjson.Read(ctx, c, &v)
if err != nil {
if err := wsjson.Read(ctx, c, &v); err != nil {
t.Fatal(err)
}

if v.Header.Command != tbcapi.CmdTxByIdResponse {

t.Fatalf("received unexpected command: %s", v.Header.Command)
}

Expand Down Expand Up @@ -1488,8 +1478,7 @@ func TestTxByIdNotFound(t *testing.T) {
}

var v protocol.Message
err = wsjson.Read(ctx, c, &v)
if err != nil {
if err := wsjson.Read(ctx, c, &v); err != nil {
t.Fatal(err)
}

Expand Down

0 comments on commit 91414b9

Please sign in to comment.