Skip to content

Commit 14d655f

Browse files
committed
integration/rpctest: remove redundant boolean from harness setup
Previously the [Harness.SetUp] procedure was taking a boolean to generate a test chain and a integer for the required number of mature outputs, but internally, the test chain was being generated only if the number of mature outputs was different than zero and the boolean was true, this means that we can remove the boolean and pass zero when we don't want to create the test chain. After the change, all the tests still passing.
1 parent 3314682 commit 14d655f

14 files changed

Lines changed: 31 additions & 31 deletions

integration/bip0009_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func testBIP0009(t *testing.T, forkKey string, deploymentID uint32) {
136136
if err != nil {
137137
t.Fatalf("unable to create primary harness: %v", err)
138138
}
139-
if err := r.SetUp(false, 0); err != nil {
139+
if err := r.SetUp(0); err != nil {
140140
t.Fatalf("unable to setup test chain: %v", err)
141141
}
142142
defer r.TearDown()
@@ -389,7 +389,7 @@ func TestBIP0009Mining(t *testing.T) {
389389
if err != nil {
390390
t.Fatalf("unable to create primary harness: %v", err)
391391
}
392-
if err := r.SetUp(true, 0); err != nil {
392+
if err := r.SetUp(0); err != nil {
393393
t.Fatalf("unable to setup test chain: %v", err)
394394
}
395395
defer r.TearDown()

integration/chain_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func TestGetTxSpendingPrevOut(t *testing.T) {
3030
require.NoError(t, err)
3131

3232
// Setup the node.
33-
require.NoError(t, r.SetUp(true, 100))
33+
require.NoError(t, r.SetUp(100))
3434
t.Cleanup(func() {
3535
require.NoError(t, r.TearDown())
3636
})

integration/csv_fork_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func TestBIP0113Activation(t *testing.T) {
115115
if err != nil {
116116
t.Fatal("unable to create primary harness: ", err)
117117
}
118-
if err := r.SetUp(true, 1); err != nil {
118+
if err := r.SetUp(1); err != nil {
119119
t.Fatalf("unable to setup test chain: %v", err)
120120
}
121121
defer r.TearDown()
@@ -412,7 +412,7 @@ func TestBIP0068AndBIP0112Activation(t *testing.T) {
412412
if err != nil {
413413
t.Fatal("unable to create primary harness: ", err)
414414
}
415-
if err := r.SetUp(true, 1); err != nil {
415+
if err := r.SetUp(1); err != nil {
416416
t.Fatalf("unable to setup test chain: %v", err)
417417
}
418418
defer r.TearDown()

integration/debugstream_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func TestDebugStream(t *testing.T) {
3636
DebugStreamHandler: debHandler,
3737
})
3838
require.NoError(t, err)
39-
h.SetUp(false, 0)
39+
h.SetUp(0)
4040

4141
err = h.TearDown()
4242
require.NoError(t, err)

integration/getchaintips_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ func TestGetChainTips(t *testing.T) {
151151
if err != nil {
152152
t.Fatal("TestGetChainTips fail. Unable to create primary harness: ", err)
153153
}
154-
if err := r.SetUp(true, 0); err != nil {
154+
if err := r.SetUp(0); err != nil {
155155
t.Fatalf("TestGetChainTips fail. Unable to setup test chain: %v", err)
156156
}
157157
defer r.TearDown()

integration/invalidate_reconsider_block_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func TestInvalidateAndReconsiderBlock(t *testing.T) {
1616
t.Fatalf("TestInvalidateAndReconsiderBlock fail."+
1717
"Unable to create primary harness: %v", err)
1818
}
19-
if err := r.SetUp(true, 0); err != nil {
19+
if err := r.SetUp(0); err != nil {
2020
t.Fatalf("TestInvalidateAndReconsiderBlock fail. "+
2121
"Unable to setup test chain: %v", err)
2222
}

integration/p2a_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func TestPayToAnchorSimple(t *testing.T) {
4141

4242
// Initialize the test harness with mining enabled to confirm
4343
// transactions.
44-
err = harness.SetUp(true, 25)
44+
err = harness.SetUp(25)
4545
if err != nil {
4646
t.Fatalf("unable to setup test harness: %v", err)
4747
}

integration/prune_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func TestPrune(t *testing.T) {
2323
r, err := rpctest.New(rpctest.HarnessOpts{ExtraArgs: btcdCfg})
2424
require.NoError(t, err)
2525

26-
if err := r.SetUp(false, 0); err != nil {
26+
if err := r.SetUp(0); err != nil {
2727
require.NoError(t, err)
2828
}
2929
t.Cleanup(func() { r.TearDown() })

integration/rawtx_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func TestTestMempoolAccept(t *testing.T) {
3131
require.NoError(t, err)
3232

3333
// Setup the node.
34-
require.NoError(t, r.SetUp(true, 100))
34+
require.NoError(t, r.SetUp(100))
3535
t.Cleanup(func() {
3636
require.NoError(t, r.TearDown())
3737
})

integration/reorg_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ func TestReorgFromForkPoint(t *testing.T) {
3434

3535
longer, err := rpctest.New()
3636
require.NoError(t, err)
37-
require.NoError(t, longer.SetUp(false, 0))
37+
require.NoError(t, longer.SetUp(0))
3838
t.Cleanup(func() { require.NoError(t, longer.TearDown()) })
3939

4040
shorter, err := rpctest.New()
4141
require.NoError(t, err)
42-
require.NoError(t, shorter.SetUp(false, 0))
42+
require.NoError(t, shorter.SetUp(0))
4343
t.Cleanup(func() { require.NoError(t, shorter.TearDown()) })
4444

4545
// Mine the shared chain on the longer node before connecting so that

0 commit comments

Comments
 (0)