Browse Source

lots of test fixes

master
Loki Verloren 6 months ago
parent
commit
ea45de667f
82 changed files with 1883 additions and 1762 deletions
  1. 8
    8
      addrmgr/addrmanager_internal_test.go
  2. 41
    41
      addrmgr/addrmanager_test.go
  3. 2
    2
      addrmgr/known/known_test.go
  4. 10
    10
      addrmgr/known/knownaddress_test.go
  5. 4
    4
      addrmgr/network_test.go
  6. 45
    44
      blockchain/chain_test.go
  7. 21
    20
      blockchain/chainio_test.go
  8. 2
    2
      blockchain/chainview_test.go
  9. 4
    3
      blockchain/common_test.go
  10. 5
    4
      blockchain/fullblocks_test.go
  11. 95
    93
      blockchain/fullblocktests/generate.go
  12. 8
    7
      blockchain/fullblocktests/params.go
  13. 2
    2
      blockchain/indexers/addrindex_test.go
  14. 4
    4
      blockchain/validate_test.go
  15. 7
    7
      btcjson/chainsvrcmds_test.go
  16. 18
    17
      btcutil/block/block_test.go
  17. 4
    3
      btcutil/bloom/merkleblock_test.go
  18. 10
    9
      btcutil/coinset/coins.go
  19. 7
    6
      btcutil/coinset/coins_test.go
  20. 2
    2
      btcutil/filter/example_test.go
  21. 39
    37
      btcutil/filter/filter_test.go
  22. 8
    7
      btcutil/gcs/builder/builder_test.go
  23. 6
    6
      btcutil/txsort/txsort.go
  24. 2
    2
      btcutil/txsort/txsort_test.go
  25. 3
    3
      cmd/addblock/import.go
  26. 3
    3
      database/cmd/dbtool/insecureimport.go
  27. 5
    4
      database/ffldb/interface_test.go
  28. 13
    13
      integration/rpctest/blockgen.go
  29. 20
    20
      integration/rpctest/memwallet.go
  30. 14
    13
      integration/rpctest/rpc_harness.go
  31. 14
    14
      mempool/estimator/estimatefee_test.go
  32. 25
    24
      mempool/mempool_test.go
  33. 58
    56
      mempool/policy_test.go
  34. 19
    17
      mining/policy_test.go
  35. 5
    4
      peer/example_test.go
  36. 115
    112
      peer/peer_test.go
  37. 7
    7
      rpcclient/chain.go
  38. 3
    3
      rpcclient/examples/btcdwebsockets/main.go
  39. 2
    2
      rpcclient/extensions.go
  40. 24
    23
      rpcclient/future/future.go
  41. 18
    17
      rpcclient/notify.go
  42. 15
    15
      rpcclient/rawtransactions.go
  43. 4
    4
      rpcclient/wallet.go
  44. 13
    13
      txscript/engine_test.go
  45. 9
    9
      txscript/example_test.go
  46. 11
    9
      txscript/hashcache_test.go
  47. 2
    2
      txscript/pkscript_test.go
  48. 16
    16
      txscript/reference_test.go
  49. 6
    6
      txscript/script_test.go
  50. 33
    32
      txscript/sign_test.go
  51. 2
    2
      txscript/standard_test.go
  52. 71
    69
      wire/bench_test.go
  53. 32
    12
      wire/msg/blockheader_test.go
  54. 4
    5
      wire/msg/fakemessage_test.go
  55. 30
    24
      wire/msg/message_test.go
  56. 27
    25
      wire/msg/msgaddr_test.go
  57. 36
    34
      wire/msg/msgalert_test.go
  58. 68
    172
      wire/msg/msgblock_test.go
  59. 24
    22
      wire/msg/msgfeefilter_test.go
  60. 31
    28
      wire/msg/msgfilteradd_test.go
  61. 25
    22
      wire/msg/msgfilterclear_test.go
  62. 36
    32
      wire/msg/msgfilterload_test.go
  63. 7
    7
      wire/msg/msggetaddr_test.go
  64. 26
    24
      wire/msg/msggetblocks_test.go
  65. 25
    23
      wire/msg/msggetdata_test.go
  66. 26
    23
      wire/msg/msggetheaders_test.go
  67. 37
    33
      wire/msg/msgheaders_test.go
  68. 25
    23
      wire/msg/msginv_test.go
  69. 12
    11
      wire/msg/msgmempool_test.go
  70. 48
    45
      wire/msg/msgmerkleblock_test.go
  71. 23
    20
      wire/msg/msgnotfound_test.go
  72. 35
    32
      wire/msg/msgping_test.go
  73. 44
    40
      wire/msg/msgpong_test.go
  74. 88
    84
      wire/msg/msgreject_test.go
  75. 23
    22
      wire/msg/msgsendheaders_test.go
  76. 34
    34
      wire/msg/msgtx.go
  77. 33
    30
      wire/msg/msgtx_test.go
  78. 7
    7
      wire/msg/msgverack_test.go
  79. 60
    57
      wire/msg/msgversion_test.go
  80. 113
    0
      wire/msg/vars.go
  81. 9
    8
      wire/na/netaddress_test.go
  82. 11
    11
      wire/rw/rw_test.go

+ 8
- 8
addrmgr/addrmanager_internal_test.go View File

@@ -7,12 +7,12 @@ import (
7 7
 	"os"
8 8
 	"testing"
9 9
 
10
-	"git.parallelcoin.io/dev/btcd/wire"
10
+	"git.parallelcoin.io/dev/btcd/wire/na"
11 11
 	"git.parallelcoin.io/dev/btcd/wire/service"
12 12
 )
13 13
 
