@@ -26,27 +26,6 @@ type TestSuite struct {
2626 suite.Suite
2727}
2828
29- // assertAddrMagics checks if the address magic IDs and cash address prefixes
30- func (ts * TestSuite ) assertAddrMagics (p * Params , want bool ) {
31- ts .Equal (want , IsPubKeyHashAddrID (p .Net , p .LegacyPubKeyHashAddrID ), "P2PKH magic %s" , p .Name )
32- ts .Equal (want , IsScriptHashAddrID (p .Net , p .LegacyScriptHashAddrID ), "P2SH magic %s" , p .Name )
33-
34- full := p .CashAddressPrefix + ":"
35- ts .Equal (want , IsCashAddressPrefix (p .Net , full ), "cashaddr %s" , p .Name )
36- ts .Equal (want , IsCashAddressPrefix (p .Net , strings .ToUpper (full )), "cashaddr upper %s" , p .Name )
37- }
38-
39- // assertHD checks if the HDPrivateKeyID can be converted to a HDPublicKeyID.
40- func (ts * TestSuite ) assertHD (p * Params , wantErr bool ) {
41- pub , err := HDPrivateKeyToPublicKeyID (p .HDPrivateKeyID [:])
42- if wantErr {
43- ts .ErrorIs (err , ErrUnknownHDKeyID , "HD priv->pub should fail for %s" , p .Name )
44- } else {
45- ts .Require ().NoError (err , "HD priv->pub failed for %s" , p .Name )
46- ts .Equal (p .HDPublicKeyID [:], pub , "HD pub mismatch for %s" , p .Name )
47- }
48- }
49-
5029// TestRegisterFlow tests the registration flow of networks, ensuring that
5130func (ts * TestSuite ) TestRegisterFlow () {
5231 builtins := []* Params {& MainNetParams , & RegressionNetParams , & TestNetParams }
@@ -103,6 +82,27 @@ func (ts *TestSuite) TestRegisterFlow() {
10382 })
10483}
10584
85+ // assertAddrMagics checks if the address magic IDs and cash address prefixes
86+ func (ts * TestSuite ) assertAddrMagics (p * Params , want bool ) {
87+ ts .Equal (want , IsPubKeyHashAddrID (p .Net , p .LegacyPubKeyHashAddrID ), "P2PKH magic %s" , p .Name )
88+ ts .Equal (want , IsScriptHashAddrID (p .Net , p .LegacyScriptHashAddrID ), "P2SH magic %s" , p .Name )
89+
90+ full := p .CashAddressPrefix + ":"
91+ ts .Equal (want , IsCashAddressPrefix (p .Net , full ), "cashaddr %s" , p .Name )
92+ ts .Equal (want , IsCashAddressPrefix (p .Net , strings .ToUpper (full )), "cashaddr upper %s" , p .Name )
93+ }
94+
95+ // assertHD checks if the HDPrivateKeyID can be converted to a HDPublicKeyID.
96+ func (ts * TestSuite ) assertHD (p * Params , wantErr bool ) {
97+ pub , err := HDPrivateKeyToPublicKeyID (p .HDPrivateKeyID [:])
98+ if wantErr {
99+ ts .ErrorIs (err , ErrUnknownHDKeyID , "HD priv->pub should fail for %s" , p .Name )
100+ } else {
101+ ts .Require ().NoError (err , "HD priv->pub failed for %s" , p .Name )
102+ ts .Equal (p .HDPublicKeyID [:], pub , "HD pub mismatch for %s" , p .Name )
103+ }
104+ }
105+
106106// TestRegisterSuite runs the test suite for the chaincfg package.
107107func TestRegisterSuite (t * testing.T ) {
108108 suite .Run (t , new (TestSuite ))
0 commit comments