decred.org/dcrdex@v1.0.5/client/asset/ltc/regnet_test.go (about)

     1  //go:build harness
     2  
     3  package ltc
     4  
     5  // Regnet tests expect the LTC test harness to be running.
     6  //
     7  // Sim harness info:
     8  // The harness has three wallets, alpha, beta, and gamma.
     9  // All three wallets have confirmed UTXOs.
    10  // The beta wallet has only coinbase outputs.
    11  // The alpha wallet has coinbase outputs too, but has sent some to the gamma
    12  //   wallet, so also has some change outputs.
    13  // The gamma wallet has regular transaction outputs of varying size and
    14  // confirmation count. Value:Confirmations =
    15  // 10:8, 18:7, 5:6, 7:5, 1:4, 15:3, 3:2, 25:1
    16  
    17  import (
    18  	"context"
    19  	"fmt"
    20  	"testing"
    21  	"time"
    22  
    23  	"decred.org/dcrdex/client/asset/btc/livetest"
    24  	"decred.org/dcrdex/dex"
    25  )
    26  
    27  // const alphaAddress = "rltc1qjld4f85m96rr77035c5yuhkz8apxlkkla0ftmz"
    28  
    29  var (
    30  	tLotSize uint64 = 1e6
    31  	tLTC            = &dex.Asset{
    32  		ID:         2,
    33  		Symbol:     "ltc",
    34  		Version:    version,
    35  		MaxFeeRate: 10,
    36  		SwapConf:   1,
    37  	}
    38  )
    39  
    40  func TestWallet(t *testing.T) {
    41  	livetest.Run(t, &livetest.Config{
    42  		NewWallet: NewWallet,
    43  		LotSize:   tLotSize,
    44  		Asset:     tLTC,
    45  	})
    46  }
    47  
    48  func TestExternalFeeRate(t *testing.T) {
    49  	fetchRateWithTimeout(t, dex.Mainnet)
    50  	fetchRateWithTimeout(t, dex.Testnet)
    51  }
    52  
    53  func fetchRateWithTimeout(t *testing.T, net dex.Network) {
    54  	ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
    55  	defer cancel()
    56  	feeRate, err := externalFeeRate(ctx, net)
    57  	if err != nil {
    58  		t.Fatalf("error fetching %s fees: %v", net, err)
    59  	}
    60  	fmt.Printf("##### Fee rate fetched for %s! %d Sats/vB \n", net, feeRate)
    61  }