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