14
-// randAddr generates a *wire.NetAddress backed by a random IPv4/IPv6 address.
15
-func randAddr(t *testing.T) *wire.NetAddress {
14
+// randAddr generates a *na.NetAddress backed by a random IPv4/IPv6 address.
15
+func randAddr(t *testing.T) *na.NetAddress {
16 16
 	t.Helper()
17 17
 
18 18
 	ipv4 := rand.Intn(2) == 0
@@ -31,7 +31,7 @@ func randAddr(t *testing.T) *wire.NetAddress {
31 31
 		ip = b[:]
32 32
 	}
33 33
 
34
-	return &wire.NetAddress{
34
+	return &na.NetAddress{
35 35
 		Services: service.Flag(rand.Uint64()),
36 36
 		IP:       ip,
37 37
 		Port:     uint16(rand.Uint32()),
@@ -40,7 +40,7 @@ func randAddr(t *testing.T) *wire.NetAddress {
40 40
 
41 41
 // assertAddr ensures that the two addresses match. The timestamp is not
42 42
 // checked as it does not affect uniquely identifying a specific address.
43
-func assertAddr(t *testing.T, got, expected *wire.NetAddress) {
43
+func assertAddr(t *testing.T, got, expected *na.NetAddress) {
44 44
 	if got.Services != expected.Services {
45 45
 		t.Fatalf("expected address services %v, got %v",
46 46
 			expected.Services, got.Services)
@@ -57,7 +57,7 @@ func assertAddr(t *testing.T, got, expected *wire.NetAddress) {
57 57
 // assertAddrs ensures that the manager's address cache matches the given
58 58
 // expected addresses.
59 59
 func assertAddrs(t *testing.T, addrMgr *AddrManager,
60
-	expectedAddrs map[string]*wire.NetAddress) {
60
+	expectedAddrs map[string]*na.NetAddress) {
61 61
 
62 62
 	t.Helper()
63 63
 
@@ -97,7 +97,7 @@ func TestAddrManagerSerialization(t *testing.T) {
97 97
 	// We'll be adding 5 random addresses to the manager.
98 98
 	const numAddrs = 5
99 99
 
100
-	expectedAddrs := make(map[string]*wire.NetAddress, numAddrs)
100
+	expectedAddrs := make(map[string]*na.NetAddress, numAddrs)
101 101
 	for i := 0; i < numAddrs; i++ {
102 102
 		addr := randAddr(t)
103 103
 		expectedAddrs[NetAddressKey(addr)] = addr
@@ -142,7 +142,7 @@ func TestAddrManagerV1ToV2(t *testing.T) {
142 142
 	// each addresses' services will not be stored.
143 143
 	const numAddrs = 5
144 144
 
145
-	expectedAddrs := make(map[string]*wire.NetAddress, numAddrs)
145
+	expectedAddrs := make(map[string]*na.NetAddress, numAddrs)
146 146
 	for i := 0; i < numAddrs; i++ {
147 147
 		addr := randAddr(t)
148 148
 		expectedAddrs[NetAddressKey(addr)] = addr

+ 41
- 41
addrmgr/addrmanager_test.go View File

@@ -15,14 +15,14 @@ import (
15 15
 	"git.parallelcoin.io/dev/btcd/node/cnf"
16 16
 
17 17
 	"git.parallelcoin.io/dev/btcd/addrmgr"
18
-	"git.parallelcoin.io/dev/btcd/wire"
18
+	"git.parallelcoin.io/dev/btcd/wire/na"
19 19
 	"git.parallelcoin.io/dev/btcd/wire/service"
20 20
 )
21 21
 
22 22
 // naTest is used to describe a test to be performed against the NetAddressKey
23 23
 // method.
24 24
 type naTest struct {
25
-	in   wire.NetAddress
25
+	in   na.NetAddress
26 26
 	want string
27 27
 }
28 28
 
@@ -96,7 +96,7 @@ func addNaTests() {
96 96
 
97 97
 func addNaTest(ip string, port uint16, want string) {
98 98
 	nip := net.ParseIP(ip)
99
-	na := *wire.NewNetAddressIPPort(nip, port, service.NodeNetwork)
99
+	na := *na.NewNetAddressIPPort(nip, port, service.NodeNetwork)
100 100
 	test := naTest{na, want}
101 101
 	naTests = append(naTests, test)
102 102
 }
@@ -160,37 +160,37 @@ func TestAddAddressByIP(t *testing.T) {
160 160
 
161 161
 func TestAddLocalAddress(t *testing.T) {
162 162
 	var tests = []struct {
163
-		address  wire.NetAddress
163
+		address  na.NetAddress
164 164
 		priority addrmgr.AddressPriority
165 165
 		valid    bool
166 166
 	}{
167 167
 		{
168
-			wire.NetAddress{IP: net.ParseIP("192.168.0.100")},
168
+			na.NetAddress{IP: net.ParseIP("192.168.0.100")},
169 169
 			addrmgr.InterfacePrio,
170 170
 			false,
171 171
 		},
172 172
 		{
173
-			wire.NetAddress{IP: net.ParseIP("204.124.1.1")},
173
+			na.NetAddress{IP: net.ParseIP("204.124.1.1")},
174 174
 			addrmgr.InterfacePrio,
175 175
 			true,
176 176
 		},
177 177
 		{
178
-			wire.NetAddress{IP: net.ParseIP("204.124.1.1")},
178
+			na.NetAddress{IP: net.ParseIP("204.124.1.1")},
179 179
 			addrmgr.BoundPrio,
180 180
 			true,
181 181
 		},
182 182
 		{
183
-			wire.NetAddress{IP: net.ParseIP("::1")},
183
+			na.NetAddress{IP: net.ParseIP("::1")},
184 184
 			addrmgr.InterfacePrio,
185 185
 			false,
186 186
 		},
187 187
 		{
188
-			wire.NetAddress{IP: net.ParseIP("fe80::1")},
188
+			na.NetAddress{IP: net.ParseIP("fe80::1")},
189 189
 			addrmgr.InterfacePrio,
190 190
 			false,
191 191
 		},
192 192
 		{
193
-			wire.NetAddress{IP: net.ParseIP("2620:100::1")},
193
+			na.NetAddress{IP: net.ParseIP("2620:100::1")},
194 194
 			addrmgr.InterfacePrio,
195 195
 			true,
196 196
 		},
@@ -260,7 +260,7 @@ func TestNeedMoreAddresses(t *testing.T) {
260 260
 	if !b {
261 261
 		t.Errorf("Expected that we need more addresses")
262 262
 	}
263
-	addrs := make([]*wire.NetAddress, addrsToAdd)
263
+	addrs := make([]*na.NetAddress, addrsToAdd)
264 264
 
265 265
 	var err error
266 266
 	for i := 0; i < addrsToAdd; i++ {
@@ -271,7 +271,7 @@ func TestNeedMoreAddresses(t *testing.T) {
271 271
 		}
272 272
 	}
273 273
 
274
-	srcAddr := wire.NewNetAddressIPPort(net.IPv4(173, 144, 173, 111), 8333, 0)
274
+	srcAddr := na.NewNetAddressIPPort(net.IPv4(173, 144, 173, 111), 8333, 0)
275 275
 
276 276
 	n.AddAddresses(addrs, srcAddr)
277 277
 	numAddrs := n.NumAddresses()
@@ -288,7 +288,7 @@ func TestNeedMoreAddresses(t *testing.T) {
288 288
 func TestGood(t *testing.T) {
289 289
 	n := addrmgr.New("testgood", lookupFunc)
290 290
 	addrsToAdd := 64 * 64
291
-	addrs := make([]*wire.NetAddress, addrsToAdd)
291
+	addrs := make([]*na.NetAddress, addrsToAdd)
292 292
 
293 293
 	var err error
294 294
 	for i := 0; i < addrsToAdd; i++ {
@@ -299,7 +299,7 @@ func TestGood(t *testing.T) {
299 299
 		}
300 300
 	}
301 301
 
302
-	srcAddr := wire.NewNetAddressIPPort(net.IPv4(173, 144, 173, 111), 8333, 0)
302
+	srcAddr := na.NewNetAddressIPPort(net.IPv4(173, 144, 173, 111), 8333, 0)
303 303
 
304 304
 	n.AddAddresses(addrs, srcAddr)
305 305
 	for _, addr := range addrs {
@@ -355,7 +355,7 @@ func TestGetAddress(t *testing.T) {
355 355
 }
356 356
 
357 357
 func TestGetBestLocalAddress(t *testing.T) {
358
-	localAddrs := []wire.NetAddress{
358
+	localAddrs := []na.NetAddress{
359 359
 		{IP: net.ParseIP("192.168.0.100")},
360 360
 		{IP: net.ParseIP("::1")},
361 361
 		{IP: net.ParseIP("fe80::1")},
@@ -363,43 +363,43 @@ func TestGetBestLocalAddress(t *testing.T) {
363 363
 	}
364 364
 
365 365
 	var tests = []struct {
366
-		remoteAddr wire.NetAddress
367
-		want0      wire.NetAddress
368
-		want1      wire.NetAddress
369
-		want2      wire.NetAddress
370
-		want3      wire.NetAddress
366
+		remoteAddr na.NetAddress
367
+		want0      na.NetAddress
368
+		want1      na.NetAddress
369
+		want2      na.NetAddress
370
+		want3      na.NetAddress
371 371
 	}{
372 372
 		{
373 373
 			// Remote connection from public IPv4
374
-			wire.NetAddress{IP: net.ParseIP("204.124.8.1")},
375
-			wire.NetAddress{IP: net.IPv4zero},
376
-			wire.NetAddress{IP: net.IPv4zero},
377
-			wire.NetAddress{IP: net.ParseIP("204.124.8.100")},
378
-			wire.NetAddress{IP: net.ParseIP("fd87:d87e:eb43:25::1")},
374
+			na.NetAddress{IP: net.ParseIP("204.124.8.1")},
375
+			na.NetAddress{IP: net.IPv4zero},
376
+			na.NetAddress{IP: net.IPv4zero},
377
+			na.NetAddress{IP: net.ParseIP("204.124.8.100")},
378
+			na.NetAddress{IP: net.ParseIP("fd87:d87e:eb43:25::1")},
379 379
 		},
380 380
 		{
381 381
 			// Remote connection from private IPv4
382
-			wire.NetAddress{IP: net.ParseIP("172.16.0.254")},
383
-			wire.NetAddress{IP: net.IPv4zero},
384
-			wire.NetAddress{IP: net.IPv4zero},
385
-			wire.NetAddress{IP: net.IPv4zero},
386
-			wire.NetAddress{IP: net.IPv4zero},
382
+			na.NetAddress{IP: net.ParseIP("172.16.0.254")},
383
+			na.NetAddress{IP: net.IPv4zero},
384
+			na.NetAddress{IP: net.IPv4zero},
385
+			na.NetAddress{IP: net.IPv4zero},
386
+			na.NetAddress{IP: net.IPv4zero},
387 387
 		},
388 388
 		{
389 389
 			// Remote connection from public IPv6
390
-			wire.NetAddress{IP: net.ParseIP("2602:100:abcd::102")},
391
-			wire.NetAddress{IP: net.IPv6zero},
392
-			wire.NetAddress{IP: net.ParseIP("2001:470::1")},
393
-			wire.NetAddress{IP: net.ParseIP("2001:470::1")},
394
-			wire.NetAddress{IP: net.ParseIP("2001:470::1")},
390
+			na.NetAddress{IP: net.ParseIP("2602:100:abcd::102")},
391
+			na.NetAddress{IP: net.IPv6zero},
392
+			na.NetAddress{IP: net.ParseIP("2001:470::1")},
393
+			na.NetAddress{IP: net.ParseIP("2001:470::1")},
394
+			na.NetAddress{IP: net.ParseIP("2001:470::1")},
395 395
 		},
396 396
 		/* XXX
397 397
 		{
398 398
 			// Remote connection from Tor
399
-			wire.NetAddress{IP: net.ParseIP("fd87:d87e:eb43::100")},
400
-			wire.NetAddress{IP: net.IPv4zero},
401
-			wire.NetAddress{IP: net.ParseIP("204.124.8.100")},
402
-			wire.NetAddress{IP: net.ParseIP("fd87:d87e:eb43:25::1")},
399
+			na.NetAddress{IP: net.ParseIP("fd87:d87e:eb43::100")},
400
+			na.NetAddress{IP: net.IPv4zero},
401
+			na.NetAddress{IP: net.ParseIP("204.124.8.100")},
402
+			na.NetAddress{IP: net.ParseIP("fd87:d87e:eb43:25::1")},
403 403
 		},
404 404
 		*/
405 405
 	}
@@ -431,7 +431,7 @@ func TestGetBestLocalAddress(t *testing.T) {
431 431
 	}
432 432
 
433 433
 	// Add a public IP to the list of local addresses.
434
-	localAddr := wire.NetAddress{IP: net.ParseIP("204.124.8.100")}
434
+	localAddr := na.NetAddress{IP: net.ParseIP("204.124.8.100")}
435 435
 	amgr.AddLocalAddress(&localAddr, addrmgr.InterfacePrio)
436 436
 
437 437
 	// Test against want2
@@ -445,7 +445,7 @@ func TestGetBestLocalAddress(t *testing.T) {
445 445
 	}
446 446
 	/*
447 447
 		// Add a Tor generated IP address
448
-		localAddr = wire.NetAddress{IP: net.ParseIP("fd87:d87e:eb43:25::1")}
448
+		localAddr = na.NetAddress{IP: net.ParseIP("fd87:d87e:eb43:25::1")}
449 449
 		amgr.AddLocalAddress(&localAddr, addrmgr.ManualPrio)
450 450
 
451 451
 		// Test against want3

+ 2
- 2
addrmgr/known/known_test.go View File

@@ -7,7 +7,7 @@ package known
7 7
 import (
8 8
 	"time"
9 9
 
10
-	"git.parallelcoin.io/dev/btcd/wire"
10
+	"git.parallelcoin.io/dev/btcd/wire/na"
11 11
 )
12 12
 
13 13
 func TstAddressIsBad(ka *Address) bool {
@@ -18,7 +18,7 @@ func TstAddressChance(ka *Address) float64 {
18 18
 	return ka.Chance()
19 19
 }
20 20
 
21
-func TstNewAddress(na *wire.NetAddress, attempts int,
21
+func TstNewAddress(na *na.NetAddress, attempts int,
22 22
 	lastattempt, lastsuccess time.Time, tried bool, refs int) *Address {
23 23
 	return &Address{NA: na, Attempts: attempts, Lastattempt: lastattempt,
24 24
 		Lastsuccess: lastsuccess, Tried: tried, Refs: refs}

+ 10
- 10
addrmgr/known/knownaddress_test.go View File

@@ -10,7 +10,7 @@ import (
10 10
 	"time"
11 11
 
12 12
 	"git.parallelcoin.io/dev/btcd/addrmgr/known"
13
-	"git.parallelcoin.io/dev/btcd/wire"
13
+	"git.parallelcoin.io/dev/btcd/wire/na"
14 14
 )
15 15
 
16 16
 func TestChance(t *testing.T) {
@@ -21,27 +21,27 @@ func TestChance(t *testing.T) {
21 21
 	}{
22 22
 		{
23 23
 			//Test normal case
24
-			known.TstNewAddress(&wire.NetAddress{Timestamp: now.Add(-35 * time.Second)},
24
+			known.TstNewAddress(&na.NetAddress{Timestamp: now.Add(-35 * time.Second)},
25 25
 				0, time.Now().Add(-30*time.Minute), time.Now(), false, 0),
26 26
 			1.0,
27 27
 		}, {
28 28
 			//Test case in which lastseen < 0
29
-			known.TstNewAddress(&wire.NetAddress{Timestamp: now.Add(20 * time.Second)},
29
+			known.TstNewAddress(&na.NetAddress{Timestamp: now.Add(20 * time.Second)},
30 30
 				0, time.Now().Add(-30*time.Minute), time.Now(), false, 0),
31 31
 			1.0,
32 32
 		}, {
33 33
 			//Test case in which lastattempt < 0
34
-			known.TstNewAddress(&wire.NetAddress{Timestamp: now.Add(-35 * time.Second)},
34
+			known.TstNewAddress(&na.NetAddress{Timestamp: now.Add(-35 * time.Second)},
35 35
 				0, time.Now().Add(30*time.Minute), time.Now(), false, 0),
36 36
 			1.0 * .01,
37 37
 		}, {
38 38
 			//Test case in which lastattempt < ten minutes
39
-			known.TstNewAddress(&wire.NetAddress{Timestamp: now.Add(-35 * time.Second)},
39
+			known.TstNewAddress(&na.NetAddress{Timestamp: now.Add(-35 * time.Second)},
40 40
 				0, time.Now().Add(-5*time.Minute), time.Now(), false, 0),
41 41
 			1.0 * .01,
42 42
 		}, {
43 43
 			//Test case with several failed attempts.
44
-			known.TstNewAddress(&wire.NetAddress{Timestamp: now.Add(-35 * time.Second)},
44
+			known.TstNewAddress(&na.NetAddress{Timestamp: now.Add(-35 * time.Second)},
45 45
 				2, time.Now().Add(-30*time.Minute), time.Now(), false, 0),
46 46
 			1 / 1.5 / 1.5,
47 47
 		},
@@ -65,10 +65,10 @@ func TestIsBad(t *testing.T) {
65 65
 	hoursOld := now.Add(-5 * time.Hour)
66 66
 	zeroTime := time.Time{}
67 67
 
68
-	futureNa := &wire.NetAddress{Timestamp: future}
69
-	minutesOldNa := &wire.NetAddress{Timestamp: minutesOld}
70
-	monthOldNa := &wire.NetAddress{Timestamp: monthOld}
71
-	currentNa := &wire.NetAddress{Timestamp: secondsOld}
68
+	futureNa := &na.NetAddress{Timestamp: future}
69
+	minutesOldNa := &na.NetAddress{Timestamp: minutesOld}
70
+	monthOldNa := &na.NetAddress{Timestamp: monthOld}
71
+	currentNa := &na.NetAddress{Timestamp: secondsOld}
72 72
 
73 73
 	//Test addresses that have been tried in the last minute.
74 74
 	if known.TstAddressIsBad(known.TstNewAddress(futureNa, 3, secondsOld, zeroTime, false, 0)) {

+ 4
- 4
addrmgr/network_test.go View File

@@ -9,15 +9,15 @@ import (
9 9
 	"testing"
10 10
 
11 11
 	"git.parallelcoin.io/dev/btcd/addrmgr/network"
12
+	"git.parallelcoin.io/dev/btcd/wire/na"
12 13
 	"git.parallelcoin.io/dev/btcd/wire/service"
13
-	"git.parallelcoin.io/dev/btcd/wire"
14 14
 )
15 15
 
16 16
 // TestIPTypes ensures the various functions which determine the type of an IP
17 17
 // address based on RFCs work as intended.
18 18
 func TestIPTypes(t *testing.T) {
19 19
 	type ipTest struct {
20
-		in       wire.NetAddress
20
+		in       na.NetAddress
21 21
 		rfc1918  bool
22 22
 		rfc2544  bool
23 23
 		rfc3849  bool
@@ -40,7 +40,7 @@ func TestIPTypes(t *testing.T) {
40 40
 		rfc4193, rfc4380, rfc4843, rfc4862, rfc5737, rfc6052, rfc6145, rfc6598,
41 41
 		local, valid, routable bool) ipTest {
42 42
 		nip := net.ParseIP(ip)
43
-		na := *wire.NewNetAddressIPPort(nip, 8333, service.NodeNetwork)
43
+		na := *na.NewNetAddressIPPort(nip, 8333, service.NodeNetwork)
44 44
 		test := ipTest{na, rfc1918, rfc2544, rfc3849, rfc3927, rfc3964, rfc4193, rfc4380,
45 45
 			rfc4843, rfc4862, rfc5737, rfc6052, rfc6145, rfc6598, local, valid, routable}
46 46
 		return test
@@ -193,7 +193,7 @@ func TestGroupKey(t *testing.T) {
193 193
 
194 194
 	for i, test := range tests {
195 195
 		nip := net.ParseIP(test.ip)
196
-		na := *wire.NewNetAddressIPPort(nip, 8333, service.NodeNetwork)
196
+		na := *na.NewNetAddressIPPort(nip, 8333, service.NodeNetwork)
197 197
 		if key := network.GroupKey(&na); key != test.expected {
198 198
 			t.Errorf("TestGroupKey #%d (%s): unexpected group key "+
199 199
 				"- got '%s', want '%s'", i, test.name,

+ 45
- 44
blockchain/chain_test.go View File

@@ -9,11 +9,12 @@ import (
9 9
 	"testing"
10 10
 	"time"
11 11
 
12
+	"git.parallelcoin.io/dev/btcd/wire/msg"
13
+
12 14
 	"git.parallelcoin.io/dev/btcd/btcutil/block"
13 15
 	"git.parallelcoin.io/dev/btcd/btcutil/tx"
14 16
 	"git.parallelcoin.io/dev/btcd/chaincfg"
15 17
 	"git.parallelcoin.io/dev/btcd/chaincfg/chainhash"
16
-	"git.parallelcoin.io/dev/btcd/wire"
17 18
 )
18 19
 
19 20
 // TestHaveBlock tests the HaveBlock API to ensure proper functionality.
@@ -140,8 +141,8 @@ func TestCalcSequenceLock(t *testing.T) {
140 141
 	// Create a utxo view with a fake utxo for the inputs used in the
141 142
 	// transactions created below.  This utxo is added such that it has an
142 143
 	// age of 4 blocks.
143
-	targetTx := tx.New(&wire.MsgTx{
144
-		TxOut: []*wire.TxOut{{
144
+	targetTx := tx.New(&msg.MsgTx{
145
+		TxOut: []*msg.TxOut{{
145 146
 			PkScript: nil,
146 147
 			Value:    10,
147 148
 		}},
@@ -155,7 +156,7 @@ func TestCalcSequenceLock(t *testing.T) {
155 156
 	// that the sequence lock heights are always calculated from the same
156 157
 	// point of view that they were originally calculated from for a given
157 158
 	// utxo.  That is to say, the height prior to it.
158
-	utxo := msg.Outpoint{
159
+	utxo := msg.OutPoint{
159 160
 		Hash:  *targetTx.Hash(),
160 161
 		Index: 0,
161 162
 	}
@@ -175,13 +176,13 @@ func TestCalcSequenceLock(t *testing.T) {
175 176
 
176 177
 	// Add an additional transaction which will serve as our unconfirmed
177 178
 	// output.
178
-	unConfTx := &wire.MsgTx{
179
-		TxOut: []*wire.TxOut{{
179
+	unConfTx := &msg.MsgTx{
180
+		TxOut: []*msg.TxOut{{
180 181
 			PkScript: nil,
181 182
 			Value:    5,
182 183
 		}},
183 184
 	}
184
-	unConfUtxo := msg.Outpoint{
185
+	unConfUtxo := msg.OutPoint{
185 186
 		Hash:  unConfTx.TxHash(),
186 187
 		Index: 0,
187 188
 	}
@@ -191,7 +192,7 @@ func TestCalcSequenceLock(t *testing.T) {
191 192
 	utxoView.AddTxOuts(tx.New(unConfTx), 0x7fffffff)
192 193
 
193 194
 	tests := []struct {
194
-		tx      *wire.MsgTx
195
+		tx      *msg.MsgTx
195 196
 		view    *UtxoViewpoint
196 197
 		mempool bool
197 198
 		want    *SequenceLock
@@ -200,9 +201,9 @@ func TestCalcSequenceLock(t *testing.T) {
200 201
 		// as the new sequence number semantics only apply to
201 202
 		// transactions version 2 or higher.
202 203
 		{
203
-			tx: &wire.MsgTx{
204
+			tx: &msg.MsgTx{
204 205
 				Version: 1,
205
-				TxIn: []*wire.TxIn{{
206
+				TxIn: []*msg.TxIn{{
206 207
 					PreviousOutPoint: utxo,
207 208
 					Sequence:         LockTimeToSequence(false, 3),
208 209
 				}},
@@ -217,11 +218,11 @@ func TestCalcSequenceLock(t *testing.T) {
217 218
 		// This sequence number has the high bit set, so sequence locks
218 219
 		// should be disabled.
219 220
 		{
220
-			tx: &wire.MsgTx{
221
+			tx: &msg.MsgTx{
221 222
 				Version: 2,
222
-				TxIn: []*wire.TxIn{{
223
+				TxIn: []*msg.TxIn{{
223 224
 					PreviousOutPoint: utxo,
224
-					Sequence:         wire.MaxTxInSequenceNum,
225
+					Sequence:         msg.MaxTxInSequenceNum,
225 226
 				}},
226 227
 			},
227 228
 			view: utxoView,
@@ -237,9 +238,9 @@ func TestCalcSequenceLock(t *testing.T) {
237 238
 		// seconds lock-time should be just before the median time of
238 239
 		// the targeted block.
239 240
 		{
240
-			tx: &wire.MsgTx{
241
+			tx: &msg.MsgTx{
241 242
 				Version: 2,
242
-				TxIn: []*wire.TxIn{{
243
+				TxIn: []*msg.TxIn{{
243 244
 					PreviousOutPoint: utxo,
244 245
 					Sequence:         LockTimeToSequence(true, 2),
245 246
 				}},
@@ -255,9 +256,9 @@ func TestCalcSequenceLock(t *testing.T) {
255 256
 		// seconds after the median past time of the last block in the
256 257
 		// chain.
257 258
 		{
258
-			tx: &wire.MsgTx{
259
+			tx: &msg.MsgTx{
259 260
 				Version: 2,
260
-				TxIn: []*wire.TxIn{{
261
+				TxIn: []*msg.TxIn{{
261 262
 					PreviousOutPoint: utxo,
262 263
 					Sequence:         LockTimeToSequence(true, 1024),
263 264
 				}},
@@ -275,9 +276,9 @@ func TestCalcSequenceLock(t *testing.T) {
275 276
 		// bit set.  So the first lock should be selected as it's the
276 277
 		// latest lock that isn't disabled.
277 278
 		{
278
-			tx: &wire.MsgTx{
279
+			tx: &msg.MsgTx{
279 280
 				Version: 2,
280
-				TxIn: []*wire.TxIn{{
281
+				TxIn: []*msg.TxIn{{
281 282
 					PreviousOutPoint: utxo,
282 283
 					Sequence:         LockTimeToSequence(true, 2560),
283 284
 				}, {
@@ -286,12 +287,12 @@ func TestCalcSequenceLock(t *testing.T) {
286 287
 				}, {
287 288
 					PreviousOutPoint: utxo,
288 289
 					Sequence: LockTimeToSequence(false, 5) |
289
-						wire.SequenceLockTimeDisabled,
290
+						msg.SequenceLockTimeDisabled,
290 291
 				}},
291 292
 			},
292 293
 			view: utxoView,
293 294
 			want: &SequenceLock{
294
-				Seconds:     medianTime + (5 << wire.SequenceLockTimeGranularity) - 1,
295
+				Seconds:     medianTime + (5 << msg.SequenceLockTimeGranularity) - 1,
295 296
 				BlockHeight: prevUtxoHeight + 3,
296 297
 			},
297 298
 		},
@@ -300,9 +301,9 @@ func TestCalcSequenceLock(t *testing.T) {
300 301
 		// sequence lock should  have a value of -1 for seconds, but a
301 302
 		// height of 2 meaning it can be included at height 3.
302 303
 		{
303
-			tx: &wire.MsgTx{
304
+			tx: &msg.MsgTx{
304 305
 				Version: 2,
305
-				TxIn: []*wire.TxIn{{
306
+				TxIn: []*msg.TxIn{{
306 307
 					PreviousOutPoint: utxo,
307 308
 					Sequence:         LockTimeToSequence(false, 3),
308 309
 				}},
@@ -317,9 +318,9 @@ func TestCalcSequenceLock(t *testing.T) {
317 318
 		// seconds.  The selected sequence lock value for seconds should
318 319
 		// be the time further in the future.
319 320
 		{
320
-			tx: &wire.MsgTx{
321
+			tx: &msg.MsgTx{
321 322
 				Version: 2,
322
-				TxIn: []*wire.TxIn{{
323
+				TxIn: []*msg.TxIn{{
323 324
 					PreviousOutPoint: utxo,
324 325
 					Sequence:         LockTimeToSequence(true, 5120),
325 326
 				}, {
@@ -329,7 +330,7 @@ func TestCalcSequenceLock(t *testing.T) {
329 330
 			},
330 331
 			view: utxoView,
331 332
 			want: &SequenceLock{
332
-				Seconds:     medianTime + (10 << wire.SequenceLockTimeGranularity) - 1,
333
+				Seconds:     medianTime + (10 << msg.SequenceLockTimeGranularity) - 1,
333 334
 				BlockHeight: -1,
334 335
 			},
335 336
 		},
@@ -338,9 +339,9 @@ func TestCalcSequenceLock(t *testing.T) {
338 339
 		// be the height further in the future, so a height of 10
339 340
 		// indicating it can be included at height 11.
340 341
 		{
341
-			tx: &wire.MsgTx{
342
+			tx: &msg.MsgTx{
342 343
 				Version: 2,
343
-				TxIn: []*wire.TxIn{{
344
+				TxIn: []*msg.TxIn{{
344 345
 					PreviousOutPoint: utxo,
345 346
 					Sequence:         LockTimeToSequence(false, 1),
346 347
 				}, {
@@ -358,9 +359,9 @@ func TestCalcSequenceLock(t *testing.T) {
358 359
 		// based, and the other two are block based. The lock lying
359 360
 		// further into the future for both inputs should be chosen.
360 361
 		{
361
-			tx: &wire.MsgTx{
362
+			tx: &msg.MsgTx{
362 363
 				Version: 2,
363
-				TxIn: []*wire.TxIn{{
364
+				TxIn: []*msg.TxIn{{
364 365
 					PreviousOutPoint: utxo,
365 366
 					Sequence:         LockTimeToSequence(true, 2560),
366 367
 				}, {
@@ -376,7 +377,7 @@ func TestCalcSequenceLock(t *testing.T) {
376 377
 			},
377 378
 			view: utxoView,
378 379
 			want: &SequenceLock{
379
-				Seconds:     medianTime + (13 << wire.SequenceLockTimeGranularity) - 1,
380
+				Seconds:     medianTime + (13 << msg.SequenceLockTimeGranularity) - 1,
380 381
 				BlockHeight: prevUtxoHeight + 8,
381 382
 			},
382 383
 		},
@@ -387,9 +388,9 @@ func TestCalcSequenceLock(t *testing.T) {
387 388
 		// *next* block height, indicating it can be included 2 blocks
388 389
 		// after that.
389 390
 		{
390
-			tx: &wire.MsgTx{
391
+			tx: &msg.MsgTx{
391 392
 				Version: 2,
392
-				TxIn: []*wire.TxIn{{
393
+				TxIn: []*msg.TxIn{{
393 394
 					PreviousOutPoint: unConfUtxo,
394 395
 					Sequence:         LockTimeToSequence(false, 2),
395 396
 				}},
@@ -405,9 +406,9 @@ func TestCalcSequenceLock(t *testing.T) {
405 406
 		// a time based lock, so the lock time should be based off the
406 407
 		// MTP of the *next* block.
407 408
 		{
408
-			tx: &wire.MsgTx{
409
+			tx: &msg.MsgTx{
409 410
 				Version: 2,
410
-				TxIn: []*wire.TxIn{{
411
+				TxIn: []*msg.TxIn{{
411 412
 					PreviousOutPoint: unConfUtxo,
412 413
 					Sequence:         LockTimeToSequence(true, 1024),
413 414
 				}},
@@ -454,8 +455,8 @@ func nodeHashes(nodes []*blockNode, indexes ...int) []chainhash.Hash {
454 455
 // nodeHeaders is a convenience function that returns the headers for all of
455 456
 // the passed indexes of the provided nodes.  It is used to construct expected
456 457
 // located headers in the tests.
457
-func nodeHeaders(nodes []*blockNode, indexes ...int) []wire.BlockHeader {
458
-	headers := make([]wire.BlockHeader, 0, len(indexes))
458
+func nodeHeaders(nodes []*blockNode, indexes ...int) []msg.BlockHeader {
459
+	headers := make([]msg.BlockHeader, 0, len(indexes))
459 460
 	for _, idx := range indexes {
460 461
 		headers = append(headers, nodes[idx].Header())
461 462
 	}
@@ -493,11 +494,11 @@ func TestLocateInventory(t *testing.T) {
493 494
 
494 495
 	tests := []struct {
495 496
 		name       string
496
-		locator    BlockLocator       // locator for requested inventory
497
-		hashStop   chainhash.Hash     // stop hash for locator
498
-		maxAllowed uint32             // max to locate, 0 = wire const
499
-		headers    []wire.BlockHeader // expected located headers
500
-		hashes     []chainhash.Hash   // expected located hashes
497
+		locator    BlockLocator      // locator for requested inventory
498
+		hashStop   chainhash.Hash    // stop hash for locator
499
+		maxAllowed uint32            // max to locate, 0 = wire const
500
+		headers    []msg.BlockHeader // expected located headers
501
+		hashes     []chainhash.Hash  // expected located hashes
501 502
 	}{
502 503
 		{
503 504
 			// Empty block locators and unknown stop hash.  No
@@ -769,7 +770,7 @@ func TestLocateInventory(t *testing.T) {
769 770
 	}
770 771
 	for _, test := range tests {
771 772
 		// Ensure the expected headers are located.
772
-		var headers []wire.BlockHeader
773
+		var headers []msg.BlockHeader
773 774
 		if test.maxAllowed != 0 {
774 775
 			// Need to use the unexported function to override the
775 776
 			// max allowed for headers.
@@ -788,7 +789,7 @@ func TestLocateInventory(t *testing.T) {
788 789
 		}
789 790
 
790 791
 		// Ensure the expected block hashes are located.
791
-		maxAllowed := uint32(wire.MaxBlocksPerMsg)
792
+		maxAllowed := uint32(msg.MaxBlocksPerMsg)
792 793
 		if test.maxAllowed != 0 {
793 794
 			maxAllowed = test.maxAllowed
794 795
 		}

+ 21
- 20
blockchain/chainio_test.go View File

@@ -11,9 +11,10 @@ import (
11 11
 	"reflect"
12 12
 	"testing"
13 13
 
14
+	"git.parallelcoin.io/dev/btcd/wire/msg"
15
+
14 16
 	"git.parallelcoin.io/dev/btcd/database"
15 17
 	"git.parallelcoin.io/dev/btcd/util/diff"
16
-	"git.parallelcoin.io/dev/btcd/wire"
17 18
 )
18 19
 
19 20
 // TestErrNotInMainChain ensures the functions related to errNotInMainChain work
@@ -210,7 +211,7 @@ func TestSpendJournalSerialization(t *testing.T) {
210 211
 	tests := []struct {
211 212
 		name       string
212 213
 		entry      []SpentTxOut
213
-		blockTxns  []*wire.MsgTx
214
+		blockTxns  []*msg.MsgTx
214 215
 		serialized []byte
215 216
 	}{
216 217
 		// From block 2 in main blockchain.
@@ -229,17 +230,17 @@ func TestSpendJournalSerialization(t *testing.T) {
229 230
 				IsCoinBase: true,
230 231
 				Height:     9,
231 232
 			}},
232
-			blockTxns: []*wire.MsgTx{{ // Coinbase omitted.
233
+			blockTxns: []*msg.MsgTx{{ // Coinbase omitted.
233 234
 				Version: 1,
234
-				TxIn: []*wire.TxIn{{
235
-					PreviousOutPoint: msg.Outpoint{
235
+				TxIn: []*msg.TxIn{{
236
+					PreviousOutPoint: msg.OutPoint{
236 237
 						Hash:  *newHashFromStr("0437cd7f8525ceed2324359c2d0ba26006d92d856a9c20fa0241106ee5a597c9"),
237 238
 						Index: 0,
238 239
 					},
239 240
 					SignatureScript: hexToBytes("47304402204e45e16932b8af514961a1d3a1a25fdf3f4f7732e9d624c6c61548ab5fb8cd410220181522ec8eca07de4860a4acdd12909d831cc56cbbac4622082221a8768d1d0901"),
240 241
 					Sequence:        0xffffffff,
241 242
 				}},
242
-				TxOut: []*wire.TxOut{{
243
+				TxOut: []*msg.TxOut{{
243 244
 					Value:    1000000000,
244 245
 					PkScript: hexToBytes("4104ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa28414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6cd84cac"),
245 246
 				}, {
@@ -264,17 +265,17 @@ func TestSpendJournalSerialization(t *testing.T) {
264 265
 				IsCoinBase: false,
265 266
 				Height:     100024,
266 267
 			}},
267
-			blockTxns: []*wire.MsgTx{{ // Coinbase omitted.
268
+			blockTxns: []*msg.MsgTx{{ // Coinbase omitted.
268 269
 				Version: 1,
269
-				TxIn: []*wire.TxIn{{
270
-					PreviousOutPoint: msg.Outpoint{
270
+				TxIn: []*msg.TxIn{{
271
+					PreviousOutPoint: msg.OutPoint{
271 272
 						Hash:  *newHashFromStr("c0ed017828e59ad5ed3cf70ee7c6fb0f426433047462477dc7a5d470f987a537"),
272 273
 						Index: 1,
273 274
 					},
274 275
 					SignatureScript: hexToBytes("493046022100c167eead9840da4a033c9a56470d7794a9bb1605b377ebe5688499b39f94be59022100fb6345cab4324f9ea0b9ee9169337534834638d818129778370f7d378ee4a325014104d962cac5390f12ddb7539507065d0def320d68c040f2e73337c3a1aaaab7195cb5c4d02e0959624d534f3c10c3cf3d73ca5065ebd62ae986b04c6d090d32627c"),
275 276
 					Sequence:        0xffffffff,
276 277
 				}},
277
-				TxOut: []*wire.TxOut{{
278
+				TxOut: []*msg.TxOut{{
278 279
 					Value:    5000000,
279 280
 					PkScript: hexToBytes("76a914f419b8db4ba65f3b6fcc233acb762ca6f51c23d488ac"),
280 281
 				}, {
@@ -284,15 +285,15 @@ func TestSpendJournalSerialization(t *testing.T) {
284 285
 				LockTime: 0,
285 286
 			}, {
286 287
 				Version: 1,
287
-				TxIn: []*wire.TxIn{{
288
-					PreviousOutPoint: msg.Outpoint{
288
+				TxIn: []*msg.TxIn{{
289
+					PreviousOutPoint: msg.OutPoint{
289 290
 						Hash:  *newHashFromStr("92fbe1d4be82f765dfabc9559d4620864b05cc897c4db0e29adac92d294e52b7"),
290 291
 						Index: 0,
291 292
 					},
292 293
 					SignatureScript: hexToBytes("483045022100e256743154c097465cf13e89955e1c9ff2e55c46051b627751dee0144183157e02201d8d4f02cde8496aae66768f94d35ce54465bd4ae8836004992d3216a93a13f00141049d23ce8686fe9b802a7a938e8952174d35dd2c2089d4112001ed8089023ab4f93a3c9fcd5bfeaa9727858bf640dc1b1c05ec3b434bb59837f8640e8810e87742"),
293 294
 					Sequence:        0xffffffff,
294 295
 				}},
295
-				TxOut: []*wire.TxOut{{
296
+				TxOut: []*msg.TxOut{{
296 297
 					Value:    5000000,
297 298
 					PkScript: hexToBytes("76a914a983ad7c92c38fc0e2025212e9f972204c6e687088ac"),
298 299
 				}, {
@@ -342,17 +343,17 @@ func TestSpendJournalErrors(t *testing.T) {
342 343
 
343 344
 	tests := []struct {
344 345
 		name       string
345
-		blockTxns  []*wire.MsgTx
346
+		blockTxns  []*msg.MsgTx
346 347
 		serialized []byte
347 348
 		errType    error
348 349
 	}{
349 350
 		// Adapted from block 170 in main blockchain.
350 351
 		{
351 352
 			name: "Force assertion due to missing stxos",
352
-			blockTxns: []*wire.MsgTx{{ // Coinbase omitted.
353
+			blockTxns: []*msg.MsgTx{{ // Coinbase omitted.
353 354
 				Version: 1,
354
-				TxIn: []*wire.TxIn{{
355
-					PreviousOutPoint: msg.Outpoint{
355
+				TxIn: []*msg.TxIn{{
356
+					PreviousOutPoint: msg.OutPoint{
356 357
 						Hash:  *newHashFromStr("0437cd7f8525ceed2324359c2d0ba26006d92d856a9c20fa0241106ee5a597c9"),
357 358
 						Index: 0,
358 359
 					},
@@ -366,10 +367,10 @@ func TestSpendJournalErrors(t *testing.T) {
366 367
 		},
367 368
 		{
368 369
 			name: "Force deserialization error in stxos",
369
-			blockTxns: []*wire.MsgTx{{ // Coinbase omitted.
370
+			blockTxns: []*msg.MsgTx{{ // Coinbase omitted.
370 371
 				Version: 1,
371
-				TxIn: []*wire.TxIn{{
372
-					PreviousOutPoint: msg.Outpoint{
372
+				TxIn: []*msg.TxIn{{
373
+					PreviousOutPoint: msg.OutPoint{
373 374
 						Hash:  *newHashFromStr("0437cd7f8525ceed2324359c2d0ba26006d92d856a9c20fa0241106ee5a597c9"),
374 375
 						Index: 0,
375 376
 					},

+ 2
- 2
blockchain/chainview_test.go View File

@@ -10,7 +10,7 @@ import (
10 10
 	"reflect"
11 11
 	"testing"
12 12
 
13
-	"git.parallelcoin.io/dev/btcd/wire"
13
+	"git.parallelcoin.io/dev/btcd/wire/msg"
14 14
 )
15 15
 
16 16
 // testNoncePrng provides a deterministic prng for the nonce in generated fake
@@ -26,7 +26,7 @@ func chainedNodes(parent *blockNode, numNodes int) []*blockNode {
26 26
 	for i := 0; i < numNodes; i++ {
27 27
 		// This is invalid, but all that is needed is enough to get the
28 28
 		// synthetic tests to work.
29
-		header := wire.BlockHeader{Nonce: testNoncePrng.Uint32()}
29
+		header := msg.BlockHeader{Nonce: testNoncePrng.Uint32()}
30 30
 		if tip != nil {
31 31
 			header.PrevBlock = tip.hash
32 32
 		}

+ 4
- 3
blockchain/common_test.go View File

@@ -14,6 +14,8 @@ import (
14 14
 	"strings"
15 15
 	"time"
16 16
 
17
+	"git.parallelcoin.io/dev/btcd/wire/msg"
18
+
17 19
 	"git.parallelcoin.io/dev/btcd/txscript/sig"
18 20
 
19 21
 	"git.parallelcoin.io/dev/btcd/btcutil/block"
@@ -23,7 +25,6 @@ import (
23 25
 	"git.parallelcoin.io/dev/btcd/chaincfg/chainhash"
24 26
 	"git.parallelcoin.io/dev/btcd/database"
25 27
 	_ "git.parallelcoin.io/dev/btcd/database/ffldb"
26
-	"git.parallelcoin.io/dev/btcd/wire"
27 28
 )
28 29
 
29 30
 const (
@@ -252,7 +253,7 @@ func loadUtxoView(filename string) (*UtxoViewpoint, error) {
252 253
 		if err != nil {
253 254
 			return nil, err
254 255
 		}
255
-		view.Entries()[msg.Outpoint{Hash: hash, Index: index}] = entry
256
+		view.Entries()[msg.OutPoint{Hash: hash, Index: index}] = entry
256 257
 	}
257 258
 
258 259
 	return view, nil
@@ -377,7 +378,7 @@ func newFakeChain(params *chaincfg.Params) *BlockChain {
377 378
 // provided fields populated and fake values for the other fields.
378 379
 func newFakeNode(parent *blockNode, blockVersion int32, bits uint32, timestamp time.Time) *blockNode {
379 380
 	// Make up a header and create a block node from it.
380
-	header := &wire.BlockHeader{
381
+	header := &msg.BlockHeader{
381 382
 		Version:   blockVersion,
382 383
 		PrevBlock: parent.hash,
383 384
 		Bits:      bits,

+ 5
- 4
blockchain/fullblocks_test.go View File

@@ -14,6 +14,8 @@ import (
14 14
 
15 15
 	"git.parallelcoin.io/dev/btcd/btcutil/block"
16 16
 	"git.parallelcoin.io/dev/btcd/txscript/sig"
17
+	"git.parallelcoin.io/dev/btcd/wire/message"
18
+	"git.parallelcoin.io/dev/btcd/wire/msg"
17 19
 	"git.parallelcoin.io/dev/btcd/wire/service"
18 20
 
19 21
 	"git.parallelcoin.io/dev/btcd/blockchain"
@@ -22,7 +24,6 @@ import (
22 24
 	"git.parallelcoin.io/dev/btcd/chaincfg/chainhash"
23 25
 	"git.parallelcoin.io/dev/btcd/database"
24 26
 	_ "git.parallelcoin.io/dev/btcd/database/ffldb"
25
-	"git.parallelcoin.io/dev/btcd/wire"
26 27
 )
27 28
 
28 29
 const (
@@ -230,9 +231,9 @@ func TestFullBlocks(t *testing.T) {
230 231
 			blockHash, blockHeight)
231 232
 
232 233
 		// Ensure there is an error due to deserializing the block.
233
-		var msgBlock wire.MsgBlock
234
-		err := msgBlock.BtcDecode(bytes.NewReader(item.RawBlock), 0, wire.BaseEncoding)
235
-		if _, ok := err.(*wire.MessageError); !ok {
234
+		var msgBlock msg.MsgBlock
235
+		err := msgBlock.BtcDecode(bytes.NewReader(item.RawBlock), 0, msg.BaseEncoding)
236
+		if _, ok := err.(*message.Error); !ok {
236 237
 			t.Fatalf("block %q (hash %s, height %d) should have "+
237 238
 				"failed to decode", item.Name, blockHash,
238 239
 				blockHeight)

+ 95
- 93
blockchain/fullblocktests/generate.go View File

@@ -18,6 +18,9 @@ import (
18 18
 	"runtime"
19 19
 	"time"
20 20
 
21
+	"git.parallelcoin.io/dev/btcd/wire/msg"
22
+	"git.parallelcoin.io/dev/btcd/wire/rw"
23
+
21 24
 	"git.parallelcoin.io/dev/btcd/btcutil/tx"
22 25
 
23 26
 	"git.parallelcoin.io/dev/btcd/blockchain"
@@ -28,7 +31,6 @@ import (
28 31
 	"git.parallelcoin.io/dev/btcd/chaincfg/chainhash"
29 32
 	"git.parallelcoin.io/dev/btcd/txscript"
30 33
 	"git.parallelcoin.io/dev/btcd/util/diff"
31
-	"git.parallelcoin.io/dev/btcd/wire"
32 34
 )
33 35
 
34 36
 const (
@@ -69,7 +71,7 @@ type TestInstance interface {
69 71
 // orphan.
70 72
 type AcceptedBlock struct {
71 73
 	Name        string
72
-	Block       *wire.MsgBlock
74
+	Block       *msg.MsgBlock
73 75
 	Height      int32
74 76
 	IsMainChain bool
75 77
 	IsOrphan    bool
@@ -88,7 +90,7 @@ func (b AcceptedBlock) FullBlockTestInstance() {}
88 90
 // the blockchain consensus rules.
89 91
 type RejectedBlock struct {
90 92
 	Name       string
91
-	Block      *wire.MsgBlock
93
+	Block      *msg.MsgBlock
92 94
 	Height     int32
93 95
 	RejectCode blockchain.ErrorCode
94 96
 }
@@ -110,7 +112,7 @@ func (b RejectedBlock) FullBlockTestInstance() {}
110 112
 // to ultimately link it).
111 113
 type OrphanOrRejectedBlock struct {
112 114
 	Name   string
113
-	Block  *wire.MsgBlock
115
+	Block  *msg.MsgBlock
114 116
 	Height int32
115 117
 }
116 118
 
@@ -127,7 +129,7 @@ func (b OrphanOrRejectedBlock) FullBlockTestInstance() {}
127 129
 // tip of the main chain.
128 130
 type ExpectedTip struct {
129 131
 	Name   string
130
-	Block  *wire.MsgBlock
132
+	Block  *msg.MsgBlock
131 133
 	Height int32
132 134
 }
133 135
 
@@ -157,15 +159,15 @@ func (b RejectedNonCanonicalBlock) FullBlockTestInstance() {}
157 159
 // spendableOut represents a transaction output that is spendable along with
158 160
 // additional metadata such as the block its in and how much it pays.
159 161
 type spendableOut struct {
160
-	prevOut msg.Outpoint
162
+	prevOut msg.OutPoint
161 163
 	amount  amt.Amount
162 164
 }
163 165
 
164 166
 // makeSpendableOutForTx returns a spendable output for the given transaction
165 167
 // and transaction output index within the transaction.
166
-func makeSpendableOutForTx(tx *wire.MsgTx, txOutIndex uint32) spendableOut {
168
+func makeSpendableOutForTx(tx *msg.MsgTx, txOutIndex uint32) spendableOut {
167 169
 	return spendableOut{
168
-		prevOut: msg.Outpoint{
170
+		prevOut: msg.OutPoint{
169 171
 			Hash:  tx.TxHash(),
170 172
 			Index: txOutIndex,
171 173
 		},
@@ -175,7 +177,7 @@ func makeSpendableOutForTx(tx *wire.MsgTx, txOutIndex uint32) spendableOut {
175 177
 
176 178
 // makeSpendableOut returns a spendable output for the given block, transaction
177 179
 // index within the block, and transaction output index within the transaction.
178
-func makeSpendableOut(block *wire.MsgBlock, txIndex, txOutIndex uint32) spendableOut {
180
+func makeSpendableOut(block *msg.MsgBlock, txIndex, txOutIndex uint32) spendableOut {
179 181
 	return makeSpendableOutForTx(block.Transactions[txIndex], txOutIndex)
180 182
 }
181 183
 
@@ -184,11 +186,11 @@ func makeSpendableOut(block *wire.MsgBlock, txIndex, txOutIndex uint32) spendabl
184 186
 // available spendable outputs used throughout the tests.
185 187
 type testGenerator struct {
186 188
 	params       *chaincfg.Params
187
-	tip          *wire.MsgBlock
189
+	tip          *msg.MsgBlock
188 190
 	tipName      string
189 191
 	tipHeight    int32
190
-	blocks       map[chainhash.Hash]*wire.MsgBlock
191
-	blocksByName map[string]*wire.MsgBlock
192
+	blocks       map[chainhash.Hash]*msg.MsgBlock
193
+	blocksByName map[string]*msg.MsgBlock
192 194
 	blockHeights map[string]int32
193 195
 
194 196
 	// Used for tracking spendable coinbase outputs.
@@ -207,8 +209,8 @@ func makeTestGenerator(params *chaincfg.Params) (testGenerator, error) {
207 209
 	genesisHash := genesis.BlockHash()
208 210
 	return testGenerator{
209 211
 		params:       params,
210
-		blocks:       map[chainhash.Hash]*wire.MsgBlock{genesisHash: genesis},
211
-		blocksByName: map[string]*wire.MsgBlock{"genesis": genesis},
212
+		blocks:       map[chainhash.Hash]*msg.MsgBlock{genesisHash: genesis},
213
+		blocksByName: map[string]*msg.MsgBlock{"genesis": genesis},
212 214
 		blockHeights: map[string]int32{"genesis": 0},
213 215
 		tip:          genesis,
214 216
 		tipName:      "genesis",
@@ -266,7 +268,7 @@ func opReturnScript(data []byte) []byte {
266 268
 // uniqueOpReturnScript returns a standard provably-pruneable OpReturn script
267 269
 // with a random uint64 encoded as the data.
268 270
 func uniqueOpReturnScript() []byte {
269
-	rand, err := wire.RandomUint64()
271
+	rand, err := rw.RandomUint64()
270 272
 	if err != nil {
271 273
 		panic(err)
272 274
 	}
@@ -279,23 +281,23 @@ func uniqueOpReturnScript() []byte {
279 281
 // createCoinbaseTx returns a coinbase transaction paying an appropriate
280 282
 // subsidy based on the passed block height.  The coinbase signature script
281 283
 // conforms to the requirements of version 2 blocks.
282
-func (g *testGenerator) createCoinbaseTx(blockHeight int32) *wire.MsgTx {
284
+func (g *testGenerator) createCoinbaseTx(blockHeight int32) *msg.MsgTx {
283 285
 	extraNonce := uint64(0)
284 286
 	coinbaseScript, err := standardCoinbaseScript(blockHeight, extraNonce)
285 287
 	if err != nil {
286 288
 		panic(err)
287 289
 	}
288 290
 
289
-	tx := wire.NewMsgTx(1)
290
-	tx.AddTxIn(&wire.TxIn{
291
+	tx := msg.NewMsgTx(1)
292
+	tx.AddTxIn(&msg.TxIn{
291 293
 		// Coinbase transactions have no inputs, so previous outpoint is
292 294
 		// zero hash and max index.
293
-		PreviousOutPoint: *wire.NewOutPoint(&chainhash.Hash{},
294
-			wire.MaxPrevOutIndex),
295
-		Sequence:        wire.MaxTxInSequenceNum,
295
+		PreviousOutPoint: *msg.NewOutPoint(&chainhash.Hash{},
296
+			msg.MaxPrevOutIndex),
297
+		Sequence:        msg.MaxTxInSequenceNum,
296 298
 		SignatureScript: coinbaseScript,
297 299
 	})
298
-	tx.AddTxOut(&wire.TxOut{
300
+	tx.AddTxOut(&msg.TxOut{
299 301
 		Value:    blockchain.CalcBlockSubsidy(blockHeight, g.params),
300 302
 		PkScript: opTrueScript,
301 303
 	})
@@ -304,7 +306,7 @@ func (g *testGenerator) createCoinbaseTx(blockHeight int32) *wire.MsgTx {
304 306
 
305 307
 // calcMerkleRoot creates a merkle tree from the slice of transactions and
306 308
 // returns the root of the tree.
307
-func calcMerkleRoot(txns []*wire.MsgTx) chainhash.Hash {
309
+func calcMerkleRoot(txns []*msg.MsgTx) chainhash.Hash {
308 310
 	if len(txns) == 0 {
309 311
 		return chainhash.Hash{}
310 312
 	}
@@ -325,7 +327,7 @@ func calcMerkleRoot(txns []*wire.MsgTx) chainhash.Hash {
325 327
 // NOTE: This function will never solve blocks with a nonce of 0.  This is done
326 328
 // so the 'nextBlock' function can properly detect when a nonce was modified by
327 329
 // a munge function.
328
-func solveBlock(header *wire.BlockHeader) bool {
330
+func solveBlock(header *msg.BlockHeader) bool {
329 331
 	// sbResult is used by the solver goroutines to send results.
330 332
 	type sbResult struct {
331 333
 		found bool
@@ -337,7 +339,7 @@ func solveBlock(header *wire.BlockHeader) bool {
337 339
 	targetDifficulty := diff.CompactToBig(header.Bits)
338 340
 	quit := make(chan bool)
339 341
 	results := make(chan sbResult)
340
-	solver := func(hdr wire.BlockHeader, startNonce, stopNonce uint32) {
342
+	solver := func(hdr msg.BlockHeader, startNonce, stopNonce uint32) {
341 343
 		// We need to modify the nonce field of the header, so make sure
342 344
 		// we work with a copy of the original header.
343 345
 		for i := startNonce; i >= startNonce && i <= stopNonce; i++ {
@@ -384,8 +386,8 @@ func solveBlock(header *wire.BlockHeader) bool {
384 386
 
385 387
 // additionalCoinbase returns a function that itself takes a block and
386 388
 // modifies it by adding the provided amount to coinbase subsidy.
387
-func additionalCoinbase(amount amt.Amount) func(*wire.MsgBlock) {
388
-	return func(b *wire.MsgBlock) {
389
+func additionalCoinbase(amount amt.Amount) func(*msg.MsgBlock) {
390
+	return func(b *msg.MsgBlock) {
389 391
 		// Increase the first proof-of-work coinbase subsidy by the
390 392
 		// provided amount.
391 393
 		b.Transactions[0].TxOut[0].Value += int64(amount)
@@ -397,8 +399,8 @@ func additionalCoinbase(amount amt.Amount) func(*wire.MsgBlock) {
397 399
 //
398 400
 // NOTE: The coinbase value is NOT updated to reflect the additional fee.  Use
399 401
 // 'additionalCoinbase' for that purpose.
400
-func additionalSpendFee(fee amt.Amount) func(*wire.MsgBlock) {
401
-	return func(b *wire.MsgBlock) {
402
+func additionalSpendFee(fee amt.Amount) func(*msg.MsgBlock) {
403
+	return func(b *msg.MsgBlock) {
402 404
 		// Increase the fee of the spending transaction by reducing the
403 405
 		// amount paid.
404 406
 		if int64(fee) > b.Transactions[1].TxOut[0].Value {
@@ -412,24 +414,24 @@ func additionalSpendFee(fee amt.Amount) func(*wire.MsgBlock) {
412 414
 
413 415
 // replaceSpendScript returns a function that itself takes a block and modifies
414 416
 // it by replacing the public key script of the spending transaction.
415
-func replaceSpendScript(pkScript []byte) func(*wire.MsgBlock) {
416
-	return func(b *wire.MsgBlock) {
417
+func replaceSpendScript(pkScript []byte) func(*msg.MsgBlock) {
418
+	return func(b *msg.MsgBlock) {
417 419
 		b.Transactions[1].TxOut[0].PkScript = pkScript
418 420
 	}
419 421
 }
420 422
 
421 423
 // replaceCoinbaseSigScript returns a function that itself takes a block and
422 424
 // modifies it by replacing the signature key script of the coinbase.
423
-func replaceCoinbaseSigScript(script []byte) func(*wire.MsgBlock) {
424
-	return func(b *wire.MsgBlock) {
425
+func replaceCoinbaseSigScript(script []byte) func(*msg.MsgBlock) {
426
+	return func(b *msg.MsgBlock) {
425 427
 		b.Transactions[0].TxIn[0].SignatureScript = script
426 428
 	}
427 429
 }
428 430
 
429 431
 // additionalTx returns a function that itself takes a block and modifies it by
430 432
 // adding the the provided transaction.
431
-func additionalTx(tx *wire.MsgTx) func(*wire.MsgBlock) {
432
-	return func(b *wire.MsgBlock) {
433
+func additionalTx(tx *msg.MsgTx) func(*msg.MsgBlock) {
434
+	return func(b *msg.MsgBlock) {
433 435
 		b.AddTransaction(tx)
434 436
 	}
435 437
 }
@@ -439,16 +441,16 @@ func additionalTx(tx *wire.MsgTx) func(*wire.MsgBlock) {
439 441
 // transaction ends up with a unique hash.  The script is a simple OpTrue
440 442
 // script which avoids the need to track addresses and signature scripts in the
441 443
 // tests.
442
-func createSpendTx(spend *spendableOut, fee amt.Amount) *wire.MsgTx {
443
-	spendTx := wire.NewMsgTx(1)
444
-	spendTx.AddTxIn(&wire.TxIn{
444
+func createSpendTx(spend *spendableOut, fee amt.Amount) *msg.MsgTx {
445
+	spendTx := msg.NewMsgTx(1)
446
+	spendTx.AddTxIn(&msg.TxIn{
445 447
 		PreviousOutPoint: spend.prevOut,
446
-		Sequence:         wire.MaxTxInSequenceNum,
448
+		Sequence:         msg.MaxTxInSequenceNum,
447 449
 		SignatureScript:  nil,
448 450
 	})
449
-	spendTx.AddTxOut(wire.NewTxOut(int64(spend.amount-fee),
451
+	spendTx.AddTxOut(msg.NewTxOut(int64(spend.amount-fee),
450 452
 		opTrueScript))
451
-	spendTx.AddTxOut(wire.NewTxOut(0, uniqueOpReturnScript()))
453
+	spendTx.AddTxOut(msg.NewTxOut(0, uniqueOpReturnScript()))
452 454
 
453 455
 	return spendTx
454 456
 }
@@ -458,7 +460,7 @@ func createSpendTx(spend *spendableOut, fee amt.Amount) *wire.MsgTx {
458 460
 // to ensure the transaction ends up with a unique hash.  The public key script
459 461
 // is a simple OpTrue script which avoids the need to track addresses and
460 462
 // signature scripts in the tests.  The signature script is nil.
461
-func createSpendTxForTx(tx *wire.MsgTx, fee amt.Amount) *wire.MsgTx {
463
+func createSpendTxForTx(tx *msg.MsgTx, fee amt.Amount) *msg.MsgTx {
462 464
 	spend := makeSpendableOutForTx(tx, 0)
463 465
 	return createSpendTx(&spend, fee)
464 466
 }
@@ -482,12 +484,12 @@ func createSpendTxForTx(tx *wire.MsgTx, fee amt.Amount) *wire.MsgTx {
482 484
 // applied after all munge functions have been invoked:
483 485
 // - The merkle root will be recalculated unless it was manually changed
484 486
 // - The block will be solved unless the nonce was changed
485
-func (g *testGenerator) nextBlock(blockName string, spend *spendableOut, mungers ...func(*wire.MsgBlock)) *wire.MsgBlock {
487
+func (g *testGenerator) nextBlock(blockName string, spend *spendableOut, mungers ...func(*msg.MsgBlock)) *msg.MsgBlock {
486 488
 	// Create coinbase transaction for the block using any additional
487 489
 	// subsidy if specified.
488 490
 	nextHeight := g.tipHeight + 1
489 491
 	coinbaseTx := g.createCoinbaseTx(nextHeight)
490
-	txns := []*wire.MsgTx{coinbaseTx}
492
+	txns := []*msg.MsgTx{coinbaseTx}
491 493
 	if spend != nil {
492 494
 		// Create the transaction with a fee of 1 atom for the
493 495
 		// miner and increase the coinbase subsidy accordingly.
@@ -512,8 +514,8 @@ func (g *testGenerator) nextBlock(blockName string, spend *spendableOut, mungers
512 514
 		ts = g.tip.Header.Timestamp.Add(time.Second)
513 515
 	}
514 516
 
515
-	block := wire.MsgBlock{
516
-		Header: wire.BlockHeader{
517
+	block := msg.MsgBlock{
518
+		Header: msg.BlockHeader{
517 519
 			Version:    1,
518 520
 			PrevBlock:  g.tip.BlockHash(),
519 521
 			MerkleRoot: calcMerkleRoot(txns),
@@ -557,7 +559,7 @@ func (g *testGenerator) nextBlock(blockName string, spend *spendableOut, mungers
557 559
 // map references to a block via its old hash and insert new ones for the new
558 560
 // block hash.  This is useful if the test code has to manually change a block
559 561
 // after 'nextBlock' has returned.
560
-func (g *testGenerator) updateBlockState(oldBlockName string, oldBlockHash chainhash.Hash, newBlockName string, newBlock *wire.MsgBlock) {
562
+func (g *testGenerator) updateBlockState(oldBlockName string, oldBlockHash chainhash.Hash, newBlockName string, newBlock *msg.MsgBlock) {
561 563
 	// Look up the height from the existing entries.
562 564
 	blockHeight := g.blockHeights[oldBlockName]
563 565
 
@@ -610,7 +612,7 @@ func (g *testGenerator) saveSpendableCoinbaseOuts() {
610 612
 	// Loop through the ancestors of the current tip until the
611 613
 	// reaching the block that has already had the coinbase outputs
612 614
 	// collected.
613
-	var collectBlocks []*wire.MsgBlock
615
+	var collectBlocks []*msg.MsgBlock
614 616
 	for b := g.tip; b != nil; b = g.blocks[b.Header.PrevBlock] {
615 617
 		if b.BlockHash() == g.prevCollectedHash {
616 618
 			break
@@ -637,19 +639,19 @@ func nonCanonicalVarInt(val uint32) []byte {
637 639
 // encoding the number of transactions using a variable-length encoded integer
638 640
 // with 9 bytes even though it should be encoded with a minimal canonical
639 641
 // encoding.
640
-func encodeNonCanonicalBlock(b *wire.MsgBlock) []byte {
642
+func encodeNonCanonicalBlock(b *msg.MsgBlock) []byte {
641 643
 	var buf bytes.Buffer
642
-	b.Header.BtcEncode(&buf, 0, wire.BaseEncoding)
644
+	b.Header.BtcEncode(&buf, 0, msg.BaseEncoding)
643 645
 	buf.Write(nonCanonicalVarInt(uint32(len(b.Transactions))))
644 646
 	for _, tx := range b.Transactions {
645
-		tx.BtcEncode(&buf, 0, wire.BaseEncoding)
647
+		tx.BtcEncode(&buf, 0, msg.BaseEncoding)
646 648
 	}
647 649
 	return buf.Bytes()
648 650
 }
649 651
 
650 652
 // cloneBlock returns a deep copy of the provided block.
651
-func cloneBlock(b *wire.MsgBlock) wire.MsgBlock {
652
-	var blockCopy wire.MsgBlock
653
+func cloneBlock(b *msg.MsgBlock) msg.MsgBlock {
654
+	var blockCopy msg.MsgBlock
653 655
 	blockCopy.Header = b.Header
654 656
 	for _, tx := range b.Transactions {
655 657
 		blockCopy.AddTransaction(tx.Copy())
@@ -677,7 +679,7 @@ func assertScriptSigOpsCount(script []byte, expected int) {
677 679
 
678 680
 // countBlockSigOps returns the number of legacy signature operations in the
679 681
 // scripts in the passed block.
680
-func countBlockSigOps(block *wire.MsgBlock) int {
682
+func countBlockSigOps(block *msg.MsgBlock) int {
681 683
 	totalSigOps := 0
682 684
 	for _, tx := range block.Transactions {
683 685
 		for _, txIn := range tx.TxIn {
@@ -839,25 +841,25 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
839 841
 	//
840 842
 	// expectTipBlock creates a test instance that expects the provided
841 843
 	// block to be the current tip of the block chain.
842
-	acceptBlock := func(blockName string, block *wire.MsgBlock, isMainChain, isOrphan bool) TestInstance {
844
+	acceptBlock := func(blockName string, block *msg.MsgBlock, isMainChain, isOrphan bool) TestInstance {
843 845
 		blockHeight := g.blockHeights[blockName]
844 846
 		return AcceptedBlock{blockName, block, blockHeight, isMainChain,
845 847
 			isOrphan}
846 848
 	}
847
-	rejectBlock := func(blockName string, block *wire.MsgBlock, code blockchain.ErrorCode) TestInstance {
849
+	rejectBlock := func(blockName string, block *msg.MsgBlock, code blockchain.ErrorCode) TestInstance {
848 850
 		blockHeight := g.blockHeights[blockName]
849 851
 		return RejectedBlock{blockName, block, blockHeight, code}
850 852
 	}
851
-	rejectNonCanonicalBlock := func(blockName string, block *wire.MsgBlock) TestInstance {
853
+	rejectNonCanonicalBlock := func(blockName string, block *msg.MsgBlock) TestInstance {
852 854
 		blockHeight := g.blockHeights[blockName]
853 855
 		encoded := encodeNonCanonicalBlock(block)
854 856
 		return RejectedNonCanonicalBlock{blockName, encoded, blockHeight}
855 857
 	}
856
-	orphanOrRejectBlock := func(blockName string, block *wire.MsgBlock) TestInstance {
858
+	orphanOrRejectBlock := func(blockName string, block *msg.MsgBlock) TestInstance {
857 859
 		blockHeight := g.blockHeights[blockName]
858 860
 		return OrphanOrRejectedBlock{blockName, block, blockHeight}
859 861
 	}
860
-	expectTipBlock := func(blockName string, block *wire.MsgBlock) TestInstance {
862
+	expectTipBlock := func(blockName string, block *msg.MsgBlock) TestInstance {
861 863
 		blockHeight := g.blockHeights[blockName]
862 864
 		return ExpectedTip{blockName, block, blockHeight}
863 865
 	}
@@ -1127,7 +1129,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
1127 1129
 	//
1128 1130
 	//   ... -> b15(5) -> b23(6)
1129 1131
 	g.setTip("b15")
1130
-	g.nextBlock("b23", outs[6], func(b *wire.MsgBlock) {
1132
+	g.nextBlock("b23", outs[6], func(b *msg.MsgBlock) {
1131 1133
 		bytesToMaxSize := maxBlockSize - b.SerializeSize() - 3
1132 1134
 		sizePadScript := repeatOpcode(0x00, bytesToMaxSize)
1133 1135
 		replaceSpendScript(sizePadScript)(b)
@@ -1141,7 +1143,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
1141 1143
 	//   ... -> b15(5) -> b23(6)
1142 1144
 	//                \-> b24(6) -> b25(7)
1143 1145
 	g.setTip("b15")
1144
-	g.nextBlock("b24", outs[6], func(b *wire.MsgBlock) {
1146
+	g.nextBlock("b24", outs[6], func(b *msg.MsgBlock) {
1145 1147
 		bytesToMaxSize := maxBlockSize - b.SerializeSize() - 3
1146 1148
 		sizePadScript := repeatOpcode(0x00, bytesToMaxSize+1)
1147 1149
 		replaceSpendScript(sizePadScript)(b)
@@ -1307,7 +1309,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
1307 1309
 	//
1308 1310
 	//   ... -> b35(10) -> b39(11)
1309 1311
 	g.setTip("b35")
1310
-	b39 := g.nextBlock("b39", outs[11], func(b *wire.MsgBlock) {
1312
+	b39 := g.nextBlock("b39", outs[11], func(b *msg.MsgBlock) {
1311 1313
 		// Create a chain of transactions each spending from the
1312 1314
 		// previous one such that each contains an output that pays to
1313 1315
 		// the redeem script and the total number of signature
@@ -1319,7 +1321,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
1319 1321
 		for i := 0; i < txnsNeeded; i++ {
1320 1322
 			prevTx = createSpendTxForTx(prevTx, lowFee)
1321 1323
 			prevTx.TxOut[0].Value -= 2
1322
-			prevTx.AddTxOut(wire.NewTxOut(2, p2shScript))
1324
+			prevTx.AddTxOut(msg.NewTxOut(2, p2shScript))
1323 1325
 			b.AddTransaction(prevTx)
1324 1326
 		}
1325 1327
 	})
@@ -1332,7 +1334,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
1332 1334
 	//   ... -> b35(10) -> b39(11)
1333 1335
 	//                            \-> b40(12)
1334 1336
 	g.setTip("b39")
1335
-	g.nextBlock("b40", outs[12], func(b *wire.MsgBlock) {
1337
+	g.nextBlock("b40", outs[12], func(b *msg.MsgBlock) {
1336 1338
 		txnsNeeded := (maxBlockSigOps / redeemScriptSigOps)
1337 1339
 		for i := 0; i < txnsNeeded; i++ {
1338 1340
 			// Create a signed transaction that spends from the
@@ -1365,7 +1367,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
1365 1367
 	//
1366 1368
 	//   ... -> b35(10) -> b39(11) -> b41(12)
1367 1369
 	g.setTip("b39")
1368
-	g.nextBlock("b41", outs[12], func(b *wire.MsgBlock) {
1370
+	g.nextBlock("b41", outs[12], func(b *msg.MsgBlock) {
1369 1371
 		txnsNeeded := (maxBlockSigOps / redeemScriptSigOps)
1370 1372
 		for i := 0; i < txnsNeeded; i++ {
1371 1373
 			spend := makeSpendableOutForTx(b39.Transactions[i+2], 2)
@@ -1417,7 +1419,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
1417 1419
 	//
1418 1420
 	//   ... -> b43(13)
1419 1421
 	//                 \-> b44(14)
1420
-	g.nextBlock("b44", nil, func(b *wire.MsgBlock) {
1422
+	g.nextBlock("b44", nil, func(b *msg.MsgBlock) {
1421 1423
 		nonCoinbaseTx := createSpendTx(outs[14], lowFee)
1422 1424
 		b.Transactions[0] = nonCoinbaseTx
1423 1425
 	})
@@ -1428,7 +1430,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
1428 1430
 	//   ... -> b43(13)
1429 1431
 	//                 \-> b45(_)
1430 1432
 	g.setTip("b43")
1431
-	g.nextBlock("b45", nil, func(b *wire.MsgBlock) {
1433
+	g.nextBlock("b45", nil, func(b *msg.MsgBlock) {
1432 1434
 		b.Transactions = nil
1433 1435
 	})
1434 1436
 	rejected(blockchain.ErrNoTransactions)
@@ -1463,7 +1465,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
1463 1465
 	//   ... -> b43(13)
1464 1466
 	//                 \-> b47(14)
1465 1467
 	g.setTip("b43")
1466
-	g.nextBlock("b47", outs[14], func(b *wire.MsgBlock) {
1468
+	g.nextBlock("b47", outs[14], func(b *msg.MsgBlock) {
1467 1469
 		// 3 hours in the future clamped to 1 second precision.
1468 1470
 		nowPlus3Hours := time.Now().Add(time.Hour * 3)
1469 1471
 		b.Header.Timestamp = time.Unix(nowPlus3Hours.Unix(), 0)
@@ -1475,7 +1477,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
1475 1477
 	//   ... -> b43(13)
1476 1478
 	//                 \-> b48(14)
1477 1479
 	g.setTip("b43")
1478
-	g.nextBlock("b48", outs[14], func(b *wire.MsgBlock) {
1480
+	g.nextBlock("b48", outs[14], func(b *msg.MsgBlock) {
1479 1481
 		b.Header.MerkleRoot = chainhash.Hash{}
1480 1482
 	})
1481 1483
 	rejected(blockchain.ErrBadMerkleRoot)
@@ -1485,7 +1487,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
1485 1487
 	//   ... -> b43(13)
1486 1488
 	//                 \-> b49(14)
1487 1489
 	g.setTip("b43")
1488
-	g.nextBlock("b49", outs[14], func(b *wire.MsgBlock) {
1490
+	g.nextBlock("b49", outs[14], func(b *msg.MsgBlock) {
1489 1491
 		b.Header.Bits--
1490 1492
 	})
1491 1493
 	rejected(blockchain.ErrUnexpectedDifficulty)
@@ -1523,7 +1525,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
1523 1525
 	//   ... -> b43(13)
1524 1526
 	//                 \-> b51(14)
1525 1527
 	g.setTip("b43")
1526
-	g.nextBlock("b51", outs[14], func(b *wire.MsgBlock) {
1528
+	g.nextBlock("b51", outs[14], func(b *msg.MsgBlock) {
1527 1529
 		b.AddTransaction(b.Transactions[1])
1528 1530
 	})
1529 1531
 	g.assertTipBlockNumTxns(3)
@@ -1534,7 +1536,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
1534 1536
 	//   ... -> b43(13)
1535 1537
 	//                 \-> b52(14)
1536 1538
 	g.setTip("b43")
1537
-	g.nextBlock("b52", outs[14], func(b *wire.MsgBlock) {
1539
+	g.nextBlock("b52", outs[14], func(b *msg.MsgBlock) {
1538 1540
 		hash := newHashFromStr("00000000000000000000000000000000" +
1539 1541
 			"00000000000000000123456789abcdef")
1540 1542
 		b.Transactions[1].TxIn[0].PreviousOutPoint.Hash = *hash
@@ -1558,7 +1560,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
1558 1560
 	//
1559 1561
 	//   ... -> b33(9) -> b35(10) -> b39(11) -> b42(12) -> b43(13) -> b53(14)
1560 1562
 	//                                                                       \-> b54(15)
1561
-	g.nextBlock("b54", outs[15], func(b *wire.MsgBlock) {
1563
+	g.nextBlock("b54", outs[15], func(b *msg.MsgBlock) {
1562 1564
 		medianBlock := g.blocks[b.Header.PrevBlock]
1563 1565
 		for i := 0; i < medianTimeBlocks/2; i++ {
1564 1566
 			medianBlock = g.blocks[medianBlock.Header.PrevBlock]
@@ -1572,7 +1574,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
1572 1574
 	//
1573 1575
 	//   ... -> b33(9) -> b35(10) -> b39(11) -> b42(12) -> b43(13) -> b53(14) -> b55(15)
1574 1576
 	g.setTip("b53")
1575
-	g.nextBlock("b55", outs[15], func(b *wire.MsgBlock) {
1577
+	g.nextBlock("b55", outs[15], func(b *msg.MsgBlock) {
1576 1578
 		medianBlock := g.blocks[b.Header.PrevBlock]
1577 1579
 		for i := 0; i < medianTimeBlocks/2; i++ {
1578 1580
 			medianBlock = g.blocks[medianBlock.Header.PrevBlock]
@@ -1621,7 +1623,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
1621 1623
 	//   ... -> b55(15) -> b57(16)
1622 1624
 	//                 \-> b56(16)
1623 1625
 	g.setTip("b55")
1624
-	b57 := g.nextBlock("b57", outs[16], func(b *wire.MsgBlock) {
1626
+	b57 := g.nextBlock("b57", outs[16], func(b *msg.MsgBlock) {
1625 1627
 		tx2 := b.Transactions[1]
1626 1628
 		tx3 := createSpendTxForTx(tx2, lowFee)
1627 1629
 		b.AddTransaction(tx3)
@@ -1629,7 +1631,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
1629 1631
 	g.assertTipBlockNumTxns(3)
1630 1632
 
1631 1633
 	g.setTip("b55")
1632
-	b56 := g.nextBlock("b56", nil, func(b *wire.MsgBlock) {
1634
+	b56 := g.nextBlock("b56", nil, func(b *msg.MsgBlock) {
1633 1635
 		*b = cloneBlock(b57)
1634 1636
 		b.AddTransaction(b.Transactions[2])
1635 1637
 	})
@@ -1663,7 +1665,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
1663 1665
 	//   ... -> b55(15) -> b57(16)
1664 1666
 	//                 \-> b56p2(16)
1665 1667
 	g.setTip("b55")
1666
-	g.nextBlock("b56p2", outs[16], func(b *wire.MsgBlock) {
1668
+	g.nextBlock("b56p2", outs[16], func(b *msg.MsgBlock) {
1667 1669
 		// Create 4 transactions that each spend from the previous tx
1668 1670
 		// in the block.
1669 1671
 		spendTx := b.Transactions[1]
@@ -1689,7 +1691,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
1689 1691
 	//   ... -> b57(16)
1690 1692
 	//                 \-> b58(17)
1691 1693
 	g.setTip("b57")
1692
-	g.nextBlock("b58", outs[17], func(b *wire.MsgBlock) {
1694
+	g.nextBlock("b58", outs[17], func(b *msg.MsgBlock) {
1693 1695
 		b.Transactions[1].TxIn[0].PreviousOutPoint.Index = 42
1694 1696
 	})
1695 1697
 	rejected(blockchain.ErrMissingTxOut)
@@ -1699,7 +1701,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
1699 1701
 	//   ... -> b57(16)
1700 1702
 	//                 \-> b59(17)
1701 1703
 	g.setTip("b57")
1702
-	g.nextBlock("b59", outs[17], func(b *wire.MsgBlock) {
1704
+	g.nextBlock("b59", outs[17], func(b *msg.MsgBlock) {
1703 1705
 		b.Transactions[1].TxOut[0].Value = int64(outs[17].amount) + 1
1704 1706
 	})
1705 1707
 	rejected(blockchain.ErrSpendTooHigh)
@@ -1720,7 +1722,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
1720 1722
 	//
1721 1723
 	//   ... -> b60(17)
1722 1724
 	//                 \-> b61(18)
1723
-	g.nextBlock("b61", outs[18], func(b *wire.MsgBlock) {
1725
+	g.nextBlock("b61", outs[18], func(b *msg.MsgBlock) {
1724 1726
 		// Duplicate the coinbase of the parent block to force the
1725 1727
 		// condition.
1726 1728
 		parent := g.blocks[b.Header.PrevBlock]
@@ -1737,7 +1739,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
1737 1739
 	//   ... -> b60(17)
1738 1740
 	//                 \-> b62(18)
1739 1741
 	g.setTip("b60")
1740
-	g.nextBlock("b62", outs[18], func(b *wire.MsgBlock) {
1742
+	g.nextBlock("b62", outs[18], func(b *msg.MsgBlock) {
1741 1743
 		// A non-final transaction must have at least one input with a
1742 1744
 		// non-final sequence number in addition to a non-final lock
1743 1745
 		// time.
@@ -1751,7 +1753,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
1751 1753
 	//   ... -> b60(17)
1752 1754
 	//                 \-> b63(18)
1753 1755
 	g.setTip("b60")
1754
-	g.nextBlock("b63", outs[18], func(b *wire.MsgBlock) {
1756
+	g.nextBlock("b63", outs[18], func(b *msg.MsgBlock) {
1755 1757
 		// A non-final transaction must have at least one input with a
1756 1758
 		// non-final sequence number in addition to a non-final lock
1757 1759
 		// time.
@@ -1775,7 +1777,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
1775 1777
 	//   ... -> b60(17) -> b64(18)
1776 1778
 	//                 \-> b64a(18)
1777 1779
 	g.setTip("b60")
1778
-	b64a := g.nextBlock("b64a", outs[18], func(b *wire.MsgBlock) {
1780
+	b64a := g.nextBlock("b64a", outs[18], func(b *msg.MsgBlock) {
1779 1781
 		bytesToMaxSize := maxBlockSize - b.SerializeSize() - 3
1780 1782
 		sizePadScript := repeatOpcode(0x00, bytesToMaxSize)
1781 1783
 		replaceSpendScript(sizePadScript)(b)
@@ -1784,7 +1786,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
1784 1786
 	rejectedNonCanonical()
1785 1787
 
1786 1788
 	g.setTip("b60")
1787
-	b64 := g.nextBlock("b64", outs[18], func(b *wire.MsgBlock) {
1789
+	b64 := g.nextBlock("b64", outs[18], func(b *msg.MsgBlock) {
1788 1790
 		*b = cloneBlock(b64a)
1789 1791
 	})
1790 1792
 	// Since the two blocks have the same hash and the generator state now
@@ -1804,7 +1806,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
1804 1806
 	//
1805 1807
 	//   ... b64(18) -> b65(19)
1806 1808
 	g.setTip("b64")
1807
-	g.nextBlock("b65", outs[19], func(b *wire.MsgBlock) {
1809
+	g.nextBlock("b65", outs[19], func(b *msg.MsgBlock) {
1808 1810
 		tx3 := createSpendTxForTx(b.Transactions[1], lowFee)
1809 1811
 		b.AddTransaction(tx3)
1810 1812
 	})
@@ -1814,7 +1816,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
1814 1816
 	//
1815 1817
 	//   ... -> b65(19)
1816 1818
 	//                 \-> b66(20)
1817
-	g.nextBlock("b66", nil, func(b *wire.MsgBlock) {
1819
+	g.nextBlock("b66", nil, func(b *msg.MsgBlock) {
1818 1820
 		tx2 := createSpendTx(outs[20], lowFee)
1819 1821
 		tx3 := createSpendTxForTx(tx2, lowFee)
1820 1822
 		b.AddTransaction(tx3)
@@ -1828,7 +1830,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
1828 1830
 	//   ... -> b65(19)
1829 1831
 	//                 \-> b67(20)
1830 1832
 	g.setTip("b65")
1831
-	g.nextBlock("b67", outs[20], func(b *wire.MsgBlock) {
1833
+	g.nextBlock("b67", outs[20], func(b *msg.MsgBlock) {
1832 1834
 		tx2 := b.Transactions[1]
1833 1835
 		tx3 := createSpendTxForTx(tx2, lowFee)
1834 1836
 		tx4 := createSpendTxForTx(tx2, lowFee)
@@ -1952,7 +1954,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
1952 1954
 	//   ... -> b73(22) -> b74(23)
1953 1955
 	script := []byte{txscript.OpIf, txscript.OpInvalidOpcode,
1954 1956
 		txscript.OpElse, txscript.OpTrue, txscript.OpEndIf}
1955
-	g.nextBlock("b74", outs[23], replaceSpendScript(script), func(b *wire.MsgBlock) {
1957
+	g.nextBlock("b74", outs[23], replaceSpendScript(script), func(b *msg.MsgBlock) {
1956 1958
 		tx2 := b.Transactions[1]
1957 1959
 		tx3 := createSpendTxForTx(tx2, lowFee)
1958 1960
 		tx3.TxIn[0].SignatureScript = []byte{txscript.OpFalse}
@@ -1968,14 +1970,14 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
1968 1970
 	// OpReturn output.
1969 1971
 	//
1970 1972
 	//   ... -> b74(23) -> b75(24)
1971
-	g.nextBlock("b75", outs[24], func(b *wire.MsgBlock) {
1973
+	g.nextBlock("b75", outs[24], func(b *msg.MsgBlock) {
1972 1974
 		// Add 4 outputs to the spending transaction that are spent
1973 1975
 		// below.
1974 1976
 		const numAdditionalOutputs = 4
1975 1977
 		const zeroCoin = int64(0)
1976 1978
 		spendTx := b.Transactions[1]
1977 1979
 		for i := 0; i < numAdditionalOutputs; i++ {
1978
-			spendTx.AddTxOut(wire.NewTxOut(zeroCoin, opTrueScript))
1980
+			spendTx.AddTxOut(msg.NewTxOut(zeroCoin, opTrueScript))
1979 1981
 		}
1980 1982
 
1981 1983
 		// Add transactions spending from the outputs added above that
@@ -2035,13 +2037,13 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
2035 2037
 	//   ... -> b79(26) -> b81(27)
2036 2038
 	//
2037 2039
 	g.setTip("b79")
2038
-	g.nextBlock("b81", outs[27], func(b *wire.MsgBlock) {
2040
+	g.nextBlock("b81", outs[27], func(b *msg.MsgBlock) {
2039 2041
 		const numAdditionalOutputs = 4
2040 2042
 		const zeroCoin = int64(0)
2041 2043
 		spendTx := b.Transactions[1]
2042 2044
 		for i := 0; i < numAdditionalOutputs; i++ {
2043 2045
 			opRetScript := uniqueOpReturnScript()
2044
-			spendTx.AddTxOut(wire.NewTxOut(zeroCoin, opRetScript))
2046
+			spendTx.AddTxOut(msg.NewTxOut(zeroCoin, opRetScript))
2045 2047
 		}
2046 2048
 	})
2047 2049
 	for i := uint32(2); i < 6; i++ {
@@ -2076,7 +2078,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
2076 2078
 	chain1TipName := g.tipName
2077 2079
 	for i := int32(0); i < numLargeReorgBlocks; i++ {
2078 2080
 		chain1TipName = fmt.Sprintf("br%d", i)
2079
-		g.nextBlock(chain1TipName, &reorgSpend, func(b *wire.MsgBlock) {
2081
+		g.nextBlock(chain1TipName, &reorgSpend, func(b *msg.MsgBlock) {
2080 2082
 			bytesToMaxSize := maxBlockSize - b.SerializeSize() - 3
2081 2083
 			sizePadScript := repeatOpcode(0x00, bytesToMaxSize)
2082 2084
 			replaceSpendScript(sizePadScript)(b)

+ 8
- 7
blockchain/fullblocktests/params.go View File

@@ -9,9 +9,10 @@ import (
9 9
 	"math/big"
10 10
 	"time"
11 11
 
12
+	"git.parallelcoin.io/dev/btcd/wire/msg"
13
+
12 14
 	"git.parallelcoin.io/dev/btcd/chaincfg"
13 15
 	"git.parallelcoin.io/dev/btcd/chaincfg/chainhash"
14
-	"git.parallelcoin.io/dev/btcd/wire"
15 16
 	"git.parallelcoin.io/dev/btcd/wire/service"
16 17
 )
17 18
 
@@ -50,8 +51,8 @@ var (
50 51
 
51 52
 	// regTestGenesisBlock defines the genesis block of the block chain which serves
52 53
 	// as the public transaction ledger for the regression test network.
53
-	regTestGenesisBlock = wire.MsgBlock{
54
-		Header: wire.BlockHeader{
54
+	regTestGenesisBlock = msg.MsgBlock{
55
+		Header: msg.BlockHeader{
55 56
 			Version:    1,
56 57
 			PrevBlock:  *newHashFromStr("0000000000000000000000000000000000000000000000000000000000000000"),
57 58
 			MerkleRoot: *newHashFromStr("4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"),
@@ -59,10 +60,10 @@ var (
59 60
 			Bits:       0x207fffff,               // 545259519 [7fffff0000000000000000000000000000000000000000000000000000000000]
60 61
 			Nonce:      2,
61 62
 		},
62
-		Transactions: []*wire.MsgTx{{
63
+		Transactions: []*msg.MsgTx{{
63 64
 			Version: 1,
64
-			TxIn: []*wire.TxIn{{
65
-				PreviousOutPoint: msg.Outpoint{
65
+			TxIn: []*msg.TxIn{{
66
+				PreviousOutPoint: msg.OutPoint{
66 67
 					Hash:  chainhash.Hash{},
67 68
 					Index: 0xffffffff,
68 69
 				},
@@ -73,7 +74,7 @@ var (
73 74
 					"206261696c6f757420666f72206261686b73"),
74 75
 				Sequence: 0xffffffff,
75 76
 			}},
76
-			TxOut: []*wire.TxOut{{
77
+			TxOut: []*msg.TxOut{{
77 78
 				Value: 0,
78 79
 				PkScript: fromHex("4104678afdb0fe5548271967f1" +
79 80
 					"a67130b7105cd6a828e03909a67962e0ea1f" +

+ 2
- 2
blockchain/indexers/addrindex_test.go View File

@@ -9,7 +9,7 @@ import (
9 9
 	"fmt"
10 10
 	"testing"
11 11
 
12
-	"git.parallelcoin.io/dev/btcd/wire"
12
+	"git.parallelcoin.io/dev/btcd/wire/msg"
13 13
 )
14 14
 
15 15
 // addrIndexBucket provides a mock address index database bucket by implementing
@@ -220,7 +220,7 @@ nextTest:
220 220
 			levels: make(map[[levelKeySize]byte][]byte),
221 221
 		}
222 222
 		for i := 0; i < test.numInsert; i++ {
223
-			txLoc := wire.TxLoc{TxStart: i * 2}
223
+			txLoc := msg.TxLoc{TxStart: i * 2}
224 224
 			err := dbPutAddrIndexEntry(populatedBucket, test.key,
225 225
 				uint32(i), txLoc)
226 226
 			if err != nil {

+ 4
- 4
blockchain/validate_test.go View File

@@ -12,10 +12,10 @@ import (
12 12
 
13 13
 	"git.parallelcoin.io/dev/btcd/btcutil/block"
14 14
 	"git.parallelcoin.io/dev/btcd/btcutil/tx"
15
+	"git.parallelcoin.io/dev/btcd/wire/msg"
15 16
 
16 17
 	"git.parallelcoin.io/dev/btcd/chaincfg"
17 18
 	"git.parallelcoin.io/dev/btcd/chaincfg/chainhash"
18
-	"git.parallelcoin.io/dev/btcd/wire"
19 19
 )
20 20
 
21 21
 // TestSequenceLocksActive tests the SequenceLockActive function to ensure it
@@ -176,9 +176,9 @@ func TestCheckBlockSanity(t *testing.T) {
176 176
 // and handled properly.
177 177
 func TestCheckSerializedHeight(t *testing.T) {
178 178
 	// Create an empty coinbase template to be used in the tests below.
179
-	coinbaseOutpoint := wire.NewOutPoint(&chainhash.Hash{}, math.MaxUint32)
180
-	coinbaseTx := wire.NewMsgTx(1)
181
-	coinbaseTx.AddTxIn(wire.NewTxIn(coinbaseOutpoint, nil, nil))
179
+	coinbaseOutpoint := msg.NewOutPoint(&chainhash.Hash{}, math.MaxUint32)
180
+	coinbaseTx := msg.NewMsgTx(1)
181
+	coinbaseTx.AddTxIn(msg.NewTxIn(coinbaseOutpoint, nil, nil))
182 182
 
183 183
 	// Expected rule errors.
184 184
 	missingHeightError := RuleError{

+ 7
- 7
btcjson/chainsvrcmds_test.go View File

@@ -12,7 +12,7 @@ import (
12 12
 	"testing"
13 13
 
14 14
 	"git.parallelcoin.io/dev/btcd/btcjson"
15
-	"git.parallelcoin.io/dev/btcd/wire"
15
+	"git.parallelcoin.io/dev/btcd/wire/msg"
16 16
 )
17 17
 
18 18
 // TestChainSvrCmds tests all of the chain server commands marshal and unmarshal
@@ -322,32 +322,32 @@ func TestChainSvrCmds(t *testing.T) {
322 322
 			name: "getcfilter",
323 323
 			newCmd: func() (interface{}, error) {
324 324
 				return btcjson.NewCmd("getcfilter", "123",
325
-					wire.GCSFilterRegular)
325
+					msg.GCSFilterRegular)
326 326
 			},
327 327
 			staticCmd: func() interface{} {
328 328
 				return btcjson.NewGetCFilterCmd("123",
329
-					wire.GCSFilterRegular)
329
+					msg.GCSFilterRegular)
330 330
 			},
331 331
 			marshalled: `{"jsonrpc":"1.0","method":"getcfilter","params":["123",0],"id":1}`,
332 332
 			unmarshalled: &btcjson.GetCFilterCmd{
333 333
 				Hash:       "123",
334
-				FilterType: wire.GCSFilterRegular,
334
+				FilterType: msg.GCSFilterRegular,
335 335
 			},
336 336
 		},
337 337
 		{
338 338
 			name: "getcfilterheader",
339 339
 			newCmd: func() (interface{}, error) {
340 340
 				return btcjson.NewCmd("getcfilterheader", "123",
341
-					wire.GCSFilterRegular)
341
+					msg.GCSFilterRegular)
342 342
 			},
343 343
 			staticCmd: func() interface{} {
344 344
 				return btcjson.NewGetCFilterHeaderCmd("123",
345
-					wire.GCSFilterRegular)
345
+					msg.GCSFilterRegular)
346 346
 			},
347 347
 			marshalled: `{"jsonrpc":"1.0","method":"getcfilterheader","params":["123",0],"id":1}`,
348 348
 			unmarshalled: &btcjson.GetCFilterHeaderCmd{
349 349
 				Hash:       "123",
350
-				FilterType: wire.GCSFilterRegular,
350
+				FilterType: msg.GCSFilterRegular,
351 351
 			},
352 352
 		},
353 353
 		{

+ 18
- 17
btcutil/block/block_test.go View File

@@ -11,9 +11,10 @@ import (
11 11
 	"testing"
12 12
 	"time"
13 13
 
14
+	"git.parallelcoin.io/dev/btcd/wire/msg"
15
+
14 16
 	"git.parallelcoin.io/dev/btcd/btcutil/block"
15 17
 	"git.parallelcoin.io/dev/btcd/chaincfg/chainhash"
16
-	"git.parallelcoin.io/dev/btcd/wire"
17 18
 	"github.com/davecgh/go-spew/spew"
18 19
 )
19 20
 
@@ -144,7 +145,7 @@ func TestBlock(t *testing.T) {
144 145
 	}
145 146
 
146 147
 	// Transaction offsets and length for the transaction in Block100000.
147
-	wantTxLocs := []wire.TxLoc{
148
+	wantTxLocs := []msg.TxLoc{
148 149
 		{TxStart: 81, TxLen: 135},
149 150
 		{TxStart: 216, TxLen: 259},
150 151
 		{TxStart: 475, TxLen: 257},
@@ -301,8 +302,8 @@ func TestBlockErrors(t *testing.T) {
301 302
 
302 303
 // Block100000 defines block 100,000 of the block chain.  It is used to
303 304
 // test Block operations.
304
-var Block100000 = wire.MsgBlock{
305
-	Header: wire.BlockHeader{
305
+var Block100000 = msg.MsgBlock{
306
+	Header: msg.BlockHeader{
306 307
 		Version: 1,
307 308
 		PrevBlock: chainhash.Hash([32]byte{ // Make go vet happy.
308 309
 			0x50, 0x12, 0x01, 0x19, 0x17, 0x2a, 0x61, 0x04,
@@ -320,12 +321,12 @@ var Block100000 = wire.MsgBlock{
320 321
 		Bits:      0x1b04864c,               // 453281356
321 322
 		Nonce:     0x10572b0f,               // 274148111
322 323
 	},
323
-	Transactions: []*wire.MsgTx{
324
+	Transactions: []*msg.MsgTx{
324 325
 		{
325 326
 			Version: 1,
326
-			TxIn: []*wire.TxIn{
327
+			TxIn: []*msg.TxIn{
327 328
 				{
328
-					PreviousOutPoint: msg.Outpoint{
329
+					PreviousOutPoint: msg.OutPoint{
329 330
 						Hash:  chainhash.Hash{},
330 331
 						Index: 0xffffffff,
331 332
 					},
@@ -335,7 +336,7 @@ var Block100000 = wire.MsgBlock{
335 336
 					Sequence: 0xffffffff,
336 337
 				},
337 338
 			},
338
-			TxOut: []*wire.TxOut{
339
+			TxOut: []*msg.TxOut{
339 340
 				{
340 341
 					Value: 0x12a05f200, // 5000000000
341 342
 					PkScript: []byte{
@@ -357,9 +358,9 @@ var Block100000 = wire.MsgBlock{
357 358
 		},
358 359
 		{
359 360
 			Version: 1,
360
-			TxIn: []*wire.TxIn{
361
+			TxIn: []*msg.TxIn{
361 362
 				{
362
-					PreviousOutPoint: msg.Outpoint{
363
+					PreviousOutPoint: msg.OutPoint{
363 364
 						Hash: chainhash.Hash([32]byte{ // Make go vet happy.
364 365
 							0x03, 0x2e, 0x38, 0xe9, 0xc0, 0xa8, 0x4c, 0x60,
365 366
 							0x46, 0xd6, 0x87, 0xd1, 0x05, 0x56, 0xdc, 0xac,
@@ -394,7 +395,7 @@ var Block100000 = wire.MsgBlock{
394 395
 					Sequence: 0xffffffff,
395 396
 				},
396 397
 			},
397
-			TxOut: []*wire.TxOut{
398
+			TxOut: []*msg.TxOut{
398 399
 				{
399 400
 					Value: 0x2123e300, // 556000000
400 401
 					PkScript: []byte{
@@ -426,9 +427,9 @@ var Block100000 = wire.MsgBlock{
426 427
 		},
427 428
 		{
428 429
 			Version: 1,
429
-			TxIn: []*wire.TxIn{
430
+			TxIn: []*msg.TxIn{
430 431
 				{
431
-					PreviousOutPoint: msg.Outpoint{
432
+					PreviousOutPoint: msg.OutPoint{
432 433
 						Hash: chainhash.Hash([32]byte{ // Make go vet happy.
433 434
 							0xc3, 0x3e, 0xbf, 0xf2, 0xa7, 0x09, 0xf1, 0x3d,
434 435
 							0x9f, 0x9a, 0x75, 0x69, 0xab, 0x16, 0xa3, 0x27,
@@ -462,7 +463,7 @@ var Block100000 = wire.MsgBlock{
462 463
 					Sequence: 0xffffffff,
463 464
 				},
464 465
 			},
465
-			TxOut: []*wire.TxOut{
466
+			TxOut: []*msg.TxOut{
466 467
 				{
467 468
 					Value: 0xf4240, // 1000000
468 469
 					PkScript: []byte{
@@ -494,9 +495,9 @@ var Block100000 = wire.MsgBlock{
494 495
 		},
495 496
 		{
496 497
 			Version: 1,
497
-			TxIn: []*wire.TxIn{
498
+			TxIn: []*msg.TxIn{
498 499
 				{
499
-					PreviousOutPoint: msg.Outpoint{
500
+					PreviousOutPoint: msg.OutPoint{
500 501
 						Hash: chainhash.Hash([32]byte{ // Make go vet happy.
501 502
 							0x0b, 0x60, 0x72, 0xb3, 0x86, 0xd4, 0xa7, 0x73,
502 503
 							0x23, 0x52, 0x37, 0xf6, 0x4c, 0x11, 0x26, 0xac,
@@ -531,7 +532,7 @@ var Block100000 = wire.MsgBlock{
531 532
 					Sequence: 0xffffffff,
532 533
 				},
533 534
 			},
534
-			TxOut: []*wire.TxOut{
535
+			TxOut: []*msg.TxOut{
535 536
 				{
536 537
 					Value: 0xf4240, // 1000000
537 538
 					PkScript: []byte{

+ 4
- 3
btcutil/bloom/merkleblock_test.go View File

@@ -9,13 +9,14 @@ import (
9 9
 	"encoding/hex"
10 10
 	"testing"
11 11
 
12
+	"git.parallelcoin.io/dev/btcd/wire/msg"
13
+	"git.parallelcoin.io/dev/btcd/wire/rw"
12 14
 	"git.parallelcoin.io/dev/btcd/wire/version"
13 15
 
14 16
 	"git.parallelcoin.io/dev/btcd/btcutil/block"
15 17
 	"git.parallelcoin.io/dev/btcd/btcutil/bloom"
16 18
 	"git.parallelcoin.io/dev/btcd/btcutil/filter"
17 19
 	"git.parallelcoin.io/dev/btcd/chaincfg/chainhash"
18
-	"git.parallelcoin.io/dev/btcd/wire"
19 20
 )
20 21
 
21 22
 func TestMerkleBlock3(t *testing.T) {
@@ -38,7 +39,7 @@ func TestMerkleBlock3(t *testing.T) {
38 39
 		return
39 40
 	}
40 41
 
41
-	f := filter.New(10, 0, 0.000001, wire.BloomUpdateAll)
42
+	f := filter.New(10, 0, 0.000001, rw.BloomUpdateAll)
42 43
 
43 44
 	inputStr := "63194f18be0af63f2c6bc9dc0f777cbefed3d9415c4af83f3ee3a3d669c00cb5"
44 45
 	hash, err := chainhash.NewHashFromStr(inputStr)
@@ -63,7 +64,7 @@ func TestMerkleBlock3(t *testing.T) {
63 64
 	}
64 65
 
65 66
 	got := bytes.NewBuffer(nil)
66
-	err = mBlock.BtcEncode(got, version.Protocol, wire.LatestEncoding)
67
+	err = mBlock.BtcEncode(got, version.Protocol, msg.LatestEncoding)
67 68
 	if err != nil {
68 69
 		t.Errorf("TestMerkleBlock3 BtcEncode failed: %v", err)
69 70
 		return

+ 10
- 9
btcutil/coinset/coins.go View File

@@ -9,10 +9,11 @@ import (
9 9
 	"errors"
10 10
 	"sort"
11 11
 
12
+	"git.parallelcoin.io/dev/btcd/wire/msg"
13
+
12 14
 	"git.parallelcoin.io/dev/btcd/btcutil/amt"
13 15
 	"git.parallelcoin.io/dev/btcd/btcutil/tx"
14 16
 	"git.parallelcoin.io/dev/btcd/chaincfg/chainhash"
15
-	"git.parallelcoin.io/dev/btcd/wire"
16 17
 )
17 18
 
18 19
 // Coin represents a spendable transaction outpoint
@@ -124,19 +125,19 @@ func (cs *CoinSet) removeElement(e *list.Element) Coin {
124 125
 }
125 126
 
126 127
 // NewMsgTxWithInputCoins takes the coins in the CoinSet and makes them
127
-// the inputs to a new wire.MsgTx which is returned.
128
-func NewMsgTxWithInputCoins(txVersion int32, inputCoins Coins) *wire.MsgTx {
129
-	msgTx := wire.NewMsgTx(txVersion)
128
+// the inputs to a new msg.MsgTx which is returned.
129
+func NewMsgTxWithInputCoins(txVersion int32, inputCoins Coins) *msg.MsgTx {
130
+	msgTx := msg.NewMsgTx(txVersion)
130 131
 	coins := inputCoins.Coins()
131
-	msgTx.TxIn = make([]*wire.TxIn, len(coins))
132
+	msgTx.TxIn = make([]*msg.TxIn, len(coins))
132 133
 	for i, coin := range coins {
133
-		msgTx.TxIn[i] = &wire.TxIn{
134
-			PreviousOutPoint: msg.Outpoint{
134
+		msgTx.TxIn[i] = &msg.TxIn{
135
+			PreviousOutPoint: msg.OutPoint{
135 136
 				Hash:  *coin.Hash(),
136 137
 				Index: coin.Index(),
137 138
 			},
138 139
 			SignatureScript: nil,
139
-			Sequence:        wire.MaxTxInSequenceNum,
140
+			Sequence:        msg.MaxTxInSequenceNum,
140 141
 		}
141 142
 	}
142 143
 	return msgTx
@@ -366,7 +367,7 @@ func (c *SimpleCoin) Index() uint32 {
366 367
 }
367 368
 
368 369
 // txOut returns the TxOut of the transaction the Coin represents
369
-func (c *SimpleCoin) txOut() *wire.TxOut {
370
+func (c *SimpleCoin) txOut() *msg.TxOut {
370 371
 	return c.Tx.MsgTx().TxOut[c.TxIndex]
371 372
 }
372 373
 

+ 7
- 6
btcutil/coinset/coins_test.go View File

@@ -5,17 +5,18 @@
5 5
 package coinset_test
6 6
 
7 7
 import (
8
-	"git.parallelcoin.io/dev/btcd/btcutil/tx"
9
-	"git.parallelcoin.io/dev/btcd/btcutil/amt"
10 8
 	"bytes"
11 9
 	"crypto/sha256"
12 10
 	"encoding/hex"
13 11
 	"fmt"
14 12
 	"testing"
15 13
 
16
-	"git.parallelcoin.io/dev/btcd/chaincfg/chainhash"
17
-	"git.parallelcoin.io/dev/btcd/wire"
14
+	"git.parallelcoin.io/dev/btcd/btcutil/amt"
15
+	"git.parallelcoin.io/dev/btcd/btcutil/tx"
16
+	"git.parallelcoin.io/dev/btcd/wire/msg"
17
+
18 18
 	"git.parallelcoin.io/dev/btcd/btcutil/coinset"
19
+	"git.parallelcoin.io/dev/btcd/chaincfg/chainhash"
19 20
 )
20 21
 
21 22
 type TestCoin struct {
@@ -27,7 +28,7 @@ type TestCoin struct {
27 28
 
28 29
 func (c *TestCoin) Hash() *chainhash.Hash { return c.TxHash }
29 30
 func (c *TestCoin) Index() uint32         { return c.TxIndex }
30
-func (c *TestCoin) Value() amt.Amount { return c.TxValue }
31
+func (c *TestCoin) Value() amt.Amount     { return c.TxValue }
31 32
 func (c *TestCoin) PkScript() []byte      { return nil }
32 33
 func (c *TestCoin) NumConfs() int64       { return c.TxNumConfs }
33 34
 func (c *TestCoin) ValueAge() int64       { return int64(c.TxValue) * c.TxNumConfs }
@@ -111,7 +112,7 @@ func TestCoinSet(t *testing.T) {
111 112
 		t.Error("Expected first coin")
112 113
 	}
113 114
 
114
-	mtx := coinset.NewMsgTxWithInputCoins(wire.TxVersion, cs)
115
+	mtx := coinset.NewMsgTxWithInputCoins(msg.TxVersion, cs)
115 116
 	if len(mtx.TxIn) != 1 {
116 117
 		t.Errorf("Expected only 1 TxIn, got %d", len(mtx.TxIn))
117 118
 	}

+ 2
- 2
btcutil/filter/example_test.go View File

@@ -11,7 +11,7 @@ import (
11 11
 
12 12
 	"git.parallelcoin.io/dev/btcd/btcutil/filter"
13 13
 	"git.parallelcoin.io/dev/btcd/chaincfg/chainhash"
14
-	"git.parallelcoin.io/dev/btcd/wire"
14
+	"git.parallelcoin.io/dev/btcd/wire/rw"
15 15
 )
16 16
 
17 17
 // This example demonstrates how to create a new bloom filter, add a transaction
@@ -23,7 +23,7 @@ func ExampleNew() {
23 23
 	// Create a new bloom filter intended to hold 10 elements with a 0.01%
24 24
 	// false positive rate and does not include any automatic update
25 25
 	// functionality when transactions are matched.
26
-	ff := filter.New(10, tweak, 0.0001, wire.BloomUpdateNone)
26
+	ff := filter.New(10, tweak, 0.0001, rw.BloomUpdateNone)
27 27
 
28 28
 	// Create a transaction hash and add it to the filter.  This particular
29 29
 	// trasaction is the first transaction in block 310,000 of the main

+ 39
- 37
btcutil/filter/filter_test.go View File

@@ -5,11 +5,14 @@
5 5
 package filter_test
6 6
 
7 7
 import (
8
-	"git.parallelcoin.io/dev/btcd/btcutil/wif"
9 8
 	"bytes"
10 9
 	"encoding/hex"
11 10
 	"testing"
12 11
 
12
+	"git.parallelcoin.io/dev/btcd/btcutil/wif"
13
+
14
+	"git.parallelcoin.io/dev/btcd/wire/msg"
15
+	"git.parallelcoin.io/dev/btcd/wire/rw"
13 16
 	"git.parallelcoin.io/dev/btcd/wire/version"
14 17
 
15 18
 	"git.parallelcoin.io/dev/btcd/btcutil/block"
@@ -18,21 +21,20 @@ import (
18 21
 	"git.parallelcoin.io/dev/btcd/btcutil/hash"
19 22
 	"git.parallelcoin.io/dev/btcd/btcutil/tx"
20 23
 	"git.parallelcoin.io/dev/btcd/chaincfg/chainhash"
21
-	"git.parallelcoin.io/dev/btcd/wire"
22 24
 )
23 25
 
24 26
 // TestFilterLarge ensures a maximum sized filter can be created.
25 27
 func TestFilterLarge(t *testing.T) {
26
-	f := filter.New(100000000, 0, 0.01, wire.BloomUpdateNone)
27
-	if len(f.MsgFilterLoad().Filter) > wire.MaxFilterLoadFilterSize {
28
+	f := filter.New(100000000, 0, 0.01, rw.BloomUpdateNone)
29
+	if len(f.MsgFilterLoad().Filter) > msg.MaxFilterLoadFilterSize {
28 30
 		t.Errorf("TestFilterLarge test failed: %d > %d",
29
-			len(f.MsgFilterLoad().Filter), wire.MaxFilterLoadFilterSize)
31
+			len(f.MsgFilterLoad().Filter), msg.MaxFilterLoadFilterSize)
30 32
 	}
31 33
 }
32 34
 
33 35
 // TestFilterLoad ensures loading and unloading of a filter pass.
34 36
 func TestFilterLoad(t *testing.T) {
35
-	merkle := wire.MsgFilterLoad{}
37
+	merkle := msg.MsgFilterLoad{}
36 38
 
37 39
 	f := filter.Load(&merkle)
38 40
 	if !f.IsLoaded() {
@@ -62,7 +64,7 @@ func TestFilterInsert(t *testing.T) {
62 64
 		{"b9300670b4c5366e95b2699e8b18bc75e5f729c5", true},
63 65
 	}
64 66
 
65
-	f := filter.New(3, 0, 0.01, wire.BloomUpdateAll)
67
+	f := filter.New(3, 0, 0.01, rw.BloomUpdateAll)
66 68
 
67 69
 	for i, test := range tests {
68 70
 		data, err := hex.DecodeString(test.hex)
@@ -89,7 +91,7 @@ func TestFilterInsert(t *testing.T) {
89 91
 	}
90 92
 
91 93
 	got := bytes.NewBuffer(nil)
92
-	err = f.MsgFilterLoad().BtcEncode(got, version.Protocol, wire.LatestEncoding)
94
+	err = f.MsgFilterLoad().BtcEncode(got, version.Protocol, msg.LatestEncoding)
93 95
 	if err != nil {
94 96
 		t.Errorf("TestFilterInsert BtcDecode failed: %v\n", err)
95 97
 		return
@@ -115,19 +117,19 @@ func TestFilterFPRange(t *testing.T) {
115 117
 			name:   "fprates > 1 should be clipped at 1",
116 118
 			hash:   "02981fa052f0481dbc5868f4fc2166035a10f27a03cfd2de67326471df5bc041",
117 119
 			want:   "00000000000000000001",
118
-			filter: filter.New(1, 0, 20.9999999769, wire.BloomUpdateAll),
120
+			filter: filter.New(1, 0, 20.9999999769, rw.BloomUpdateAll),
119 121
 		},
120 122
 		{
121 123
 			name:   "fprates less than 1e-9 should be clipped at min",
122 124
 			hash:   "02981fa052f0481dbc5868f4fc2166035a10f27a03cfd2de67326471df5bc041",
123 125
 			want:   "0566d97a91a91b0000000000000001",
124
-			filter: filter.New(1, 0, 0, wire.BloomUpdateAll),
126
+			filter: filter.New(1, 0, 0, rw.BloomUpdateAll),
125 127
 		},
126 128
 		{
127 129
 			name:   "negative fprates should be clipped at min",
128 130
 			hash:   "02981fa052f0481dbc5868f4fc2166035a10f27a03cfd2de67326471df5bc041",
129 131
 			want:   "0566d97a91a91b0000000000000001",
130
-			filter: filter.New(1, 0, -1, wire.BloomUpdateAll),
132
+			filter: filter.New(1, 0, -1, rw.BloomUpdateAll),
131 133
 		},
132 134
 	}
133 135
 
@@ -149,7 +151,7 @@ func TestFilterFPRange(t *testing.T) {
149 151
 		f := test.filter
150 152
 		f.AddHash(hash)
151 153
 		got := bytes.NewBuffer(nil)
152
-		err = f.MsgFilterLoad().BtcEncode(got, version.Protocol, wire.LatestEncoding)
154
+		err = f.MsgFilterLoad().BtcEncode(got, version.Protocol, msg.LatestEncoding)
153 155
 		if err != nil {
154 156
 			t.Errorf("BtcDecode unexpected error: %v\n", err)
155 157
 			continue
@@ -176,7 +178,7 @@ func TestFilterInsertWithTweak(t *testing.T) {
176 178
 		{"b9300670b4c5366e95b2699e8b18bc75e5f729c5", true},
177 179
 	}
178 180
 
179
-	f := filter.New(3, 2147483649, 0.01, wire.BloomUpdateAll)
181
+	f := filter.New(3, 2147483649, 0.01, rw.BloomUpdateAll)
180 182
 
181 183
 	for i, test := range tests {
182 184
 		data, err := hex.DecodeString(test.hex)
@@ -202,7 +204,7 @@ func TestFilterInsertWithTweak(t *testing.T) {
202 204
 		return
203 205
 	}
204 206
 	got := bytes.NewBuffer(nil)
205
-	err = f.MsgFilterLoad().BtcEncode(got, version.Protocol, wire.LatestEncoding)
207
+	err = f.MsgFilterLoad().BtcEncode(got, version.Protocol, msg.LatestEncoding)
206 208
 	if err != nil {
207 209
 		t.Errorf("TestFilterInsertWithTweak BtcDecode failed: %v\n", err)
208 210
 		return
@@ -226,7 +228,7 @@ func TestFilterInsertKey(t *testing.T) {
226 228
 		return
227 229
 	}
228 230
 
229
-	f := filter.New(2, 0, 0.001, wire.BloomUpdateAll)
231
+	f := filter.New(2, 0, 0.001, rw.BloomUpdateAll)
230 232
 	f.Add(wif.SerializePubKey())
231 233
 	f.Add(hash.H160(wif.SerializePubKey()))
232 234
 
@@ -236,7 +238,7 @@ func TestFilterInsertKey(t *testing.T) {
236 238
 		return
237 239
 	}
238 240
 	got := bytes.NewBuffer(nil)
239
-	err = f.MsgFilterLoad().BtcEncode(got, version.Protocol, wire.LatestEncoding)
241
+	err = f.MsgFilterLoad().BtcEncode(got, version.Protocol, msg.LatestEncoding)
240 242
 	if err != nil {
241 243
 		t.Errorf("TestFilterInsertWithTweak BtcDecode failed: %v\n", err)
242 244
 		return
@@ -305,7 +307,7 @@ func TestFilterBloomMatch(t *testing.T) {
305 307
 		return
306 308
 	}
307 309
 
308
-	f := filter.New(10, 0, 0.000001, wire.BloomUpdateAll)
310
+	f := filter.New(10, 0, 0.000001, rw.BloomUpdateAll)
309 311
 	inputStr := "b4749f017444b051c44dfd2720e88f314ff94f3dd6d56d40ef65854fcd7fff6b"
310 312
 	hash, err := chainhash.NewHashFromStr(inputStr)
311 313
 	if err != nil {
@@ -317,7 +319,7 @@ func TestFilterBloomMatch(t *testing.T) {
317 319
 		t.Errorf("TestFilterBloomMatch didn't match hash %s", inputStr)
318 320
 	}
319 321
 
320
-	f = filter.New(10, 0, 0.000001, wire.BloomUpdateAll)
322
+	f = filter.New(10, 0, 0.000001, rw.BloomUpdateAll)
321 323
 	inputStr = "6bff7fcd4f8565ef406dd5d63d4ff94f318fe82027fd4dc451b04474019f74b4"
322 324
 	hashBytes, err := hex.DecodeString(inputStr)
323 325
 	if err != nil {
@@ -329,7 +331,7 @@ func TestFilterBloomMatch(t *testing.T) {
329 331
 		t.Errorf("TestFilterBloomMatch didn't match hash %s", inputStr)
330 332
 	}
331 333
 
332
-	f = filter.New(10, 0, 0.000001, wire.BloomUpdateAll)
334
+	f = filter.New(10, 0, 0.000001, rw.BloomUpdateAll)
333 335
 	inputStr = "30450220070aca44506c5cef3a16ed519d7c3c39f8aab192c4e1c90d065" +
334 336
 		"f37b8a4af6141022100a8e160b856c2d43d27d8fba71e5aef6405b8643" +
335 337
 		"ac4cb7cb3c462aced7f14711a01"
@@ -343,7 +345,7 @@ func TestFilterBloomMatch(t *testing.T) {
343 345
 		t.Errorf("TestFilterBloomMatch didn't match input signature %s", inputStr)
344 346
 	}
345 347
 
346
-	f = filter.New(10, 0, 0.000001, wire.BloomUpdateAll)
348
+	f = filter.New(10, 0, 0.000001, rw.BloomUpdateAll)
347 349
 	inputStr = "046d11fee51b0e60666d5049a9101a72741df480b96ee26488a4d3466b95" +
348 350
 		"c9a40ac5eeef87e10a5cd336c19a84565f80fa6c547957b7700ff4dfbdefe" +
349 351
 		"76036c339"
@@ -357,7 +359,7 @@ func TestFilterBloomMatch(t *testing.T) {
357 359
 		t.Errorf("TestFilterBloomMatch didn't match input pubkey %s", inputStr)
358 360
 	}
359 361
 
360
-	f = filter.New(10, 0, 0.000001, wire.BloomUpdateAll)
362
+	f = filter.New(10, 0, 0.000001, rw.BloomUpdateAll)
361 363
 	inputStr = "04943fdd508053c75000106d3bc6e2754dbcff19"
362 364
 	hashBytes, err = hex.DecodeString(inputStr)
363 365
 	if err != nil {
@@ -372,7 +374,7 @@ func TestFilterBloomMatch(t *testing.T) {
372 374
 		t.Errorf("TestFilterBloomMatch spendingTx didn't match output address %s", inputStr)
373 375
 	}
374 376
 
375
-	f = filter.New(10, 0, 0.000001, wire.BloomUpdateAll)
377
+	f = filter.New(10, 0, 0.000001, rw.BloomUpdateAll)
376 378
 	inputStr = "a266436d2965547608b9e15d9032a7b9d64fa431"
377 379
 	hashBytes, err = hex.DecodeString(inputStr)
378 380
 	if err != nil {
@@ -384,20 +386,20 @@ func TestFilterBloomMatch(t *testing.T) {
384 386
 		t.Errorf("TestFilterBloomMatch didn't match output address %s", inputStr)
385 387
 	}
386 388
 
387
-	f = filter.New(10, 0, 0.000001, wire.BloomUpdateAll)
389
+	f = filter.New(10, 0, 0.000001, rw.BloomUpdateAll)
388 390
 	inputStr = "90c122d70786e899529d71dbeba91ba216982fb6ba58f3bdaab65e73b7e9260b"
389 391
 	hash, err = chainhash.NewHashFromStr(inputStr)
390 392
 	if err != nil {
391 393
 		t.Errorf("TestFilterBloomMatch NewHashFromStr failed: %v\n", err)
392 394
 		return
393 395
 	}
394
-	outpoint := wire.NewOutPoint(hash, 0)
396
+	outpoint := msg.NewOutPoint(hash, 0)
395 397
 	f.AddOutPoint(outpoint)
396 398
 	if !f.MatchTxAndUpdate(ttx) {
397 399
 		t.Errorf("TestFilterBloomMatch didn't match outpoint %s", inputStr)
398 400
 	}
399 401
 
400
-	f = filter.New(10, 0, 0.000001, wire.BloomUpdateAll)
402
+	f = filter.New(10, 0, 0.000001, rw.BloomUpdateAll)
401 403
 	inputStr = "00000009e784f32f62ef849763d4f45b98e07ba658647343b915ff832b110436"
402 404
 	hash, err = chainhash.NewHashFromStr(inputStr)
403 405
 	if err != nil {
@@ -409,7 +411,7 @@ func TestFilterBloomMatch(t *testing.T) {
409 411
 		t.Errorf("TestFilterBloomMatch matched hash %s", inputStr)
410 412
 	}
411 413
 
412
-	f = filter.New(10, 0, 0.000001, wire.BloomUpdateAll)
414
+	f = filter.New(10, 0, 0.000001, rw.BloomUpdateAll)
413 415
 	inputStr = "0000006d2965547608b9e15d9032a7b9d64fa431"
414 416
 	hashBytes, err = hex.DecodeString(inputStr)
415 417
 	if err != nil {
@@ -421,27 +423,27 @@ func TestFilterBloomMatch(t *testing.T) {
421 423
 		t.Errorf("TestFilterBloomMatch matched address %s", inputStr)
422 424
 	}
423 425
 
424
-	f = filter.New(10, 0, 0.000001, wire.BloomUpdateAll)
426
+	f = filter.New(10, 0, 0.000001, rw.BloomUpdateAll)
425 427
 	inputStr = "90c122d70786e899529d71dbeba91ba216982fb6ba58f3bdaab65e73b7e9260b"
426 428
 	hash, err = chainhash.NewHashFromStr(inputStr)
427 429
 	if err != nil {
428 430
 		t.Errorf("TestFilterBloomMatch NewHashFromStr failed: %v\n", err)
429 431
 		return
430 432
 	}
431
-	outpoint = wire.NewOutPoint(hash, 1)
433
+	outpoint = msg.NewOutPoint(hash, 1)
432 434
 	f.AddOutPoint(outpoint)
433 435
 	if f.MatchTxAndUpdate(ttx) {
434 436
 		t.Errorf("TestFilterBloomMatch matched outpoint %s", inputStr)
435 437
 	}
436 438
 
437
-	f = filter.New(10, 0, 0.000001, wire.BloomUpdateAll)
439
+	f = filter.New(10, 0, 0.000001, rw.BloomUpdateAll)
438 440
 	inputStr = "000000d70786e899529d71dbeba91ba216982fb6ba58f3bdaab65e73b7e9260b"
439 441
 	hash, err = chainhash.NewHashFromStr(inputStr)
440 442
 	if err != nil {
441 443
 		t.Errorf("TestFilterBloomMatch NewHashFromStr failed: %v\n", err)
442 444
 		return
443 445
 	}
444
-	outpoint = wire.NewOutPoint(hash, 0)
446
+	outpoint = msg.NewOutPoint(hash, 0)
445 447
 	f.AddOutPoint(outpoint)
446 448
 	if f.MatchTxAndUpdate(ttx) {
447 449
 		t.Errorf("TestFilterBloomMatch matched outpoint %s", inputStr)
@@ -449,7 +451,7 @@ func TestFilterBloomMatch(t *testing.T) {
449 451
 }
450 452
 
451 453
 func TestFilterInsertUpdateNone(t *testing.T) {
452
-	f := filter.New(10, 0, 0.000001, wire.BloomUpdateNone)
454
+	f := filter.New(10, 0, 0.000001, rw.BloomUpdateNone)
453 455
 
454 456
 	// Add the generation pubkey
455 457
 	inputStr := "04eaafc2314def4ca98ac970241bcab022b9c1e1f4ea423a20f134c" +
@@ -477,7 +479,7 @@ func TestFilterInsertUpdateNone(t *testing.T) {
477 479
 		t.Errorf("TestFilterInsertUpdateNone NewHashFromStr failed: %v", err)
478 480
 		return
479 481
 	}
480
-	outpoint := wire.NewOutPoint(hash, 0)
482
+	outpoint := msg.NewOutPoint(hash, 0)
481 483
 
482 484
 	if f.MatchesOutPoint(outpoint) {
483 485
 		t.Errorf("TestFilterInsertUpdateNone matched outpoint %s", inputStr)
@@ -490,7 +492,7 @@ func TestFilterInsertUpdateNone(t *testing.T) {
490 492
 		t.Errorf("TestFilterInsertUpdateNone NewHashFromStr failed: %v", err)
491 493
 		return
492 494
 	}
493
-	outpoint = wire.NewOutPoint(hash, 0)
495
+	outpoint = msg.NewOutPoint(hash, 0)
494 496
 
495 497
 	if f.MatchesOutPoint(outpoint) {
496 498
 		t.Errorf("TestFilterInsertUpdateNone matched outpoint %s", inputStr)
@@ -597,7 +599,7 @@ func TestFilterInsertP2PubKeyOnly(t *testing.T) {
597 599
 		return
598 600
 	}
599 601
 
600
-	f := filter.New(10, 0, 0.000001, wire.BloomUpdateP2PubkeyOnly)
602
+	f := filter.New(10, 0, 0.000001, rw.BloomUpdateP2PubkeyOnly)
601 603
 
602 604
 	// Generation pubkey
603 605
 	inputStr := "04eaafc2314def4ca98ac970241bcab022b9c1e1f4ea423a20f134c" +
@@ -629,7 +631,7 @@ func TestFilterInsertP2PubKeyOnly(t *testing.T) {
629 631
 		t.Errorf("TestMerkleBlockP2PubKeyOnly NewHashFromStr failed: %v", err)
630 632
 		return
631 633
 	}
632
-	outpoint := wire.NewOutPoint(hash, 0)
634
+	outpoint := msg.NewOutPoint(hash, 0)
633 635
 	if !f.MatchesOutPoint(outpoint) {
634 636
 		t.Errorf("TestMerkleBlockP2PubKeyOnly didn't match the generation "+
635 637
 			"outpoint %s", inputStr)
@@ -643,7 +645,7 @@ func TestFilterInsertP2PubKeyOnly(t *testing.T) {
643 645
 		t.Errorf("TestMerkleBlockP2PubKeyOnly NewHashFromStr failed: %v", err)
644 646
 		return
645 647
 	}
646
-	outpoint = wire.NewOutPoint(hash, 0)
648
+	outpoint = msg.NewOutPoint(hash, 0)
647 649
 	if f.MatchesOutPoint(outpoint) {
648 650
 		t.Errorf("TestMerkleBlockP2PubKeyOnly matched outpoint %s", inputStr)
649 651
 		return
@@ -651,7 +653,7 @@ func TestFilterInsertP2PubKeyOnly(t *testing.T) {
651 653
 }
652 654
 
653 655
 func TestFilterReload(t *testing.T) {
654
-	f := filter.New(10, 0, 0.000001, wire.BloomUpdateAll)
656
+	f := filter.New(10, 0, 0.000001, rw.BloomUpdateAll)
655 657
 
656 658
 	bFilter := filter.Load(f.MsgFilterLoad())
657 659
 	if bFilter.MsgFilterLoad() == nil {

+ 8
- 7
btcutil/gcs/builder/builder_test.go View File

@@ -6,16 +6,17 @@
6 6
 package builder_test
7 7
 
8 8
 import (
9
-	"git.parallelcoin.io/dev/btcd/btcutil/ad"
10 9
 	"encoding/hex"
11 10
 	"testing"
12 11
 
12
+	"git.parallelcoin.io/dev/btcd/btcutil/ad"
13
+	"git.parallelcoin.io/dev/btcd/wire/msg"
14
+
15
+	"git.parallelcoin.io/dev/btcd/btcutil/gcs"
16
+	"git.parallelcoin.io/dev/btcd/btcutil/gcs/builder"
13 17
 	"git.parallelcoin.io/dev/btcd/chaincfg"
14 18
 	"git.parallelcoin.io/dev/btcd/chaincfg/chainhash"
15 19
 	"git.parallelcoin.io/dev/btcd/txscript"
16
-	"git.parallelcoin.io/dev/btcd/wire"
17
-	"git.parallelcoin.io/dev/btcd/btcutil/gcs"
18
-	"git.parallelcoin.io/dev/btcd/btcutil/gcs/builder"
19 20
 )
20 21
 
21 22
 var (
@@ -73,8 +74,8 @@ func TestUseBlockHash(t *testing.T) {
73 74
 		t.Fatalf("Hash from string failed: %s", err.Error())
74 75
 	}
75 76
 
76
-	// msg.Outpoint
77
-	outPoint := msg.Outpoint{
77
+	// msg.OutPoint
78
+	outPoint := msg.OutPoint{
78 79
 		Hash:  *hash,
79 80
 		Index: 4321,
80 81
 	}
@@ -191,7 +192,7 @@ func TestUseBlockHash(t *testing.T) {
191 192
 }
192 193
 
193 194
 func BuilderTest(b *builder.GCSBuilder, hash *chainhash.Hash, p uint8,
194
-	outPoint msg.Outpoint, addrBytes []byte, witness wire.TxWitness,
195
+	outPoint msg.OutPoint, addrBytes []byte, witness msg.TxWitness,
195 196
 	t *testing.T) {
196 197
 
197 198
 	key, err := b.Key()

+ 6
- 6
btcutil/txsort/txsort.go View File

@@ -12,7 +12,7 @@ import (
12 12
 	"sort"
13 13
 
14 14
 	"git.parallelcoin.io/dev/btcd/chaincfg/chainhash"
15
-	"git.parallelcoin.io/dev/btcd/wire"
15
+	"git.parallelcoin.io/dev/btcd/wire/msg"
16 16
 )
17 17
 
18 18
 // InPlaceSort modifies the passed transaction inputs and outputs to be sorted
@@ -27,7 +27,7 @@ import (
27 27
 // The function should only be used if the caller is creating the transaction or
28 28
 // is otherwise 100% positive mutating will not cause adverse affects due to
29 29
 // other dependencies.
30
-func InPlaceSort(tx *wire.MsgTx) {
30
+func InPlaceSort(tx *msg.MsgTx) {
31 31
 	sort.Sort(sortableInputSlice(tx.TxIn))
32 32
 	sort.Sort(sortableOutputSlice(tx.TxOut))
33 33
 }
@@ -35,7 +35,7 @@ func InPlaceSort(tx *wire.MsgTx) {
35 35
 // Sort returns a new transaction with the inputs and outputs sorted based on
36 36
 // BIP 69.  The passed transaction is not modified and the new transaction
37 37
 // might have a different hash if any sorting was done.
38
-func Sort(tx *wire.MsgTx) *wire.MsgTx {
38
+func Sort(tx *msg.MsgTx) *msg.MsgTx {
39 39
 	txCopy := tx.Copy()
40 40
 	sort.Sort(sortableInputSlice(txCopy.TxIn))
41 41