Skip to content

Commit c8cf253

Browse files
committed
all: fix SA5011 reports from redundant nil checks inferring nil possibility
1 parent 2f1aae0 commit c8cf253

4 files changed

Lines changed: 0 additions & 15 deletions

File tree

bitcoin/wallet/gozer/tbcgozer/tbcgozer_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -489,9 +489,6 @@ func TestTBCGozerTxByID(t *testing.T) {
489489
if err != nil {
490490
t.Fatalf("unexpected error: %v", err)
491491
}
492-
if tx == nil {
493-
t.Fatal("expected non-nil tx")
494-
}
495492
if tx.Version != 2 {
496493
t.Fatalf("expected version 2, got %v", tx.Version)
497494
}

bitcoin/wallet/wallet_pop_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,6 @@ func TestPoPPrevOutsFetcherRoundTrip(t *testing.T) {
272272

273273
fetcher := prevOutsFetcher(prevOuts)
274274
got := fetcher.FetchPrevOutput(f.outpoint)
275-
if got == nil {
276-
t.Fatal("fetcher returned nil for known outpoint (key parse failure)")
277-
}
278275
if got.Value != int64(f.utxo.Value) {
279276
t.Fatalf("fetcher value mismatch: got %d want %d",
280277
got.Value, int64(f.utxo.Value))

bitcoin/wallet/wallet_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,6 @@ func TestIntegration(t *testing.T) {
228228
if err != nil {
229229
t.Fatalf("TxByID after broadcast: %v", err)
230230
}
231-
if lookedUp == nil {
232-
t.Fatal("TxByID returned nil tx")
233-
}
234231
if len(lookedUp.TxIn) == 0 {
235232
t.Fatal("TxByID returned tx with no inputs")
236233
}

service/tbc/cpfp_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,18 +205,12 @@ func TestTxOutByOutpoint(t *testing.T) {
205205

206206
// Index 0 should return the first output.
207207
out := mp.txOutByOutpoint(parentHash, 0)
208-
if out == nil {
209-
t.Fatal("expected output at index 0")
210-
}
211208
if out.Value != 50_000 {
212209
t.Fatalf("expected value 50000, got %d", out.Value)
213210
}
214211

215212
// Index 1 should return the second output.
216213
out = mp.txOutByOutpoint(parentHash, 1)
217-
if out == nil {
218-
t.Fatal("expected output at index 1")
219-
}
220214
if out.Value != 30_000 {
221215
t.Fatalf("expected value 30000, got %d", out.Value)
222216
}

0 commit comments

Comments
 (0)