decred.org/dcrdex@v1.0.3/dex/networks/firo/params_test.go (about)

     1  package firo
     2  
     3  import (
     4  	"encoding/hex"
     5  	"testing"
     6  
     7  	btctest "decred.org/dcrdex/dex/networks/btc/test"
     8  )
     9  
    10  func TestCompatibility(t *testing.T) {
    11  	fromHex := func(str string) []byte {
    12  		b, err := hex.DecodeString(str)
    13  		if err != nil {
    14  			t.Fatalf("error decoding %s: %v", str, err)
    15  		}
    16  		return b
    17  	}
    18  
    19  	// These scripts and addresses are just copy-pasted from random getrawtransaction output
    20  	//
    21  	// Mainnet
    22  	items := &btctest.CompatibilityItems{
    23  		P2PKHScript:  fromHex("76a9145d1dc660d9f4c526f21e62dae503c9f5f18d11ac88ac"),
    24  		PKHAddr:      "a9CpFYRZYrdGc2MgD5bQAgEXXAJNyxe12j",
    25  		P2WPKHScript: nil,
    26  		WPKHAddr:     "no segwit",
    27  		P2SHScript:   fromHex("a9148d1ba9c8def4ac369f7b7162f68b1ba764bea91387"),
    28  		SHAddr:       "43ELJtBmtwxZcscErd4S3QFqPVbs4b6a87",
    29  		P2WSHScript:  nil,
    30  		WSHAddr:      "no segwit",
    31  	}
    32  	btctest.CompatibilityCheck(t, items, MainNetParams)
    33  
    34  	// Testnet3
    35  	testnet_items := &btctest.CompatibilityItems{
    36  		P2PKHScript:  fromHex("76a914c6d9103ea51374752bfe8360b6a49d548ce0ca2b88ac"),
    37  		PKHAddr:      "TU6cpsgsrgxfVEpTBoQsdeZppTUZ4K3o3h",
    38  		P2WPKHScript: nil,
    39  		WPKHAddr:     "no segwit",
    40  		P2SHScript:   fromHex("a9145988a1ddfb12a5b4a7701fa327d262212ac642b587"),
    41  		SHAddr:       "2EmKn5nDjAbU7jHPCXxqUBE4e8owhXGFfbB",
    42  		P2WSHScript:  nil,
    43  		WSHAddr:      "no segwit",
    44  	}
    45  	btctest.CompatibilityCheck(t, testnet_items, TestNetParams)
    46  }