Skip to content

Commit

Permalink
reduce blocks mined for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed Oct 24, 2024
1 parent f2fbcd6 commit 2d0fd5b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 34 deletions.
15 changes: 6 additions & 9 deletions chain/chain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"go.sia.tech/core/types"
"go.sia.tech/coreutils"
"go.sia.tech/coreutils/chain"
"go.sia.tech/coreutils/testutil"
"lukechampine.com/frand"
)

Expand Down Expand Up @@ -113,11 +114,7 @@ func newMemState() *memState {
}

func TestV2Attestations(t *testing.T) {
n, genesisBlock := chain.TestnetZen()

n.InitialTarget = types.BlockID{0xFF}
n.HardforkV2.AllowHeight = 2
n.HardforkV2.RequireHeight = 3
n, genesisBlock := testutil.V2Network()

policy := types.AnyoneCanSpend()
addr := policy.Address()
Expand All @@ -144,7 +141,7 @@ func TestV2Attestations(t *testing.T) {
ms := newMemState()

// mine until a utxo is spendable
mineBlocks(t, cm, 150)
mineBlocks(t, cm, int(n.MaturityDelay)+1)
ms.Sync(t, cm)

txn := types.V2Transaction{
Expand Down Expand Up @@ -179,7 +176,7 @@ func TestV2Attestations(t *testing.T) {
ms := newMemState()

// mine until a utxo is spendable
mineBlocks(t, cm, 150)
mineBlocks(t, cm, int(n.MaturityDelay)+1)
ms.Sync(t, cm)

sk := types.GeneratePrivateKey()
Expand Down Expand Up @@ -228,7 +225,7 @@ func TestV2Attestations(t *testing.T) {
ms := newMemState()

// mine until a utxo is spendable
mineBlocks(t, cm, 150)
mineBlocks(t, cm, int(n.MaturityDelay)+1)
ms.Sync(t, cm)

sk := types.GeneratePrivateKey()
Expand Down Expand Up @@ -272,7 +269,7 @@ func TestV2Attestations(t *testing.T) {
ms := newMemState()

// mine until a utxo is spendable
mineBlocks(t, cm, 150)
mineBlocks(t, cm, int(n.MaturityDelay)+1)
ms.Sync(t, cm)

sk := types.GeneratePrivateKey()
Expand Down
52 changes: 27 additions & 25 deletions rhp/v4/rpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func TestSettings(t *testing.T) {
cm, s, w := startTestNode(t, n, genesis)

// fund the wallet
mineAndSync(t, cm, w.Address(), 150)
mineAndSync(t, cm, w.Address(), int(n.MaturityDelay+20), w)

sr := testutil.NewEphemeralSettingsReporter()
sr.Update(proto4.HostSettings{
Expand Down Expand Up @@ -227,8 +227,8 @@ func TestFormContract(t *testing.T) {

cm, s, w := startTestNode(t, n, genesis)

// fund the wallet with two UTXOs
mineAndSync(t, cm, w.Address(), 146, w)
// fund the wallet
mineAndSync(t, cm, w.Address(), int(n.MaturityDelay+20), w)

sr := testutil.NewEphemeralSettingsReporter()
sr.Update(proto4.HostSettings{
Expand Down Expand Up @@ -287,8 +287,8 @@ func TestFormContractBasis(t *testing.T) {

cm, s, w := startTestNode(t, n, genesis)

// fund the wallet with two UTXOs
mineAndSync(t, cm, w.Address(), 146, w)
// fund the wallet
mineAndSync(t, cm, w.Address(), int(n.MaturityDelay+20), w)

sr := testutil.NewEphemeralSettingsReporter()
sr.Update(proto4.HostSettings{
Expand Down Expand Up @@ -345,8 +345,9 @@ func TestRPCRefresh(t *testing.T) {
n, genesis := testutil.V2Network()
hostKey, renterKey := types.GeneratePrivateKey(), types.GeneratePrivateKey()
cm, s, w := startTestNode(t, n, genesis)

// fund the wallet
mineAndSync(t, cm, w.Address(), 150, w)
mineAndSync(t, cm, w.Address(), int(n.MaturityDelay+20), w)

sr := testutil.NewEphemeralSettingsReporter()
sr.Update(proto4.HostSettings{
Expand Down Expand Up @@ -458,8 +459,9 @@ func TestRPCRenew(t *testing.T) {
n, genesis := testutil.V2Network()
hostKey, renterKey := types.GeneratePrivateKey(), types.GeneratePrivateKey()
cm, s, w := startTestNode(t, n, genesis)

// fund the wallet
mineAndSync(t, cm, w.Address(), 150, w)
mineAndSync(t, cm, w.Address(), int(n.MaturityDelay+20), w)

sr := testutil.NewEphemeralSettingsReporter()
sr.Update(proto4.HostSettings{
Expand Down Expand Up @@ -620,8 +622,8 @@ func TestAccounts(t *testing.T) {

cm, s, w := startTestNode(t, n, genesis)

// fund the wallet with two UTXOs
mineAndSync(t, cm, w.Address(), 146, w)
// fund the wallet
mineAndSync(t, cm, w.Address(), int(n.MaturityDelay+20), w)

sr := testutil.NewEphemeralSettingsReporter()
sr.Update(proto4.HostSettings{
Expand Down Expand Up @@ -722,8 +724,8 @@ func TestReadWriteSector(t *testing.T) {

cm, s, w := startTestNode(t, n, genesis)

// fund the wallet with two UTXOs
mineAndSync(t, cm, w.Address(), 146, w)
// fund the wallet
mineAndSync(t, cm, w.Address(), int(n.MaturityDelay+20), w)

sr := testutil.NewEphemeralSettingsReporter()
sr.Update(proto4.HostSettings{
Expand Down Expand Up @@ -819,8 +821,8 @@ func TestAppendSectors(t *testing.T) {

cm, s, w := startTestNode(t, n, genesis)

// fund the wallet with two UTXOs
mineAndSync(t, cm, w.Address(), 146, w)
// fund the wallet
mineAndSync(t, cm, w.Address(), int(n.MaturityDelay+20), w)

sr := testutil.NewEphemeralSettingsReporter()
sr.Update(proto4.HostSettings{
Expand Down Expand Up @@ -937,8 +939,8 @@ func TestVerifySector(t *testing.T) {

cm, s, w := startTestNode(t, n, genesis)

// fund the wallet with two UTXOs
mineAndSync(t, cm, w.Address(), 146, w)
// fund the wallet
mineAndSync(t, cm, w.Address(), int(n.MaturityDelay+20), w)

sr := testutil.NewEphemeralSettingsReporter()
sr.Update(proto4.HostSettings{
Expand Down Expand Up @@ -1031,8 +1033,8 @@ func TestRPCFreeSectors(t *testing.T) {

cm, s, w := startTestNode(t, n, genesis)

// fund the wallet with two UTXOs
mineAndSync(t, cm, w.Address(), 146, w)
// fund the wallet
mineAndSync(t, cm, w.Address(), int(n.MaturityDelay+20), w)

sr := testutil.NewEphemeralSettingsReporter()
sr.Update(proto4.HostSettings{
Expand Down Expand Up @@ -1155,8 +1157,8 @@ func TestRPCSectorRoots(t *testing.T) {

cm, s, w := startTestNode(t, n, genesis)

// fund the wallet with two UTXOs
mineAndSync(t, cm, w.Address(), 146, w)
// fund the wallet
mineAndSync(t, cm, w.Address(), int(n.MaturityDelay+20), w)

sr := testutil.NewEphemeralSettingsReporter()
sr.Update(proto4.HostSettings{
Expand Down Expand Up @@ -1265,8 +1267,8 @@ func BenchmarkWrite(b *testing.B) {

cm, s, w := startTestNode(b, n, genesis)

// fund the wallet with two UTXOs
mineAndSync(b, cm, w.Address(), 146, w)
// fund the wallet
mineAndSync(b, cm, w.Address(), int(n.MaturityDelay+20), w)

sr := testutil.NewEphemeralSettingsReporter()
sr.Update(proto4.HostSettings{
Expand Down Expand Up @@ -1355,8 +1357,8 @@ func BenchmarkRead(b *testing.B) {

cm, s, w := startTestNode(b, n, genesis)

// fund the wallet with two UTXOs
mineAndSync(b, cm, w.Address(), 146, w)
// fund the wallet
mineAndSync(b, cm, w.Address(), int(n.MaturityDelay+20), w)

sr := testutil.NewEphemeralSettingsReporter()
sr.Update(proto4.HostSettings{
Expand Down Expand Up @@ -1457,8 +1459,8 @@ func BenchmarkContractUpload(b *testing.B) {

cm, s, w := startTestNode(b, n, genesis)

// fund the wallet with two UTXOs
mineAndSync(b, cm, w.Address(), 146, w)
// fund the wallet
mineAndSync(b, cm, w.Address(), int(n.MaturityDelay+20), w)

sr := testutil.NewEphemeralSettingsReporter()
sr.Update(proto4.HostSettings{
Expand Down

0 comments on commit 2d0fd5b

Please sign in to comment.