github.com/BlockABC/godash@v0.0.0-20191112120524-f4aa3a32c566/wire/msgblock_test.go (about) 1 // Copyright (c) 2013-2015 The btcsuite developers 2 // Copyright (c) 2016 The Dash developers 3 // Use of this source code is governed by an ISC 4 // license that can be found in the LICENSE file. 5 6 package wire_test 7 8 import ( 9 "bytes" 10 "io" 11 "reflect" 12 "testing" 13 "time" 14 15 "github.com/BlockABC/godash/wire" 16 "github.com/davecgh/go-spew/spew" 17 ) 18 19 // TestBlock tests the MsgBlock API. 20 func TestBlock(t *testing.T) { 21 pver := wire.ProtocolVersion 22 23 // Block 1 header. 24 prevHash := &blockOne.Header.PrevBlock 25 merkleHash := &blockOne.Header.MerkleRoot 26 bits := blockOne.Header.Bits 27 nonce := blockOne.Header.Nonce 28 bh := wire.NewBlockHeader(prevHash, merkleHash, bits, nonce) 29 30 // Ensure the command is expected value. 31 wantCmd := "block" 32 msg := wire.NewMsgBlock(bh) 33 if cmd := msg.Command(); cmd != wantCmd { 34 t.Errorf("NewMsgBlock: wrong command - got %v want %v", 35 cmd, wantCmd) 36 } 37 38 // Ensure max payload is expected value for latest protocol version. 39 // Num addresses (varInt) + max allowed addresses. 40 wantPayload := uint32(1000000) 41 maxPayload := msg.MaxPayloadLength(pver) 42 if maxPayload != wantPayload { 43 t.Errorf("MaxPayloadLength: wrong max payload length for "+ 44 "protocol version %d - got %v, want %v", pver, 45 maxPayload, wantPayload) 46 } 47 48 // Ensure we get the same block header data back out. 49 if !reflect.DeepEqual(&msg.Header, bh) { 50 t.Errorf("NewMsgBlock: wrong block header - got %v, want %v", 51 spew.Sdump(&msg.Header), spew.Sdump(bh)) 52 } 53 54 // Ensure transactions are added properly. 55 tx := blockOne.Transactions[0].Copy() 56 msg.AddTransaction(tx) 57 if !reflect.DeepEqual(msg.Transactions, blockOne.Transactions) { 58 t.Errorf("AddTransaction: wrong transactions - got %v, want %v", 59 spew.Sdump(msg.Transactions), 60 spew.Sdump(blockOne.Transactions)) 61 } 62 63 // Ensure transactions are properly cleared. 64 msg.ClearTransactions() 65 if len(msg.Transactions) != 0 { 66 t.Errorf("ClearTransactions: wrong transactions - got %v, want %v", 67 len(msg.Transactions), 0) 68 } 69 70 return 71 } 72 73 // TestBlockTxShas tests the ability to generate a slice of all transaction 74 // hashes from a block accurately. 75 func TestBlockTxShas(t *testing.T) { 76 // Block 1, transaction 1 hash. 77 hashStr := "0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098" 78 wantHash, err := wire.NewShaHashFromStr(hashStr) 79 if err != nil { 80 t.Errorf("NewShaHashFromStr: %v", err) 81 return 82 } 83 84 wantShas := []wire.ShaHash{*wantHash} 85 shas, err := blockOne.TxShas() 86 if err != nil { 87 t.Errorf("TxShas: %v", err) 88 } 89 if !reflect.DeepEqual(shas, wantShas) { 90 t.Errorf("TxShas: wrong transaction hashes - got %v, want %v", 91 spew.Sdump(shas), spew.Sdump(wantShas)) 92 } 93 } 94 95 // TestBlockSha tests the ability to generate the hash of a block accurately. 96 func TestBlockSha(t *testing.T) { 97 // Block 1 hash. 98 hashStr := "839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048" 99 wantHash, err := wire.NewShaHashFromStr(hashStr) 100 if err != nil { 101 t.Errorf("NewShaHashFromStr: %v", err) 102 } 103 104 // Ensure the hash produced is expected. 105 blockHash := blockOne.BlockSha() 106 if !blockHash.IsEqual(wantHash) { 107 t.Errorf("BlockSha: wrong hash - got %v, want %v", 108 spew.Sprint(blockHash), spew.Sprint(wantHash)) 109 } 110 } 111 112 // TestBlockWire tests the MsgBlock wire encode and decode for various numbers 113 // of transaction inputs and outputs and protocol versions. 114 func TestBlockWire(t *testing.T) { 115 tests := []struct { 116 in *wire.MsgBlock // Message to encode 117 out *wire.MsgBlock // Expected decoded message 118 buf []byte // Wire encoding 119 txLocs []wire.TxLoc // Expected transaction locations 120 pver uint32 // Protocol version for wire encoding 121 }{ 122 // Latest protocol version. 123 { 124 &blockOne, 125 &blockOne, 126 blockOneBytes, 127 blockOneTxLocs, 128 wire.ProtocolVersion, 129 }, 130 131 // Protocol version BIP0035Version. 132 { 133 &blockOne, 134 &blockOne, 135 blockOneBytes, 136 blockOneTxLocs, 137 wire.BIP0035Version, 138 }, 139 140 // Protocol version BIP0031Version. 141 { 142 &blockOne, 143 &blockOne, 144 blockOneBytes, 145 blockOneTxLocs, 146 wire.BIP0031Version, 147 }, 148 149 // Protocol version NetAddressTimeVersion. 150 { 151 &blockOne, 152 &blockOne, 153 blockOneBytes, 154 blockOneTxLocs, 155 wire.NetAddressTimeVersion, 156 }, 157 158 // Protocol version MultipleAddressVersion. 159 { 160 &blockOne, 161 &blockOne, 162 blockOneBytes, 163 blockOneTxLocs, 164 wire.MultipleAddressVersion, 165 }, 166 } 167 168 t.Logf("Running %d tests", len(tests)) 169 for i, test := range tests { 170 // Encode the message to wire format. 171 var buf bytes.Buffer 172 err := test.in.BtcEncode(&buf, test.pver) 173 if err != nil { 174 t.Errorf("BtcEncode #%d error %v", i, err) 175 continue 176 } 177 if !bytes.Equal(buf.Bytes(), test.buf) { 178 t.Errorf("BtcEncode #%d\n got: %s want: %s", i, 179 spew.Sdump(buf.Bytes()), spew.Sdump(test.buf)) 180 continue 181 } 182 183 // Decode the message from wire format. 184 var msg wire.MsgBlock 185 rbuf := bytes.NewReader(test.buf) 186 err = msg.BtcDecode(rbuf, test.pver) 187 if err != nil { 188 t.Errorf("BtcDecode #%d error %v", i, err) 189 continue 190 } 191 if !reflect.DeepEqual(&msg, test.out) { 192 t.Errorf("BtcDecode #%d\n got: %s want: %s", i, 193 spew.Sdump(&msg), spew.Sdump(test.out)) 194 continue 195 } 196 } 197 } 198 199 // TestBlockWireErrors performs negative tests against wire encode and decode 200 // of MsgBlock to confirm error paths work correctly. 201 func TestBlockWireErrors(t *testing.T) { 202 // Use protocol version 60002 specifically here instead of the latest 203 // because the test data is using bytes encoded with that protocol 204 // version. 205 pver := uint32(60002) 206 207 tests := []struct { 208 in *wire.MsgBlock // Value to encode 209 buf []byte // Wire encoding 210 pver uint32 // Protocol version for wire encoding 211 max int // Max size of fixed buffer to induce errors 212 writeErr error // Expected write error 213 readErr error // Expected read error 214 }{ 215 // Force error in version. 216 {&blockOne, blockOneBytes, pver, 0, io.ErrShortWrite, io.EOF}, 217 // Force error in prev block hash. 218 {&blockOne, blockOneBytes, pver, 4, io.ErrShortWrite, io.EOF}, 219 // Force error in merkle root. 220 {&blockOne, blockOneBytes, pver, 36, io.ErrShortWrite, io.EOF}, 221 // Force error in timestamp. 222 {&blockOne, blockOneBytes, pver, 68, io.ErrShortWrite, io.EOF}, 223 // Force error in difficulty bits. 224 {&blockOne, blockOneBytes, pver, 72, io.ErrShortWrite, io.EOF}, 225 // Force error in header nonce. 226 {&blockOne, blockOneBytes, pver, 76, io.ErrShortWrite, io.EOF}, 227 // Force error in transaction count. 228 {&blockOne, blockOneBytes, pver, 80, io.ErrShortWrite, io.EOF}, 229 // Force error in transactions. 230 {&blockOne, blockOneBytes, pver, 81, io.ErrShortWrite, io.EOF}, 231 } 232 233 t.Logf("Running %d tests", len(tests)) 234 for i, test := range tests { 235 // Encode to wire format. 236 w := newFixedWriter(test.max) 237 err := test.in.BtcEncode(w, test.pver) 238 if err != test.writeErr { 239 t.Errorf("BtcEncode #%d wrong error got: %v, want: %v", 240 i, err, test.writeErr) 241 continue 242 } 243 244 // Decode from wire format. 245 var msg wire.MsgBlock 246 r := newFixedReader(test.max, test.buf) 247 err = msg.BtcDecode(r, test.pver) 248 if err != test.readErr { 249 t.Errorf("BtcDecode #%d wrong error got: %v, want: %v", 250 i, err, test.readErr) 251 continue 252 } 253 } 254 } 255 256 // TestBlockSerialize tests MsgBlock serialize and deserialize. 257 func TestBlockSerialize(t *testing.T) { 258 tests := []struct { 259 in *wire.MsgBlock // Message to encode 260 out *wire.MsgBlock // Expected decoded message 261 buf []byte // Serialized data 262 txLocs []wire.TxLoc // Expected transaction locations 263 }{ 264 { 265 &blockOne, 266 &blockOne, 267 blockOneBytes, 268 blockOneTxLocs, 269 }, 270 } 271 272 t.Logf("Running %d tests", len(tests)) 273 for i, test := range tests { 274 // Serialize the block. 275 var buf bytes.Buffer 276 err := test.in.Serialize(&buf) 277 if err != nil { 278 t.Errorf("Serialize #%d error %v", i, err) 279 continue 280 } 281 if !bytes.Equal(buf.Bytes(), test.buf) { 282 t.Errorf("Serialize #%d\n got: %s want: %s", i, 283 spew.Sdump(buf.Bytes()), spew.Sdump(test.buf)) 284 continue 285 } 286 287 // Deserialize the block. 288 var block wire.MsgBlock 289 rbuf := bytes.NewReader(test.buf) 290 err = block.Deserialize(rbuf) 291 if err != nil { 292 t.Errorf("Deserialize #%d error %v", i, err) 293 continue 294 } 295 if !reflect.DeepEqual(&block, test.out) { 296 t.Errorf("Deserialize #%d\n got: %s want: %s", i, 297 spew.Sdump(&block), spew.Sdump(test.out)) 298 continue 299 } 300 301 // Deserialize the block while gathering transaction location 302 // information. 303 var txLocBlock wire.MsgBlock 304 br := bytes.NewBuffer(test.buf) 305 txLocs, err := txLocBlock.DeserializeTxLoc(br) 306 if err != nil { 307 t.Errorf("DeserializeTxLoc #%d error %v", i, err) 308 continue 309 } 310 if !reflect.DeepEqual(&txLocBlock, test.out) { 311 t.Errorf("DeserializeTxLoc #%d\n got: %s want: %s", i, 312 spew.Sdump(&txLocBlock), spew.Sdump(test.out)) 313 continue 314 } 315 if !reflect.DeepEqual(txLocs, test.txLocs) { 316 t.Errorf("DeserializeTxLoc #%d\n got: %s want: %s", i, 317 spew.Sdump(txLocs), spew.Sdump(test.txLocs)) 318 continue 319 } 320 } 321 } 322 323 // TestBlockSerializeErrors performs negative tests against wire encode and 324 // decode of MsgBlock to confirm error paths work correctly. 325 func TestBlockSerializeErrors(t *testing.T) { 326 tests := []struct { 327 in *wire.MsgBlock // Value to encode 328 buf []byte // Serialized data 329 max int // Max size of fixed buffer to induce errors 330 writeErr error // Expected write error 331 readErr error // Expected read error 332 }{ 333 // Force error in version. 334 {&blockOne, blockOneBytes, 0, io.ErrShortWrite, io.EOF}, 335 // Force error in prev block hash. 336 {&blockOne, blockOneBytes, 4, io.ErrShortWrite, io.EOF}, 337 // Force error in merkle root. 338 {&blockOne, blockOneBytes, 36, io.ErrShortWrite, io.EOF}, 339 // Force error in timestamp. 340 {&blockOne, blockOneBytes, 68, io.ErrShortWrite, io.EOF}, 341 // Force error in difficulty bits. 342 {&blockOne, blockOneBytes, 72, io.ErrShortWrite, io.EOF}, 343 // Force error in header nonce. 344 {&blockOne, blockOneBytes, 76, io.ErrShortWrite, io.EOF}, 345 // Force error in transaction count. 346 {&blockOne, blockOneBytes, 80, io.ErrShortWrite, io.EOF}, 347 // Force error in transactions. 348 {&blockOne, blockOneBytes, 81, io.ErrShortWrite, io.EOF}, 349 } 350 351 t.Logf("Running %d tests", len(tests)) 352 for i, test := range tests { 353 // Serialize the block. 354 w := newFixedWriter(test.max) 355 err := test.in.Serialize(w) 356 if err != test.writeErr { 357 t.Errorf("Serialize #%d wrong error got: %v, want: %v", 358 i, err, test.writeErr) 359 continue 360 } 361 362 // Deserialize the block. 363 var block wire.MsgBlock 364 r := newFixedReader(test.max, test.buf) 365 err = block.Deserialize(r) 366 if err != test.readErr { 367 t.Errorf("Deserialize #%d wrong error got: %v, want: %v", 368 i, err, test.readErr) 369 continue 370 } 371 372 var txLocBlock wire.MsgBlock 373 br := bytes.NewBuffer(test.buf[0:test.max]) 374 _, err = txLocBlock.DeserializeTxLoc(br) 375 if err != test.readErr { 376 t.Errorf("DeserializeTxLoc #%d wrong error got: %v, want: %v", 377 i, err, test.readErr) 378 continue 379 } 380 } 381 } 382 383 // TestBlockOverflowErrors performs tests to ensure deserializing blocks which 384 // are intentionally crafted to use large values for the number of transactions 385 // are handled properly. This could otherwise potentially be used as an attack 386 // vector. 387 func TestBlockOverflowErrors(t *testing.T) { 388 // Use protocol version 70001 specifically here instead of the latest 389 // protocol version because the test data is using bytes encoded with 390 // that version. 391 pver := uint32(70001) 392 393 tests := []struct { 394 buf []byte // Wire encoding 395 pver uint32 // Protocol version for wire encoding 396 err error // Expected error 397 }{ 398 // Block that claims to have ~uint64(0) transactions. 399 { 400 []byte{ 401 0x01, 0x00, 0x00, 0x00, // Version 1 402 0x6f, 0xe2, 0x8c, 0x0a, 0xb6, 0xf1, 0xb3, 0x72, 403 0xc1, 0xa6, 0xa2, 0x46, 0xae, 0x63, 0xf7, 0x4f, 404 0x93, 0x1e, 0x83, 0x65, 0xe1, 0x5a, 0x08, 0x9c, 405 0x68, 0xd6, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, // PrevBlock 406 0x98, 0x20, 0x51, 0xfd, 0x1e, 0x4b, 0xa7, 0x44, 407 0xbb, 0xbe, 0x68, 0x0e, 0x1f, 0xee, 0x14, 0x67, 408 0x7b, 0xa1, 0xa3, 0xc3, 0x54, 0x0b, 0xf7, 0xb1, 409 0xcd, 0xb6, 0x06, 0xe8, 0x57, 0x23, 0x3e, 0x0e, // MerkleRoot 410 0x61, 0xbc, 0x66, 0x49, // Timestamp 411 0xff, 0xff, 0x00, 0x1d, // Bits 412 0x01, 0xe3, 0x62, 0x99, // Nonce 413 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 414 0xff, // TxnCount 415 }, pver, &wire.MessageError{}, 416 }, 417 } 418 419 t.Logf("Running %d tests", len(tests)) 420 for i, test := range tests { 421 // Decode from wire format. 422 var msg wire.MsgBlock 423 r := bytes.NewReader(test.buf) 424 err := msg.BtcDecode(r, test.pver) 425 if reflect.TypeOf(err) != reflect.TypeOf(test.err) { 426 t.Errorf("BtcDecode #%d wrong error got: %v, want: %v", 427 i, err, reflect.TypeOf(test.err)) 428 continue 429 } 430 431 // Deserialize from wire format. 432 r = bytes.NewReader(test.buf) 433 err = msg.Deserialize(r) 434 if reflect.TypeOf(err) != reflect.TypeOf(test.err) { 435 t.Errorf("Deserialize #%d wrong error got: %v, want: %v", 436 i, err, reflect.TypeOf(test.err)) 437 continue 438 } 439 440 // Deserialize with transaction location info from wire format. 441 br := bytes.NewBuffer(test.buf) 442 _, err = msg.DeserializeTxLoc(br) 443 if reflect.TypeOf(err) != reflect.TypeOf(test.err) { 444 t.Errorf("DeserializeTxLoc #%d wrong error got: %v, "+ 445 "want: %v", i, err, reflect.TypeOf(test.err)) 446 continue 447 } 448 } 449 } 450 451 // TestBlockSerializeSize performs tests to ensure the serialize size for 452 // various blocks is accurate. 453 func TestBlockSerializeSize(t *testing.T) { 454 // Block with no transactions. 455 noTxBlock := wire.NewMsgBlock(&blockOne.Header) 456 457 tests := []struct { 458 in *wire.MsgBlock // Block to encode 459 size int // Expected serialized size 460 }{ 461 // Block with no transactions. 462 {noTxBlock, 81}, 463 464 // First block in the mainnet block chain. 465 {&blockOne, len(blockOneBytes)}, 466 } 467 468 t.Logf("Running %d tests", len(tests)) 469 for i, test := range tests { 470 serializedSize := test.in.SerializeSize() 471 if serializedSize != test.size { 472 t.Errorf("MsgBlock.SerializeSize: #%d got: %d, want: "+ 473 "%d", i, serializedSize, test.size) 474 continue 475 } 476 } 477 } 478 479 var blockOne = wire.MsgBlock{ 480 Header: wire.BlockHeader{ 481 Version: 1, 482 PrevBlock: wire.ShaHash([wire.HashSize]byte{ // Make go vet happy. 483 0x6f, 0xe2, 0x8c, 0x0a, 0xb6, 0xf1, 0xb3, 0x72, 484 0xc1, 0xa6, 0xa2, 0x46, 0xae, 0x63, 0xf7, 0x4f, 485 0x93, 0x1e, 0x83, 0x65, 0xe1, 0x5a, 0x08, 0x9c, 486 0x68, 0xd6, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 487 }), 488 MerkleRoot: wire.ShaHash([wire.HashSize]byte{ // Make go vet happy. 489 0x98, 0x20, 0x51, 0xfd, 0x1e, 0x4b, 0xa7, 0x44, 490 0xbb, 0xbe, 0x68, 0x0e, 0x1f, 0xee, 0x14, 0x67, 491 0x7b, 0xa1, 0xa3, 0xc3, 0x54, 0x0b, 0xf7, 0xb1, 492 0xcd, 0xb6, 0x06, 0xe8, 0x57, 0x23, 0x3e, 0x0e, 493 }), 494 495 Timestamp: time.Unix(0x4966bc61, 0), // 2009-01-08 20:54:25 -0600 CST 496 Bits: 0x1d00ffff, // 486604799 497 Nonce: 0x9962e301, // 2573394689 498 }, 499 Transactions: []*wire.MsgTx{ 500 { 501 Version: 1, 502 TxIn: []*wire.TxIn{ 503 { 504 PreviousOutPoint: wire.OutPoint{ 505 Hash: wire.ShaHash{}, 506 Index: 0xffffffff, 507 }, 508 SignatureScript: []byte{ 509 0x04, 0xff, 0xff, 0x00, 0x1d, 0x01, 0x04, 510 }, 511 Sequence: 0xffffffff, 512 }, 513 }, 514 TxOut: []*wire.TxOut{ 515 { 516 Value: 0x12a05f200, 517 PkScript: []byte{ 518 0x41, // OP_DATA_65 519 0x04, 0x96, 0xb5, 0x38, 0xe8, 0x53, 0x51, 0x9c, 520 0x72, 0x6a, 0x2c, 0x91, 0xe6, 0x1e, 0xc1, 0x16, 521 0x00, 0xae, 0x13, 0x90, 0x81, 0x3a, 0x62, 0x7c, 522 0x66, 0xfb, 0x8b, 0xe7, 0x94, 0x7b, 0xe6, 0x3c, 523 0x52, 0xda, 0x75, 0x89, 0x37, 0x95, 0x15, 0xd4, 524 0xe0, 0xa6, 0x04, 0xf8, 0x14, 0x17, 0x81, 0xe6, 525 0x22, 0x94, 0x72, 0x11, 0x66, 0xbf, 0x62, 0x1e, 526 0x73, 0xa8, 0x2c, 0xbf, 0x23, 0x42, 0xc8, 0x58, 527 0xee, // 65-byte signature 528 0xac, // OP_CHECKSIG 529 }, 530 }, 531 }, 532 LockTime: 0, 533 }, 534 }, 535 } 536 537 // Block one serialized bytes. 538 var blockOneBytes = []byte{ 539 0x01, 0x00, 0x00, 0x00, // Version 1 540 0x6f, 0xe2, 0x8c, 0x0a, 0xb6, 0xf1, 0xb3, 0x72, 541 0xc1, 0xa6, 0xa2, 0x46, 0xae, 0x63, 0xf7, 0x4f, 542 0x93, 0x1e, 0x83, 0x65, 0xe1, 0x5a, 0x08, 0x9c, 543 0x68, 0xd6, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, // PrevBlock 544 0x98, 0x20, 0x51, 0xfd, 0x1e, 0x4b, 0xa7, 0x44, 545 0xbb, 0xbe, 0x68, 0x0e, 0x1f, 0xee, 0x14, 0x67, 546 0x7b, 0xa1, 0xa3, 0xc3, 0x54, 0x0b, 0xf7, 0xb1, 547 0xcd, 0xb6, 0x06, 0xe8, 0x57, 0x23, 0x3e, 0x0e, // MerkleRoot 548 0x61, 0xbc, 0x66, 0x49, // Timestamp 549 0xff, 0xff, 0x00, 0x1d, // Bits 550 0x01, 0xe3, 0x62, 0x99, // Nonce 551 0x01, // TxnCount 552 0x01, 0x00, 0x00, 0x00, // Version 553 0x01, // Varint for number of transaction inputs 554 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 555 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 556 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 557 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Previous output hash 558 0xff, 0xff, 0xff, 0xff, // Prevous output index 559 0x07, // Varint for length of signature script 560 0x04, 0xff, 0xff, 0x00, 0x1d, 0x01, 0x04, // Signature script (coinbase) 561 0xff, 0xff, 0xff, 0xff, // Sequence 562 0x01, // Varint for number of transaction outputs 563 0x00, 0xf2, 0x05, 0x2a, 0x01, 0x00, 0x00, 0x00, // Transaction amount 564 0x43, // Varint for length of pk script 565 0x41, // OP_DATA_65 566 0x04, 0x96, 0xb5, 0x38, 0xe8, 0x53, 0x51, 0x9c, 567 0x72, 0x6a, 0x2c, 0x91, 0xe6, 0x1e, 0xc1, 0x16, 568 0x00, 0xae, 0x13, 0x90, 0x81, 0x3a, 0x62, 0x7c, 569 0x66, 0xfb, 0x8b, 0xe7, 0x94, 0x7b, 0xe6, 0x3c, 570 0x52, 0xda, 0x75, 0x89, 0x37, 0x95, 0x15, 0xd4, 571 0xe0, 0xa6, 0x04, 0xf8, 0x14, 0x17, 0x81, 0xe6, 572 0x22, 0x94, 0x72, 0x11, 0x66, 0xbf, 0x62, 0x1e, 573 0x73, 0xa8, 0x2c, 0xbf, 0x23, 0x42, 0xc8, 0x58, 574 0xee, // 65-byte uncompressed public key 575 0xac, // OP_CHECKSIG 576 0x00, 0x00, 0x00, 0x00, // Lock time 577 } 578 579 // Transaction location information for block one transactions. 580 var blockOneTxLocs = []wire.TxLoc{ 581 {TxStart: 81, TxLen: 134}, 582 }