block_test.go raw
1 package block_test
2
3 import (
4 "bytes"
5 "github.com/p9c/p9/pkg/block"
6 "github.com/p9c/p9/pkg/util"
7 "io"
8 "reflect"
9 "testing"
10 "time"
11
12 "github.com/davecgh/go-spew/spew"
13
14 "github.com/p9c/p9/pkg/chainhash"
15 "github.com/p9c/p9/pkg/wire"
16 )
17
18 // TestBlock tests the API for Block.
19 func TestBlock(t *testing.T) {
20 b := block.NewBlock(&Block100000)
21 // Ensure we get the same data back out.
22 if msgBlock := b.WireBlock(); !reflect.DeepEqual(msgBlock, &Block100000) {
23 t.Errorf("Block: mismatched Block - got %v, want %v",
24 spew.Sdump(msgBlock), spew.Sdump(&Block100000),
25 )
26 }
27 // Ensure block height set and get work properly.
28 wantHeight := int32(100000)
29 b.SetHeight(wantHeight)
30 if gotHeight := b.Height(); gotHeight != wantHeight {
31 t.Errorf("Height: mismatched height - got %v, want %v",
32 gotHeight, wantHeight,
33 )
34 }
35 // Hash for block 100,000.
36 wantHashStr := "3ba27aa200b1cecaad478d2b00432346c3f1f3986da1afd33e506"
37 wantHash, e := chainhash.NewHashFromStr(wantHashStr)
38 if e != nil {
39 t.Errorf("NewHashFromStr: %v", e)
40 }
41 // Request the hash multiple times to test generation and caching.
42 for i := 0; i < 2; i++ {
43 hash := b.Hash()
44 if !hash.IsEqual(wantHash) {
45 t.Errorf("Hash #%d mismatched hash - got %v, want %v",
46 i, hash, wantHash,
47 )
48 }
49 }
50 // Merkles for the transactions in Block100000.
51 wantTxHashes := []string{
52 "8c14f0db3df150123e6f3dbbf30f8b955a8249b62ac1d1ff16284aefa3d06d87",
53 "fff2525b8931402dd09222c50775608f75787bd2b87e56995a7bdd30f79702c4",
54 "6359f0868171b1d194cbee1af2f16ea598ae8fad666d9b012c8ed2b79a236ec4",
55 "e9a66845e05d5abc0ad04ec80f774a7e585c6e8db975962d069a522137b80c1d",
56 }
57 // Create a new block to nuke all cached data.
58 b = block.NewBlock(&Block100000)
59 // Request hash for all transactions one at a time via Tx.
60 for i, txHash := range wantTxHashes {
61 wantHash, e = chainhash.NewHashFromStr(txHash)
62 if e != nil {
63 t.Errorf("NewHashFromStr: %v", e)
64 }
65 // Request the hash multiple times to test generation and
66 // caching.
67 for j := 0; j < 2; j++ {
68 var tx *util.Tx
69 tx, e = b.Tx(i)
70 if e != nil {
71 t.Errorf("Tx #%d: %v", i, e)
72 continue
73 }
74 hash := tx.Hash()
75 if !hash.IsEqual(wantHash) {
76 t.Errorf("Hash #%d mismatched hash - got %v, "+
77 "want %v", j, hash, wantHash,
78 )
79 continue
80 }
81 }
82 }
83 // Create a new block to nuke all cached data.
84 b = block.NewBlock(&Block100000)
85 // Request slice of all transactions multiple times to test generation and caching.
86 for i := 0; i < 2; i++ {
87 transactions := b.Transactions()
88 // Ensure we get the expected number of transactions.
89 if len(transactions) != len(wantTxHashes) {
90 t.Errorf("Transactions #%d mismatched number of "+
91 "transactions - got %d, want %d", i,
92 len(transactions), len(wantTxHashes),
93 )
94 continue
95 }
96 // Ensure all of the hashes match.
97 for j, tx := range transactions {
98 wantHash, e = chainhash.NewHashFromStr(wantTxHashes[j])
99 if e != nil {
100 t.Errorf("NewHashFromStr: %v", e)
101 }
102 hash := tx.Hash()
103 if !hash.IsEqual(wantHash) {
104 t.Errorf("Transactions #%d mismatched hashes "+
105 "- got %v, want %v", j, hash, wantHash,
106 )
107 continue
108 }
109 }
110 }
111 // Serialize the test block.
112 var block100000Buf bytes.Buffer
113 e = Block100000.Serialize(&block100000Buf)
114 if e != nil {
115 t.Errorf("Serialize: %v", e)
116 }
117 block100000Bytes := block100000Buf.Bytes()
118 // Request serialized bytes multiple times to test generation and caching.
119 for i := 0; i < 2; i++ {
120 var serializedBytes []byte
121 serializedBytes, e = b.Bytes()
122 if e != nil {
123 t.Errorf("Hash: %v", e)
124 continue
125 }
126 if !bytes.Equal(serializedBytes, block100000Bytes) {
127 t.Errorf("Hash #%d wrong bytes - got %v, want %v", i,
128 spew.Sdump(serializedBytes),
129 spew.Sdump(block100000Bytes),
130 )
131 continue
132 }
133 }
134 // Transaction offsets and length for the transaction in Block100000.
135 wantTxLocs := []wire.TxLoc{
136 {TxStart: 81, TxLen: 135},
137 {TxStart: 216, TxLen: 259},
138 {TxStart: 475, TxLen: 257},
139 {TxStart: 732, TxLen: 225},
140 }
141 // Ensure the transaction location information is accurate.
142 txLocs, e := b.TxLoc()
143 if e != nil {
144 t.Errorf("TxLoc: %v", e)
145 return
146 }
147 if !reflect.DeepEqual(txLocs, wantTxLocs) {
148 t.Errorf("TxLoc: mismatched transaction location information "+
149 "- got %v, want %v", spew.Sdump(txLocs),
150 spew.Sdump(wantTxLocs),
151 )
152 }
153 }
154
155 // TestNewBlockFromBytes tests creation of a Block from serialized bytes.
156 func TestNewBlockFromBytes(t *testing.T) {
157 // Serialize the test block.
158 var block100000Buf bytes.Buffer
159 e := Block100000.Serialize(&block100000Buf)
160 if e != nil {
161 t.Errorf("Serialize: %v", e)
162 }
163 block100000Bytes := block100000Buf.Bytes()
164 // Create a new block from the serialized bytes.
165 b, e := block.NewFromBytes(block100000Bytes)
166 if e != nil {
167 t.Errorf("NewFromBytes: %v", e)
168 return
169 }
170 // Ensure we get the same data back out.
171 serializedBytes, e := b.Bytes()
172 if e != nil {
173 t.Errorf("Hash: %v", e)
174 return
175 }
176 if !bytes.Equal(serializedBytes, block100000Bytes) {
177 t.Errorf("Hash: wrong bytes - got %v, want %v",
178 spew.Sdump(serializedBytes),
179 spew.Sdump(block100000Bytes),
180 )
181 }
182 // Ensure the generated Block is correct.
183 if msgBlock := b.WireBlock(); !reflect.DeepEqual(msgBlock, &Block100000) {
184 t.Errorf("Block: mismatched Block - got %v, want %v",
185 spew.Sdump(msgBlock), spew.Sdump(&Block100000),
186 )
187 }
188 }
189
190 // TestNewBlockFromBlockAndBytes tests creation of a Block from a Block and raw bytes.
191 func TestNewBlockFromBlockAndBytes(t *testing.T) {
192 // Serialize the test block.
193 var block100000Buf bytes.Buffer
194 e := Block100000.Serialize(&block100000Buf)
195 if e != nil {
196 t.Errorf("Serialize: %v", e)
197 }
198 block100000Bytes := block100000Buf.Bytes()
199 // Create a new block from the serialized bytes.
200 b := block.NewFromBlockAndBytes(&Block100000, block100000Bytes)
201 // Ensure we get the same data back out.
202 serializedBytes, e := b.Bytes()
203 if e != nil {
204 t.Errorf("Hash: %v", e)
205 return
206 }
207 if !bytes.Equal(serializedBytes, block100000Bytes) {
208 t.Errorf("Hash: wrong bytes - got %v, want %v",
209 spew.Sdump(serializedBytes),
210 spew.Sdump(block100000Bytes),
211 )
212 }
213 if msgBlock := b.WireBlock(); !reflect.DeepEqual(msgBlock, &Block100000) {
214 t.Errorf("Block: mismatched Block - got %v, want %v",
215 spew.Sdump(msgBlock), spew.Sdump(&Block100000),
216 )
217 }
218 }
219
220 // TestBlockErrors tests the error paths for the Block API.
221 func TestBlockErrors(t *testing.T) {
222 // Ensure out of range errors are as expected.
223 wantErr := "transaction index -1 is out of range - max 3"
224 testErr := block.OutOfRangeError(wantErr)
225 if testErr.Error() != wantErr {
226 t.Errorf("OutOfRangeError: wrong error - got %v, want %v",
227 testErr.Error(), wantErr,
228 )
229 }
230 // Serialize the test block.
231 var block100000Buf bytes.Buffer
232 e := Block100000.Serialize(&block100000Buf)
233 if e != nil {
234 t.Errorf("Serialize: %v", e)
235 }
236 block100000Bytes := block100000Buf.Bytes()
237 // Create a new block from the serialized bytes.
238 b, e := block.NewFromBytes(block100000Bytes)
239 if e != nil {
240 t.Errorf("NewFromBytes: %v", e)
241 return
242 }
243 // Truncate the block byte buffer to force errors.
244 shortBytes := block100000Bytes[:80]
245 _, e = block.NewFromBytes(shortBytes)
246 if e != io.EOF {
247 t.Errorf("NewFromBytes: did not get expected error - "+
248 "got %v, want %v", e, io.EOF,
249 )
250 }
251 // Ensure TxHash returns expected error on invalid indices.
252 _, e = b.TxHash(-1)
253 if _, ok := e.(block.OutOfRangeError); !ok {
254 t.Errorf("TxHash: wrong error - got: %v <%T>, "+
255 "want: <%T>", e, e, block.OutOfRangeError(""),
256 )
257 }
258 _, e = b.TxHash(len(Block100000.Transactions) + 1)
259 if _, ok := e.(block.OutOfRangeError); !ok {
260 t.Errorf("TxHash: wrong error - got: %v <%T>, "+
261 "want: <%T>", e, e, block.OutOfRangeError(""),
262 )
263 }
264 // Ensure Tx returns expected error on invalid indices.
265 _, e = b.Tx(-1)
266 if _, ok := e.(block.OutOfRangeError); !ok {
267 t.Errorf("Tx: wrong error - got: %v <%T>, "+
268 "want: <%T>", e, e, block.OutOfRangeError(""),
269 )
270 }
271 _, e = b.Tx(len(Block100000.Transactions) + 1)
272 if _, ok := e.(block.OutOfRangeError); !ok {
273 t.Errorf("Tx: wrong error - got: %v <%T>, "+
274 "want: <%T>", e, e, block.OutOfRangeError(""),
275 )
276 }
277 // Ensure TxLoc returns expected error with short byte buffer. This makes use of the test package only function,
278 // SetBlockBytes, to inject a short byte buffer.
279 b.SetBlockBytes(shortBytes)
280 _, e = b.TxLoc()
281 if e != io.EOF {
282 t.Errorf("TxLoc: did not get expected error - "+
283 "got %v, want %v", e, io.EOF,
284 )
285 }
286 }
287
288 // Block100000 defines block 100,000 of the block chain. It is used to test Block operations.
289 var Block100000 = wire.Block{
290 Header: wire.BlockHeader{
291 Version: 1,
292 PrevBlock: chainhash.Hash([32]byte{ // Make go vet happy.
293 0x50, 0x12, 0x01, 0x19, 0x17, 0x2a, 0x61, 0x04,
294 0x21, 0xa6, 0xc3, 0x01, 0x1d, 0xd3, 0x30, 0xd9,
295 0xdf, 0x07, 0xb6, 0x36, 0x16, 0xc2, 0xcc, 0x1f,
296 0x1c, 0xd0, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
297 },
298 ),
299 // 000000000002d01c1fccc21636b607dfd930d31d01c3a62104612a1719011250
300 MerkleRoot: chainhash.Hash([32]byte{ // Make go vet happy.
301 0x66, 0x57, 0xa9, 0x25, 0x2a, 0xac, 0xd5, 0xc0,
302 0xb2, 0x94, 0x09, 0x96, 0xec, 0xff, 0x95, 0x22,
303 0x28, 0xc3, 0x06, 0x7c, 0xc3, 0x8d, 0x48, 0x85,
304 0xef, 0xb5, 0xa4, 0xac, 0x42, 0x47, 0xe9, 0xf3,
305 },
306 ),
307 // f3e94742aca4b5ef85488dc37c06c3282295ffec960994b2c0d5ac2a25a95766
308 Timestamp: time.Unix(1293623863, 0), // 2010-12-29 11:57:43 +0000 UTC
309 Bits: 0x1b04864c, // 453281356
310 Nonce: 0x10572b0f, // 274148111
311 },
312 Transactions: []*wire.MsgTx{
313 {
314 Version: 1,
315 TxIn: []*wire.TxIn{
316 {
317 PreviousOutPoint: wire.OutPoint{
318 Hash: chainhash.Hash{},
319 Index: 0xffffffff,
320 },
321 SignatureScript: []byte{
322 0x04, 0x4c, 0x86, 0x04, 0x1b, 0x02, 0x06, 0x02,
323 },
324 Sequence: 0xffffffff,
325 },
326 },
327 TxOut: []*wire.TxOut{
328 {
329 Value: 0x12a05f200, // 5000000000
330 PkScript: []byte{
331 0x41, // OP_DATA_65
332 0x04, 0x1b, 0x0e, 0x8c, 0x25, 0x67, 0xc1, 0x25,
333 0x36, 0xaa, 0x13, 0x35, 0x7b, 0x79, 0xa0, 0x73,
334 0xdc, 0x44, 0x44, 0xac, 0xb8, 0x3c, 0x4e, 0xc7,
335 0xa0, 0xe2, 0xf9, 0x9d, 0xd7, 0x45, 0x75, 0x16,
336 0xc5, 0x81, 0x72, 0x42, 0xda, 0x79, 0x69, 0x24,
337 0xca, 0x4e, 0x99, 0x94, 0x7d, 0x08, 0x7f, 0xed,
338 0xf9, 0xce, 0x46, 0x7c, 0xb9, 0xf7, 0xc6, 0x28,
339 0x70, 0x78, 0xf8, 0x01, 0xdf, 0x27, 0x6f, 0xdf,
340 0x84, // 65-byte signature
341 0xac, // OP_CHECKSIG
342 },
343 },
344 },
345 LockTime: 0,
346 },
347 {
348 Version: 1,
349 TxIn: []*wire.TxIn{
350 {
351 PreviousOutPoint: wire.OutPoint{
352 Hash: chainhash.Hash([32]byte{ // Make go vet happy.
353 0x03, 0x2e, 0x38, 0xe9, 0xc0, 0xa8, 0x4c, 0x60,
354 0x46, 0xd6, 0x87, 0xd1, 0x05, 0x56, 0xdc, 0xac,
355 0xc4, 0x1d, 0x27, 0x5e, 0xc5, 0x5f, 0xc0, 0x07,
356 0x79, 0xac, 0x88, 0xfd, 0xf3, 0x57, 0xa1, 0x87,
357 },
358 ),
359 // 87a157f3fd88ac7907c05fc55e271dc4acdc5605d187d646604ca8c0e9382e03
360 Index: 0,
361 },
362 SignatureScript: []byte{
363 0x49, // OP_DATA_73
364 0x30, 0x46, 0x02, 0x21, 0x00, 0xc3, 0x52, 0xd3,
365 0xdd, 0x99, 0x3a, 0x98, 0x1b, 0xeb, 0xa4, 0xa6,
366 0x3a, 0xd1, 0x5c, 0x20, 0x92, 0x75, 0xca, 0x94,
367 0x70, 0xab, 0xfc, 0xd5, 0x7d, 0xa9, 0x3b, 0x58,
368 0xe4, 0xeb, 0x5d, 0xce, 0x82, 0x02, 0x21, 0x00,
369 0x84, 0x07, 0x92, 0xbc, 0x1f, 0x45, 0x60, 0x62,
370 0x81, 0x9f, 0x15, 0xd3, 0x3e, 0xe7, 0x05, 0x5c,
371 0xf7, 0xb5, 0xee, 0x1a, 0xf1, 0xeb, 0xcc, 0x60,
372 0x28, 0xd9, 0xcd, 0xb1, 0xc3, 0xaf, 0x77, 0x48,
373 0x01, // 73-byte signature
374 0x41, // OP_DATA_65
375 0x04, 0xf4, 0x6d, 0xb5, 0xe9, 0xd6, 0x1a, 0x9d,
376 0xc2, 0x7b, 0x8d, 0x64, 0xad, 0x23, 0xe7, 0x38,
377 0x3a, 0x4e, 0x6c, 0xa1, 0x64, 0x59, 0x3c, 0x25,
378 0x27, 0xc0, 0x38, 0xc0, 0x85, 0x7e, 0xb6, 0x7e,
379 0xe8, 0xe8, 0x25, 0xdc, 0xa6, 0x50, 0x46, 0xb8,
380 0x2c, 0x93, 0x31, 0x58, 0x6c, 0x82, 0xe0, 0xfd,
381 0x1f, 0x63, 0x3f, 0x25, 0xf8, 0x7c, 0x16, 0x1b,
382 0xc6, 0xf8, 0xa6, 0x30, 0x12, 0x1d, 0xf2, 0xb3,
383 0xd3, // 65-byte pubkey
384 },
385 Sequence: 0xffffffff,
386 },
387 },
388 TxOut: []*wire.TxOut{
389 {
390 Value: 0x2123e300, // 556000000
391 PkScript: []byte{
392 0x76, // OP_DUP
393 0xa9, // OP_HASH160
394 0x14, // OP_DATA_20
395 0xc3, 0x98, 0xef, 0xa9, 0xc3, 0x92, 0xba, 0x60,
396 0x13, 0xc5, 0xe0, 0x4e, 0xe7, 0x29, 0x75, 0x5e,
397 0xf7, 0xf5, 0x8b, 0x32,
398 0x88, // OP_EQUALVERIFY
399 0xac, // OP_CHECKSIG
400 },
401 },
402 {
403 Value: 0x108e20f00, // 4444000000
404 PkScript: []byte{
405 0x76, // OP_DUP
406 0xa9, // OP_HASH160
407 0x14, // OP_DATA_20
408 0x94, 0x8c, 0x76, 0x5a, 0x69, 0x14, 0xd4, 0x3f,
409 0x2a, 0x7a, 0xc1, 0x77, 0xda, 0x2c, 0x2f, 0x6b,
410 0x52, 0xde, 0x3d, 0x7c,
411 0x88, // OP_EQUALVERIFY
412 0xac, // OP_CHECKSIG
413 },
414 },
415 },
416 LockTime: 0,
417 },
418 {
419 Version: 1,
420 TxIn: []*wire.TxIn{
421 {
422 PreviousOutPoint: wire.OutPoint{
423 Hash: chainhash.Hash([32]byte{ // Make go vet happy.
424 0xc3, 0x3e, 0xbf, 0xf2, 0xa7, 0x09, 0xf1, 0x3d,
425 0x9f, 0x9a, 0x75, 0x69, 0xab, 0x16, 0xa3, 0x27,
426 0x86, 0xaf, 0x7d, 0x7e, 0x2d, 0xe0, 0x92, 0x65,
427 0xe4, 0x1c, 0x61, 0xd0, 0x78, 0x29, 0x4e, 0xcf,
428 },
429 ),
430 // cf4e2978d0611ce46592e02d7e7daf8627a316ab69759a9f3df109a7f2bf3ec3
431 Index: 1,
432 },
433 SignatureScript: []byte{
434 0x47, // OP_DATA_71
435 0x30, 0x44, 0x02, 0x20, 0x03, 0x2d, 0x30, 0xdf,
436 0x5e, 0xe6, 0xf5, 0x7f, 0xa4, 0x6c, 0xdd, 0xb5,
437 0xeb, 0x8d, 0x0d, 0x9f, 0xe8, 0xde, 0x6b, 0x34,
438 0x2d, 0x27, 0x94, 0x2a, 0xe9, 0x0a, 0x32, 0x31,
439 0xe0, 0xba, 0x33, 0x3e, 0x02, 0x20, 0x3d, 0xee,
440 0xe8, 0x06, 0x0f, 0xdc, 0x70, 0x23, 0x0a, 0x7f,
441 0x5b, 0x4a, 0xd7, 0xd7, 0xbc, 0x3e, 0x62, 0x8c,
442 0xbe, 0x21, 0x9a, 0x88, 0x6b, 0x84, 0x26, 0x9e,
443 0xae, 0xb8, 0x1e, 0x26, 0xb4, 0xfe, 0x01,
444 0x41, // OP_DATA_65
445 0x04, 0xae, 0x31, 0xc3, 0x1b, 0xf9, 0x12, 0x78,
446 0xd9, 0x9b, 0x83, 0x77, 0xa3, 0x5b, 0xbc, 0xe5,
447 0xb2, 0x7d, 0x9f, 0xff, 0x15, 0x45, 0x68, 0x39,
448 0xe9, 0x19, 0x45, 0x3f, 0xc7, 0xb3, 0xf7, 0x21,
449 0xf0, 0xba, 0x40, 0x3f, 0xf9, 0x6c, 0x9d, 0xee,
450 0xb6, 0x80, 0xe5, 0xfd, 0x34, 0x1c, 0x0f, 0xc3,
451 0xa7, 0xb9, 0x0d, 0xa4, 0x63, 0x1e, 0xe3, 0x95,
452 0x60, 0x63, 0x9d, 0xb4, 0x62, 0xe9, 0xcb, 0x85,
453 0x0f, // 65-byte pubkey
454 },
455 Sequence: 0xffffffff,
456 },
457 },
458 TxOut: []*wire.TxOut{
459 {
460 Value: 0xf4240, // 1000000
461 PkScript: []byte{
462 0x76, // OP_DUP
463 0xa9, // OP_HASH160
464 0x14, // OP_DATA_20
465 0xb0, 0xdc, 0xbf, 0x97, 0xea, 0xbf, 0x44, 0x04,
466 0xe3, 0x1d, 0x95, 0x24, 0x77, 0xce, 0x82, 0x2d,
467 0xad, 0xbe, 0x7e, 0x10,
468 0x88, // OP_EQUALVERIFY
469 0xac, // OP_CHECKSIG
470 },
471 },
472 {
473 Value: 0x11d260c0, // 299000000
474 PkScript: []byte{
475 0x76, // OP_DUP
476 0xa9, // OP_HASH160
477 0x14, // OP_DATA_20
478 0x6b, 0x12, 0x81, 0xee, 0xc2, 0x5a, 0xb4, 0xe1,
479 0xe0, 0x79, 0x3f, 0xf4, 0xe0, 0x8a, 0xb1, 0xab,
480 0xb3, 0x40, 0x9c, 0xd9,
481 0x88, // OP_EQUALVERIFY
482 0xac, // OP_CHECKSIG
483 },
484 },
485 },
486 LockTime: 0,
487 },
488 {
489 Version: 1,
490 TxIn: []*wire.TxIn{
491 {
492 PreviousOutPoint: wire.OutPoint{
493 Hash: chainhash.Hash([32]byte{ // Make go vet happy.
494 0x0b, 0x60, 0x72, 0xb3, 0x86, 0xd4, 0xa7, 0x73,
495 0x23, 0x52, 0x37, 0xf6, 0x4c, 0x11, 0x26, 0xac,
496 0x3b, 0x24, 0x0c, 0x84, 0xb9, 0x17, 0xa3, 0x90,
497 0x9b, 0xa1, 0xc4, 0x3d, 0xed, 0x5f, 0x51, 0xf4,
498 },
499 ),
500 // f4515fed3dc4a19b90a317b9840c243bac26114cf637522373a7d486b372600b
501 Index: 0,
502 },
503 SignatureScript: []byte{
504 0x49, // OP_DATA_73
505 0x30, 0x46, 0x02, 0x21, 0x00, 0xbb, 0x1a, 0xd2,
506 0x6d, 0xf9, 0x30, 0xa5, 0x1c, 0xce, 0x11, 0x0c,
507 0xf4, 0x4f, 0x7a, 0x48, 0xc3, 0xc5, 0x61, 0xfd,
508 0x97, 0x75, 0x00, 0xb1, 0xae, 0x5d, 0x6b, 0x6f,
509 0xd1, 0x3d, 0x0b, 0x3f, 0x4a, 0x02, 0x21, 0x00,
510 0xc5, 0xb4, 0x29, 0x51, 0xac, 0xed, 0xff, 0x14,
511 0xab, 0xba, 0x27, 0x36, 0xfd, 0x57, 0x4b, 0xdb,
512 0x46, 0x5f, 0x3e, 0x6f, 0x8d, 0xa1, 0x2e, 0x2c,
513 0x53, 0x03, 0x95, 0x4a, 0xca, 0x7f, 0x78, 0xf3,
514 0x01, // 73-byte signature
515 0x41, // OP_DATA_65
516 0x04, 0xa7, 0x13, 0x5b, 0xfe, 0x82, 0x4c, 0x97,
517 0xec, 0xc0, 0x1e, 0xc7, 0xd7, 0xe3, 0x36, 0x18,
518 0x5c, 0x81, 0xe2, 0xaa, 0x2c, 0x41, 0xab, 0x17,
519 0x54, 0x07, 0xc0, 0x94, 0x84, 0xce, 0x96, 0x94,
520 0xb4, 0x49, 0x53, 0xfc, 0xb7, 0x51, 0x20, 0x65,
521 0x64, 0xa9, 0xc2, 0x4d, 0xd0, 0x94, 0xd4, 0x2f,
522 0xdb, 0xfd, 0xd5, 0xaa, 0xd3, 0xe0, 0x63, 0xce,
523 0x6a, 0xf4, 0xcf, 0xaa, 0xea, 0x4e, 0xa1, 0x4f,
524 0xbb, // 65-byte pubkey
525 },
526 Sequence: 0xffffffff,
527 },
528 },
529 TxOut: []*wire.TxOut{
530 {
531 Value: 0xf4240, // 1000000
532 PkScript: []byte{
533 0x76, // OP_DUP
534 0xa9, // OP_HASH160
535 0x14, // OP_DATA_20
536 0x39, 0xaa, 0x3d, 0x56, 0x9e, 0x06, 0xa1, 0xd7,
537 0x92, 0x6d, 0xc4, 0xbe, 0x11, 0x93, 0xc9, 0x9b,
538 0xf2, 0xeb, 0x9e, 0xe0,
539 0x88, // OP_EQUALVERIFY
540 0xac, // OP_CHECKSIG
541 },
542 },
543 },
544 LockTime: 0,
545 },
546 },
547 }
548