diff --git a/blockdag/blockindex.go b/blockdag/blockindex.go index ad6e20f79..ef57f06c1 100644 --- a/blockdag/blockindex.go +++ b/blockdag/blockindex.go @@ -104,7 +104,7 @@ type blockNode struct { // platforms. version int32 bits uint32 - nonce uint32 + nonce uint64 timestamp int64 merkleRoot daghash.Hash diff --git a/blockdag/blockindex_test.go b/blockdag/blockindex_test.go index ce270d430..0ed7eb3a8 100644 --- a/blockdag/blockindex_test.go +++ b/blockdag/blockindex_test.go @@ -22,7 +22,7 @@ func TestAncestorErrors(t *testing.T) { func TestFlushToDBErrors(t *testing.T) { // Create a new database and DAG instance to run tests against. - dag, teardownFunc, err := DAGSetup("TestFlushToDBErrors", &dagconfig.MainNetParams) + dag, teardownFunc, err := DAGSetup("TestFlushToDBErrors", &dagconfig.SimNetParams) if err != nil { t.Fatalf("TestFlushToDBErrors: Failed to setup DAG instance: %s", err) } diff --git a/blockdag/dag_test.go b/blockdag/dag_test.go index 50aad9e84..6a4b331b8 100644 --- a/blockdag/dag_test.go +++ b/blockdag/dag_test.go @@ -136,10 +136,10 @@ func TestHaveBlock(t *testing.T) { {hash: dagconfig.SimNetParams.GenesisHash.String(), want: true}, // Block 3b should be present (as a second child of Block 2). - {hash: "00cd35debc62fd60b6fbda1925894db5996c02bcd575a4130fdb4d6071537152", want: true}, + {hash: "2b31fe171eeadcaec5978add980ebb8108fd5d9082e870ff71744842e0dd01bb", want: true}, // Block 100000 should be present (as an orphan). - {hash: "66cdaddc8884c99ccc46c2f34f579903a223cc12b44c239938af47ee0c7193b4", want: true}, + {hash: "64f3da4fe61edb33ad6dd5e857ebcfe296182a0c4aaef01e30b4032b94ec1620", want: true}, // Random hashes should not be available. {hash: "123", want: false}, @@ -469,7 +469,7 @@ func TestCalcSequenceLock(t *testing.T) { } func TestCalcPastMedianTime(t *testing.T) { - netParams := &dagconfig.MainNetParams + netParams := &dagconfig.SimNetParams blockVersion := int32(0x10000000) @@ -539,7 +539,7 @@ func chainedNodes(parents blockSet, numNodes int) []*blockNode { for i := 0; i < numNodes; i++ { // This is invalid, but all that is needed is enough to get the // synthetic tests to work. - header := wire.BlockHeader{Nonce: testNoncePrng.Uint32()} + header := wire.BlockHeader{Nonce: testNoncePrng.Uint64()} header.PrevBlocks = tips.hashes() nodes[i] = newBlockNode(&header, tips, dagconfig.SimNetParams.K) tips = setFromSlice(nodes[i]) @@ -561,7 +561,7 @@ func TestHeightToHashRange(t *testing.T) { // genesis -> 1 -> 2 -> ... -> 15 -> 16 -> 17 -> 18 // \-> 16a -> 17a -> 18a (unvalidated) tip := testTip - blockDAG := newTestDAG(&dagconfig.MainNetParams) + blockDAG := newTestDAG(&dagconfig.SimNetParams) branch0Nodes := chainedNodes(setFromSlice(blockDAG.genesis), 18) branch1Nodes := chainedNodes(setFromSlice(branch0Nodes[14]), 3) for _, node := range branch0Nodes { @@ -653,7 +653,7 @@ func TestIntervalBlockHashes(t *testing.T) { // genesis -> 1 -> 2 -> ... -> 15 -> 16 -> 17 -> 18 // \-> 16a -> 17a -> 18a (unvalidated) tip := testTip - chain := newTestDAG(&dagconfig.MainNetParams) + chain := newTestDAG(&dagconfig.SimNetParams) branch0Nodes := chainedNodes(setFromSlice(chain.genesis), 18) branch1Nodes := chainedNodes(setFromSlice(branch0Nodes[14]), 3) for _, node := range branch0Nodes { diff --git a/blockdag/example_test.go b/blockdag/example_test.go index e1eb1946a..439155869 100644 --- a/blockdag/example_test.go +++ b/blockdag/example_test.go @@ -68,7 +68,7 @@ func ExampleBlockChain_ProcessBlock() { fmt.Printf("Block accepted. Is it an orphan?: %v", isOrphan) // Output: - // Failed to process block: already have block 2f0484f539fb39c0788abdea0805f799364c68cd162935504b80f3696fa99332 + // Failed to process block: already have block 000000f9fa27ce9258baefc92e485fc5744eae341554fd03f25e1e10baa8c9c3 } // This example demonstrates how to convert the compact "bits" in a block header diff --git a/blockdag/fullblocktests/generate.go b/blockdag/fullblocktests/generate.go index 864e59c2f..476e021af 100644 --- a/blockdag/fullblocktests/generate.go +++ b/blockdag/fullblocktests/generate.go @@ -23,8 +23,8 @@ import ( "github.com/daglabs/btcd/dagconfig" "github.com/daglabs/btcd/dagconfig/daghash" "github.com/daglabs/btcd/txscript" - "github.com/daglabs/btcd/wire" "github.com/daglabs/btcd/util" + "github.com/daglabs/btcd/wire" ) const ( @@ -324,7 +324,7 @@ func solveBlock(header *wire.BlockHeader) bool { // sbResult is used by the solver goroutines to send results. type sbResult struct { found bool - nonce uint32 + nonce uint64 } // solver accepts a block header and a nonce range to test. It is @@ -332,7 +332,7 @@ func solveBlock(header *wire.BlockHeader) bool { targetDifficulty := blockdag.CompactToBig(header.Bits) quit := make(chan bool) results := make(chan sbResult) - solver := func(hdr wire.BlockHeader, startNonce, stopNonce uint32) { + solver := func(hdr wire.BlockHeader, startNonce, stopNonce uint64) { // We need to modify the nonce field of the header, so make sure // we work with a copy of the original header. for i := startNonce; i >= startNonce && i <= stopNonce; i++ { @@ -353,11 +353,11 @@ func solveBlock(header *wire.BlockHeader) bool { results <- sbResult{false, 0} } - startNonce := uint32(1) - stopNonce := uint32(math.MaxUint32) - numCores := uint32(runtime.NumCPU()) + startNonce := uint64(1) + stopNonce := uint64(math.MaxUint64) + numCores := uint64(runtime.NumCPU()) noncesPerCore := (stopNonce - startNonce) / numCores - for i := uint32(0); i < numCores; i++ { + for i := uint64(0); i < numCores; i++ { rangeStart := startNonce + (noncesPerCore * i) rangeStop := startNonce + (noncesPerCore * (i + 1)) - 1 if i == numCores-1 { @@ -365,7 +365,7 @@ func solveBlock(header *wire.BlockHeader) bool { } go solver(*header, rangeStart, rangeStop) } - for i := uint32(0); i < numCores; i++ { + for i := uint64(0); i < numCores; i++ { result := <-results if result.found { close(quit) diff --git a/blockdag/testdata/blk_0_to_4.dat b/blockdag/testdata/blk_0_to_4.dat index 8f48ac941..9e90b879e 100644 Binary files a/blockdag/testdata/blk_0_to_4.dat and b/blockdag/testdata/blk_0_to_4.dat differ diff --git a/blockdag/testdata/blk_3A.dat b/blockdag/testdata/blk_3A.dat index b683b1512..eca91042d 100644 Binary files a/blockdag/testdata/blk_3A.dat and b/blockdag/testdata/blk_3A.dat differ diff --git a/blockdag/testdata/blk_3B.dat b/blockdag/testdata/blk_3B.dat index 2b0261528..4315140f2 100644 Binary files a/blockdag/testdata/blk_3B.dat and b/blockdag/testdata/blk_3B.dat differ diff --git a/blockdag/testdata/blk_3C.dat b/blockdag/testdata/blk_3C.dat index 34468ae51..fe95c743b 100644 Binary files a/blockdag/testdata/blk_3C.dat and b/blockdag/testdata/blk_3C.dat differ diff --git a/blockdag/testdata/blk_3D.dat b/blockdag/testdata/blk_3D.dat index eb91b23cb..5a9453f01 100644 Binary files a/blockdag/testdata/blk_3D.dat and b/blockdag/testdata/blk_3D.dat differ diff --git a/blockdag/utxoset_test.go b/blockdag/utxoset_test.go index 433357f25..fb442762e 100644 --- a/blockdag/utxoset_test.go +++ b/blockdag/utxoset_test.go @@ -842,7 +842,7 @@ func createCoinbaseTx(blockHeight int32, numOutputs uint32) (*wire.MsgTx, error) func TestApplyUTXOChanges(t *testing.T) { // Create a new database and dag instance to run tests against. - dag, teardownFunc, err := DAGSetup("TestApplyUTXOChanges", &dagconfig.MainNetParams) + dag, teardownFunc, err := DAGSetup("TestApplyUTXOChanges", &dagconfig.SimNetParams) if err != nil { t.Fatalf("Failed to setup dag instance: %v", err) } diff --git a/blockdag/validate_test.go b/blockdag/validate_test.go index 5f66dd8af..3fa9e8280 100644 --- a/blockdag/validate_test.go +++ b/blockdag/validate_test.go @@ -190,9 +190,9 @@ func TestCheckBlockSanity(t *testing.T) { 0x6f, 0xff, 0xfb, 0xb7, 0xdc, 0x39, 0x9d, 0x76, 0x8d, 0xb0, 0xe1, 0x9c, 0x2e, 0x6d, 0x22, 0xd9, }), // f3e94742aca4b5ef85488dc37c06c3282295ffec960994b2c0d5ac2a25a95766 - Timestamp: time.Unix(0x5bbc64c9, 0), // 2018-10-09 08:17:35 +0000 UTC - Bits: 0x1e00ffff, // 503382015 - Nonce: 0xe00edcf9, // 3759070457 + Timestamp: time.Unix(0x5bbe0435, 0), + Bits: 0x207fffff, + Nonce: 0x9ffffffffffffffb, }, Transactions: []*wire.MsgTx{ { @@ -564,8 +564,8 @@ func TestPastMedianTime(t *testing.T) { } func TestValidateParents(t *testing.T) { - dag := newTestDAG(&dagconfig.MainNetParams) - genesisNode := dag.genesis + blockDAG := newTestDAG(&dagconfig.SimNetParams) + genesisNode := blockDAG.genesis blockVersion := int32(0x10000000) blockTime := genesisNode.Header().Timestamp @@ -577,7 +577,7 @@ func TestValidateParents(t *testing.T) { blockVersion, 0, blockTime, - dagconfig.MainNetParams.K) + dagconfig.SimNetParams.K) } a := generateNode(genesisNode) diff --git a/btcjson/dagsvrresults.go b/btcjson/dagsvrresults.go index 974190b40..a4e03170b 100644 --- a/btcjson/dagsvrresults.go +++ b/btcjson/dagsvrresults.go @@ -38,7 +38,7 @@ type GetBlockVerboseResult struct { Tx []string `json:"tx,omitempty"` RawTx []TxRawResult `json:"rawtx,omitempty"` Time int64 `json:"time"` - Nonce uint32 `json:"nonce"` + Nonce uint64 `json:"nonce"` Bits string `json:"bits"` Difficulty float64 `json:"difficulty"` PreviousHashes []string `json:"previousblockhashes"` diff --git a/dagconfig/genesis.go b/dagconfig/genesis.go index b1e760f57..2b5fc0ddb 100644 --- a/dagconfig/genesis.go +++ b/dagconfig/genesis.go @@ -59,10 +59,10 @@ var genesisCoinbaseTx = wire.MsgTx{ // genesisHash is the hash of the first block in the block chain for the main // network (genesis block). var genesisHash = daghash.Hash([daghash.HashSize]byte{ // Make go vet happy. - 0x32, 0x93, 0xa9, 0x6f, 0x69, 0xf3, 0x80, 0x4b, - 0x50, 0x35, 0x29, 0x16, 0xcd, 0x68, 0x4c, 0x36, - 0x99, 0xf7, 0x05, 0x08, 0xea, 0xbd, 0x8a, 0x78, - 0xc0, 0x39, 0xfb, 0x39, 0xf5, 0x84, 0x04, 0x2f, + 0xc3, 0xc9, 0xa8, 0xba, 0x10, 0x1e, 0x5e, 0xf2, + 0x03, 0xfd, 0x54, 0x15, 0x34, 0xae, 0x4e, 0x74, + 0xc5, 0x5f, 0x48, 0x2e, 0xc9, 0xef, 0xba, 0x58, + 0x92, 0xce, 0x27, 0xfa, 0xf9, 0x00, 0x00, 0x00, }) // genesisMerkleRoot is the hash of the first transaction in the genesis block @@ -82,9 +82,9 @@ var genesisBlock = wire.MsgBlock{ NumPrevBlocks: 0, PrevBlocks: []daghash.Hash{}, MerkleRoot: genesisMerkleRoot, // 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b - Timestamp: time.Unix(0x5b28c4c8, 0), // 2018-06-19 08:54:32 +0000 UTC + Timestamp: time.Unix(0x5bbe076c, 0), // 2018-10-10 14:06:36 +0000 UTC Bits: 0x1e00ffff, // 503382015 [000000ffff000000000000000000000000000000000000000000000000000000] - Nonce: 0x400a4c8f, // 1074416783 + Nonce: 0x80000000000d8796, // 9223372036855662486 }, Transactions: []*wire.MsgTx{&genesisCoinbaseTx}, } @@ -92,10 +92,10 @@ var genesisBlock = wire.MsgBlock{ // regTestGenesisHash is the hash of the first block in the block chain for the // regression test network (genesis block). var regTestGenesisHash = daghash.Hash([daghash.HashSize]byte{ // Make go vet happy. - 0xeb, 0x98, 0xea, 0xaf, 0xf3, 0xf4, 0x7b, 0x3f, - 0x4b, 0x61, 0x57, 0xf8, 0x75, 0xfb, 0xc6, 0x9f, - 0xde, 0x88, 0x68, 0xbe, 0x5d, 0xc8, 0xab, 0xc6, - 0xb4, 0x1f, 0x85, 0xd8, 0x77, 0x03, 0xbf, 0x0f, + 0xe7, 0xbe, 0x90, 0x9a, 0x85, 0xf4, 0xea, 0x42, + 0xe0, 0xd6, 0x68, 0x09, 0xc5, 0xa9, 0xd6, 0x94, + 0xa2, 0x34, 0x52, 0x4c, 0x5f, 0x1a, 0x77, 0xb1, + 0xcf, 0x26, 0x12, 0x0a, 0x1b, 0x26, 0x92, 0x13, }) // regTestGenesisMerkleRoot is the hash of the first transaction in the genesis @@ -111,9 +111,9 @@ var regTestGenesisBlock = wire.MsgBlock{ NumPrevBlocks: 0, PrevBlocks: []daghash.Hash{}, MerkleRoot: regTestGenesisMerkleRoot, // 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b - Timestamp: time.Unix(0x5b28c636, 0), // 2018-06-19 09:00:38 +0000 UTC + Timestamp: time.Unix(0x5bbe0d4b, 0), // 2018-06-19 09:00:38 +0000 UTC Bits: 0x207fffff, // 545259519 [7fffff0000000000000000000000000000000000000000000000000000000000] - Nonce: 0xdffffff9, + Nonce: 0x00000000, }, Transactions: []*wire.MsgTx{&genesisCoinbaseTx}, } @@ -121,10 +121,10 @@ var regTestGenesisBlock = wire.MsgBlock{ // testNet3GenesisHash is the hash of the first block in the block chain for the // test network (version 3). var testNet3GenesisHash = daghash.Hash([daghash.HashSize]byte{ // Make go vet happy. - 0x25, 0x62, 0xec, 0x05, 0x42, 0x4b, 0x74, 0x37, - 0x5a, 0x67, 0xd2, 0x6e, 0x24, 0x6c, 0xe8, 0x96, - 0xdf, 0xd6, 0x71, 0x88, 0xc8, 0xbb, 0x89, 0xd6, - 0xd9, 0x23, 0x84, 0x2b, 0xd0, 0x69, 0x39, 0xe7, + 0xcb, 0xcb, 0x39, 0xdb, 0xc7, 0x18, 0xe3, 0xd3, + 0x59, 0xb2, 0xf4, 0xe3, 0x9c, 0x05, 0xa3, 0x1d, + 0x60, 0xc6, 0xf7, 0x06, 0xb5, 0x93, 0xdf, 0x11, + 0x71, 0x1b, 0x82, 0xb1, 0xa3, 0x00, 0x00, 0x00, }) // testNet3GenesisMerkleRoot is the hash of the first transaction in the genesis @@ -140,9 +140,9 @@ var testNet3GenesisBlock = wire.MsgBlock{ NumPrevBlocks: 0, PrevBlocks: []daghash.Hash{}, MerkleRoot: testNet3GenesisMerkleRoot, // 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b - Timestamp: time.Unix(0x5b28c706, 0), // 2018-06-19 09:04:06 +0000 UTC + Timestamp: time.Unix(0x5bbe0e49, 0), // 2018-06-19 09:04:06 +0000 UTC Bits: 0x1e00ffff, // 503382015 [000000ffff000000000000000000000000000000000000000000000000000000] - Nonce: 0x802f1b3b, // 2150570811 + Nonce: 0xc00000000032560b, // 2150570811 }, Transactions: []*wire.MsgTx{&genesisCoinbaseTx}, } @@ -150,10 +150,10 @@ var testNet3GenesisBlock = wire.MsgBlock{ // simNetGenesisHash is the hash of the first block in the block chain for the // simulation test network. var simNetGenesisHash = daghash.Hash([daghash.HashSize]byte{ // Make go vet happy. - 0x93, 0x0f, 0x30, 0xd1, 0x0b, 0xaf, 0x9d, 0x5b, - 0x58, 0xdc, 0xad, 0x78, 0xee, 0x16, 0xd0, 0x12, - 0x10, 0xac, 0x2c, 0xa3, 0x08, 0xc4, 0x83, 0x33, - 0x57, 0xb2, 0xaf, 0x5a, 0x22, 0xa2, 0xf9, 0x20, + 0x4a, 0xc1, 0x82, 0x2e, 0x43, 0x05, 0xea, 0x0c, + 0x4f, 0xcc, 0x77, 0x87, 0xae, 0x26, 0x48, 0x87, + 0x50, 0x13, 0xee, 0x2f, 0x55, 0xa7, 0x18, 0xa7, + 0x1e, 0xf2, 0xd8, 0x7c, 0xc1, 0x13, 0xac, 0x22, }) // simNetGenesisMerkleRoot is the hash of the first transaction in the genesis @@ -169,9 +169,9 @@ var simNetGenesisBlock = wire.MsgBlock{ NumPrevBlocks: 0, PrevBlocks: []daghash.Hash{}, MerkleRoot: simNetGenesisMerkleRoot, // 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b - Timestamp: time.Unix(0x5b50a002, 0), // 2018-07-19 14:28:18 +0000 UTC + Timestamp: time.Unix(0x5bbe00fe, 0), // 2018-10-10 13:39:10 +0000 UTC Bits: 0x207fffff, // 545259519 [7fffff0000000000000000000000000000000000000000000000000000000000] - Nonce: 0x5ffffffd, // 1610612733 + Nonce: 0xdffffffffffffffc, // 1610612733 }, Transactions: []*wire.MsgTx{&genesisCoinbaseTx}, } diff --git a/dagconfig/genesis_test.go b/dagconfig/genesis_test.go index e0bfbf573..195b2619f 100644 --- a/dagconfig/genesis_test.go +++ b/dagconfig/genesis_test.go @@ -121,87 +121,155 @@ func TestSimNetGenesisBlock(t *testing.T) { // genesisBlockBytes are the wire encoded bytes for the genesis block of the // main network as of protocol version 60002. var genesisBlockBytes = []byte{ - 0x01, 0x00, 0x00, 0x00, 0x00, 0x69, 0x1f, 0x2e, 0x9c, 0x49, 0x12, 0x54, 0xc5, 0xde, 0x1d, 0x8f, - 0xd0, 0x95, 0x40, 0x07, 0xf0, 0xda, 0x1b, 0x4c, 0x84, 0x3c, 0x07, 0x94, 0x87, 0x6a, 0xd3, 0x0e, - 0xca, 0x87, 0xcc, 0x4b, 0xb9, 0xc8, 0xc4, 0x28, 0x5b, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, - 0x1e, 0x8f, 0x4c, 0x0a, 0x40, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x4d, - 0x04, 0xff, 0xff, 0x00, 0x1d, 0x01, 0x04, 0x45, 0x54, 0x68, 0x65, 0x20, 0x54, 0x69, 0x6d, 0x65, - 0x73, 0x20, 0x30, 0x33, 0x2f, 0x4a, 0x61, 0x6e, 0x2f, 0x32, 0x30, 0x30, 0x39, 0x20, 0x43, 0x68, - 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x20, 0x6f, 0x6e, 0x20, 0x62, 0x72, 0x69, 0x6e, - 0x6b, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20, 0x62, 0x61, 0x69, 0x6c, - 0x6f, 0x75, 0x74, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x62, 0x61, 0x6e, 0x6b, 0x73, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0xf2, 0x05, 0x2a, 0x01, 0x00, 0x00, 0x00, 0x43, 0x41, - 0x04, 0x67, 0x8a, 0xfd, 0xb0, 0xfe, 0x55, 0x48, 0x27, 0x19, 0x67, 0xf1, 0xa6, 0x71, 0x30, 0xb7, - 0x10, 0x5c, 0xd6, 0xa8, 0x28, 0xe0, 0x39, 0x09, 0xa6, 0x79, 0x62, 0xe0, 0xea, 0x1f, 0x61, 0xde, - 0xb6, 0x49, 0xf6, 0xbc, 0x3f, 0x4c, 0xef, 0x38, 0xc4, 0xf3, 0x55, 0x04, 0xe5, 0x1e, 0xc1, 0x12, - 0xde, 0x5c, 0x38, 0x4d, 0xf7, 0xba, 0x0b, 0x8d, 0x57, 0x8a, 0x4c, 0x70, 0x2b, 0x6b, 0xf1, 0x1d, - 0x5f, 0xac, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x69, 0x1f, 0x2e, /* |.....i..| */ + 0x9c, 0x49, 0x12, 0x54, 0xc5, 0xde, 0x1d, 0x8f, /* |.I.T....| */ + 0xd0, 0x95, 0x40, 0x07, 0xf0, 0xda, 0x1b, 0x4c, /* |..@....L| */ + 0x84, 0x3c, 0x07, 0x94, 0x87, 0x6a, 0xd3, 0x0e, /* |.<...j..| */ + 0xca, 0x87, 0xcc, 0x4b, 0xb9, 0x6c, 0x07, 0xbe, /* |...K.l..| */ + 0x5b, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, /* |[.......| */ + 0x1e, 0x96, 0x87, 0x0d, 0x00, 0x00, 0x00, 0x00, /* |........| */ + 0x80, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, /* |........| */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* |........| */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* |........| */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* |........| */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, /* |........| */ + 0xff, 0xff, 0xff, 0x4d, 0x04, 0xff, 0xff, 0x00, /* |...M....| */ + 0x1d, 0x01, 0x04, 0x45, 0x54, 0x68, 0x65, 0x20, /* |...EThe | */ + 0x54, 0x69, 0x6d, 0x65, 0x73, 0x20, 0x30, 0x33, /* |Times 03| */ + 0x2f, 0x4a, 0x61, 0x6e, 0x2f, 0x32, 0x30, 0x30, /* |/Jan/200| */ + 0x39, 0x20, 0x43, 0x68, 0x61, 0x6e, 0x63, 0x65, /* |9 Chance| */ + 0x6c, 0x6c, 0x6f, 0x72, 0x20, 0x6f, 0x6e, 0x20, /* |llor on | */ + 0x62, 0x72, 0x69, 0x6e, 0x6b, 0x20, 0x6f, 0x66, /* |brink of| */ + 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20, /* | second | */ + 0x62, 0x61, 0x69, 0x6c, 0x6f, 0x75, 0x74, 0x20, /* |bailout | */ + 0x66, 0x6f, 0x72, 0x20, 0x62, 0x61, 0x6e, 0x6b, /* |for bank| */ + 0x73, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* |s.......| */ + 0xff, 0x01, 0x00, 0xf2, 0x05, 0x2a, 0x01, 0x00, /* |.....*..| */ + 0x00, 0x00, 0x43, 0x41, 0x04, 0x67, 0x8a, 0xfd, /* |..CA.g..| */ + 0xb0, 0xfe, 0x55, 0x48, 0x27, 0x19, 0x67, 0xf1, /* |..UH'.g.| */ + 0xa6, 0x71, 0x30, 0xb7, 0x10, 0x5c, 0xd6, 0xa8, /* |.q0..\..| */ + 0x28, 0xe0, 0x39, 0x09, 0xa6, 0x79, 0x62, 0xe0, /* |(.9..yb.| */ + 0xea, 0x1f, 0x61, 0xde, 0xb6, 0x49, 0xf6, 0xbc, /* |..a..I..| */ + 0x3f, 0x4c, 0xef, 0x38, 0xc4, 0xf3, 0x55, 0x04, /* |?L.8..U.| */ + 0xe5, 0x1e, 0xc1, 0x12, 0xde, 0x5c, 0x38, 0x4d, /* |.....\8M| */ + 0xf7, 0xba, 0x0b, 0x8d, 0x57, 0x8a, 0x4c, 0x70, /* |....W.Lp| */ + 0x2b, 0x6b, 0xf1, 0x1d, 0x5f, 0xac, 0x00, 0x00, /* |+k.._...| */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* |......| */ } // regTestGenesisBlockBytes are the wire encoded bytes for the genesis block of // the regression test network as of protocol version 60002. var regTestGenesisBlockBytes = []byte{ - 0x01, 0x00, 0x00, 0x00, 0x00, 0x69, 0x1f, 0x2e, 0x9c, 0x49, 0x12, 0x54, 0xc5, 0xde, 0x1d, 0x8f, - 0xd0, 0x95, 0x40, 0x07, 0xf0, 0xda, 0x1b, 0x4c, 0x84, 0x3c, 0x07, 0x94, 0x87, 0x6a, 0xd3, 0x0e, - 0xca, 0x87, 0xcc, 0x4b, 0xb9, 0x36, 0xc6, 0x28, 0x5b, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7f, - 0x20, 0xf9, 0xff, 0xff, 0xdf, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x4d, - 0x04, 0xff, 0xff, 0x00, 0x1d, 0x01, 0x04, 0x45, 0x54, 0x68, 0x65, 0x20, 0x54, 0x69, 0x6d, 0x65, - 0x73, 0x20, 0x30, 0x33, 0x2f, 0x4a, 0x61, 0x6e, 0x2f, 0x32, 0x30, 0x30, 0x39, 0x20, 0x43, 0x68, - 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x20, 0x6f, 0x6e, 0x20, 0x62, 0x72, 0x69, 0x6e, - 0x6b, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20, 0x62, 0x61, 0x69, 0x6c, - 0x6f, 0x75, 0x74, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x62, 0x61, 0x6e, 0x6b, 0x73, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0xf2, 0x05, 0x2a, 0x01, 0x00, 0x00, 0x00, 0x43, 0x41, - 0x04, 0x67, 0x8a, 0xfd, 0xb0, 0xfe, 0x55, 0x48, 0x27, 0x19, 0x67, 0xf1, 0xa6, 0x71, 0x30, 0xb7, - 0x10, 0x5c, 0xd6, 0xa8, 0x28, 0xe0, 0x39, 0x09, 0xa6, 0x79, 0x62, 0xe0, 0xea, 0x1f, 0x61, 0xde, - 0xb6, 0x49, 0xf6, 0xbc, 0x3f, 0x4c, 0xef, 0x38, 0xc4, 0xf3, 0x55, 0x04, 0xe5, 0x1e, 0xc1, 0x12, - 0xde, 0x5c, 0x38, 0x4d, 0xf7, 0xba, 0x0b, 0x8d, 0x57, 0x8a, 0x4c, 0x70, 0x2b, 0x6b, 0xf1, 0x1d, - 0x5f, 0xac, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x69, 0x1f, 0x2e, /* |.....i..| */ + 0x9c, 0x49, 0x12, 0x54, 0xc5, 0xde, 0x1d, 0x8f, /* |.I.T....| */ + 0xd0, 0x95, 0x40, 0x07, 0xf0, 0xda, 0x1b, 0x4c, /* |..@....L| */ + 0x84, 0x3c, 0x07, 0x94, 0x87, 0x6a, 0xd3, 0x0e, /* |.<...j..| */ + 0xca, 0x87, 0xcc, 0x4b, 0xb9, 0x4b, 0x0d, 0xbe, /* |...K.K..| */ + 0x5b, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7f, /* |[.......| */ + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* | .......| */ + 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, /* |........| */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* |........| */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* |........| */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* |........| */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, /* |........| */ + 0xff, 0xff, 0xff, 0x4d, 0x04, 0xff, 0xff, 0x00, /* |...M....| */ + 0x1d, 0x01, 0x04, 0x45, 0x54, 0x68, 0x65, 0x20, /* |...EThe | */ + 0x54, 0x69, 0x6d, 0x65, 0x73, 0x20, 0x30, 0x33, /* |Times 03| */ + 0x2f, 0x4a, 0x61, 0x6e, 0x2f, 0x32, 0x30, 0x30, /* |/Jan/200| */ + 0x39, 0x20, 0x43, 0x68, 0x61, 0x6e, 0x63, 0x65, /* |9 Chance| */ + 0x6c, 0x6c, 0x6f, 0x72, 0x20, 0x6f, 0x6e, 0x20, /* |llor on | */ + 0x62, 0x72, 0x69, 0x6e, 0x6b, 0x20, 0x6f, 0x66, /* |brink of| */ + 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20, /* | second | */ + 0x62, 0x61, 0x69, 0x6c, 0x6f, 0x75, 0x74, 0x20, /* |bailout | */ + 0x66, 0x6f, 0x72, 0x20, 0x62, 0x61, 0x6e, 0x6b, /* |for bank| */ + 0x73, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* |s.......| */ + 0xff, 0x01, 0x00, 0xf2, 0x05, 0x2a, 0x01, 0x00, /* |.....*..| */ + 0x00, 0x00, 0x43, 0x41, 0x04, 0x67, 0x8a, 0xfd, /* |..CA.g..| */ + 0xb0, 0xfe, 0x55, 0x48, 0x27, 0x19, 0x67, 0xf1, /* |..UH'.g.| */ + 0xa6, 0x71, 0x30, 0xb7, 0x10, 0x5c, 0xd6, 0xa8, /* |.q0..\..| */ + 0x28, 0xe0, 0x39, 0x09, 0xa6, 0x79, 0x62, 0xe0, /* |(.9..yb.| */ + 0xea, 0x1f, 0x61, 0xde, 0xb6, 0x49, 0xf6, 0xbc, /* |..a..I..| */ + 0x3f, 0x4c, 0xef, 0x38, 0xc4, 0xf3, 0x55, 0x04, /* |?L.8..U.| */ + 0xe5, 0x1e, 0xc1, 0x12, 0xde, 0x5c, 0x38, 0x4d, /* |.....\8M| */ + 0xf7, 0xba, 0x0b, 0x8d, 0x57, 0x8a, 0x4c, 0x70, /* |....W.Lp| */ + 0x2b, 0x6b, 0xf1, 0x1d, 0x5f, 0xac, 0x00, 0x00, /* |+k.._...| */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* |......| */ } // testNet3GenesisBlockBytes are the wire encoded bytes for the genesis block of // the test network (version 3) as of protocol version 60002. var testNet3GenesisBlockBytes = []byte{ - 0x01, 0x00, 0x00, 0x00, 0x00, 0x69, 0x1f, 0x2e, 0x9c, 0x49, 0x12, 0x54, 0xc5, 0xde, 0x1d, 0x8f, - 0xd0, 0x95, 0x40, 0x07, 0xf0, 0xda, 0x1b, 0x4c, 0x84, 0x3c, 0x07, 0x94, 0x87, 0x6a, 0xd3, 0x0e, - 0xca, 0x87, 0xcc, 0x4b, 0xb9, 0x06, 0xc7, 0x28, 0x5b, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, - 0x1e, 0x3b, 0x1b, 0x2f, 0x80, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x4d, - 0x04, 0xff, 0xff, 0x00, 0x1d, 0x01, 0x04, 0x45, 0x54, 0x68, 0x65, 0x20, 0x54, 0x69, 0x6d, 0x65, - 0x73, 0x20, 0x30, 0x33, 0x2f, 0x4a, 0x61, 0x6e, 0x2f, 0x32, 0x30, 0x30, 0x39, 0x20, 0x43, 0x68, - 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x20, 0x6f, 0x6e, 0x20, 0x62, 0x72, 0x69, 0x6e, - 0x6b, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20, 0x62, 0x61, 0x69, 0x6c, - 0x6f, 0x75, 0x74, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x62, 0x61, 0x6e, 0x6b, 0x73, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0xf2, 0x05, 0x2a, 0x01, 0x00, 0x00, 0x00, 0x43, 0x41, - 0x04, 0x67, 0x8a, 0xfd, 0xb0, 0xfe, 0x55, 0x48, 0x27, 0x19, 0x67, 0xf1, 0xa6, 0x71, 0x30, 0xb7, - 0x10, 0x5c, 0xd6, 0xa8, 0x28, 0xe0, 0x39, 0x09, 0xa6, 0x79, 0x62, 0xe0, 0xea, 0x1f, 0x61, 0xde, - 0xb6, 0x49, 0xf6, 0xbc, 0x3f, 0x4c, 0xef, 0x38, 0xc4, 0xf3, 0x55, 0x04, 0xe5, 0x1e, 0xc1, 0x12, - 0xde, 0x5c, 0x38, 0x4d, 0xf7, 0xba, 0x0b, 0x8d, 0x57, 0x8a, 0x4c, 0x70, 0x2b, 0x6b, 0xf1, 0x1d, - 0x5f, 0xac, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x69, 0x1f, 0x2e, /* |.....i..| */ + 0x9c, 0x49, 0x12, 0x54, 0xc5, 0xde, 0x1d, 0x8f, /* |.I.T....| */ + 0xd0, 0x95, 0x40, 0x07, 0xf0, 0xda, 0x1b, 0x4c, /* |..@....L| */ + 0x84, 0x3c, 0x07, 0x94, 0x87, 0x6a, 0xd3, 0x0e, /* |.<...j..| */ + 0xca, 0x87, 0xcc, 0x4b, 0xb9, 0x49, 0x0e, 0xbe, /* |...K.I..| */ + 0x5b, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, /* |[.......| */ + 0x1e, 0x0b, 0x56, 0x32, 0x00, 0x00, 0x00, 0x00, /* |..V2....| */ + 0xc0, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, /* |........| */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* |........| */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* |........| */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* |........| */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, /* |........| */ + 0xff, 0xff, 0xff, 0x4d, 0x04, 0xff, 0xff, 0x00, /* |...M....| */ + 0x1d, 0x01, 0x04, 0x45, 0x54, 0x68, 0x65, 0x20, /* |...EThe | */ + 0x54, 0x69, 0x6d, 0x65, 0x73, 0x20, 0x30, 0x33, /* |Times 03| */ + 0x2f, 0x4a, 0x61, 0x6e, 0x2f, 0x32, 0x30, 0x30, /* |/Jan/200| */ + 0x39, 0x20, 0x43, 0x68, 0x61, 0x6e, 0x63, 0x65, /* |9 Chance| */ + 0x6c, 0x6c, 0x6f, 0x72, 0x20, 0x6f, 0x6e, 0x20, /* |llor on | */ + 0x62, 0x72, 0x69, 0x6e, 0x6b, 0x20, 0x6f, 0x66, /* |brink of| */ + 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20, /* | second | */ + 0x62, 0x61, 0x69, 0x6c, 0x6f, 0x75, 0x74, 0x20, /* |bailout | */ + 0x66, 0x6f, 0x72, 0x20, 0x62, 0x61, 0x6e, 0x6b, /* |for bank| */ + 0x73, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* |s.......| */ + 0xff, 0x01, 0x00, 0xf2, 0x05, 0x2a, 0x01, 0x00, /* |.....*..| */ + 0x00, 0x00, 0x43, 0x41, 0x04, 0x67, 0x8a, 0xfd, /* |..CA.g..| */ + 0xb0, 0xfe, 0x55, 0x48, 0x27, 0x19, 0x67, 0xf1, /* |..UH'.g.| */ + 0xa6, 0x71, 0x30, 0xb7, 0x10, 0x5c, 0xd6, 0xa8, /* |.q0..\..| */ + 0x28, 0xe0, 0x39, 0x09, 0xa6, 0x79, 0x62, 0xe0, /* |(.9..yb.| */ + 0xea, 0x1f, 0x61, 0xde, 0xb6, 0x49, 0xf6, 0xbc, /* |..a..I..| */ + 0x3f, 0x4c, 0xef, 0x38, 0xc4, 0xf3, 0x55, 0x04, /* |?L.8..U.| */ + 0xe5, 0x1e, 0xc1, 0x12, 0xde, 0x5c, 0x38, 0x4d, /* |.....\8M| */ + 0xf7, 0xba, 0x0b, 0x8d, 0x57, 0x8a, 0x4c, 0x70, /* |....W.Lp| */ + 0x2b, 0x6b, 0xf1, 0x1d, 0x5f, 0xac, 0x00, 0x00, /* |+k.._...| */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* |......| */ } // simNetGenesisBlockBytes are the wire encoded bytes for the genesis block of // the simulation test network as of protocol version 70002. var simNetGenesisBlockBytes = []byte{ - 0x01, 0x00, 0x00, 0x00, 0x00, 0x69, 0x1f, 0x2e, 0x9c, 0x49, 0x12, 0x54, 0xc5, 0xde, 0x1d, 0x8f, - 0xd0, 0x95, 0x40, 0x07, 0xf0, 0xda, 0x1b, 0x4c, 0x84, 0x3c, 0x07, 0x94, 0x87, 0x6a, 0xd3, 0x0e, - 0xca, 0x87, 0xcc, 0x4b, 0xb9, 0x02, 0xa0, 0x50, 0x5b, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7f, - 0x20, 0xfd, 0xff, 0xff, 0x5f, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x4d, - 0x04, 0xff, 0xff, 0x00, 0x1d, 0x01, 0x04, 0x45, 0x54, 0x68, 0x65, 0x20, 0x54, 0x69, 0x6d, 0x65, - 0x73, 0x20, 0x30, 0x33, 0x2f, 0x4a, 0x61, 0x6e, 0x2f, 0x32, 0x30, 0x30, 0x39, 0x20, 0x43, 0x68, - 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x20, 0x6f, 0x6e, 0x20, 0x62, 0x72, 0x69, 0x6e, - 0x6b, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20, 0x62, 0x61, 0x69, 0x6c, - 0x6f, 0x75, 0x74, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x62, 0x61, 0x6e, 0x6b, 0x73, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0xf2, 0x05, 0x2a, 0x01, 0x00, 0x00, 0x00, 0x43, 0x41, - 0x04, 0x67, 0x8a, 0xfd, 0xb0, 0xfe, 0x55, 0x48, 0x27, 0x19, 0x67, 0xf1, 0xa6, 0x71, 0x30, 0xb7, - 0x10, 0x5c, 0xd6, 0xa8, 0x28, 0xe0, 0x39, 0x09, 0xa6, 0x79, 0x62, 0xe0, 0xea, 0x1f, 0x61, 0xde, - 0xb6, 0x49, 0xf6, 0xbc, 0x3f, 0x4c, 0xef, 0x38, 0xc4, 0xf3, 0x55, 0x04, 0xe5, 0x1e, 0xc1, 0x12, - 0xde, 0x5c, 0x38, 0x4d, 0xf7, 0xba, 0x0b, 0x8d, 0x57, 0x8a, 0x4c, 0x70, 0x2b, 0x6b, 0xf1, 0x1d, - 0x5f, 0xac, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x69, 0x1f, 0x2e, /* |.....i..| */ + 0x9c, 0x49, 0x12, 0x54, 0xc5, 0xde, 0x1d, 0x8f, /* |.I.T....| */ + 0xd0, 0x95, 0x40, 0x07, 0xf0, 0xda, 0x1b, 0x4c, /* |..@....L| */ + 0x84, 0x3c, 0x07, 0x94, 0x87, 0x6a, 0xd3, 0x0e, /* |.<...j..| */ + 0xca, 0x87, 0xcc, 0x4b, 0xb9, 0xfe, 0x00, 0xbe, /* |...K....| */ + 0x5b, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7f, /* |[.......| */ + 0x20, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* | .......| */ + 0xdf, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, /* |........| */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* |........| */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* |........| */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* |........| */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, /* |........| */ + 0xff, 0xff, 0xff, 0x4d, 0x04, 0xff, 0xff, 0x00, /* |...M....| */ + 0x1d, 0x01, 0x04, 0x45, 0x54, 0x68, 0x65, 0x20, /* |...EThe | */ + 0x54, 0x69, 0x6d, 0x65, 0x73, 0x20, 0x30, 0x33, /* |Times 03| */ + 0x2f, 0x4a, 0x61, 0x6e, 0x2f, 0x32, 0x30, 0x30, /* |/Jan/200| */ + 0x39, 0x20, 0x43, 0x68, 0x61, 0x6e, 0x63, 0x65, /* |9 Chance| */ + 0x6c, 0x6c, 0x6f, 0x72, 0x20, 0x6f, 0x6e, 0x20, /* |llor on | */ + 0x62, 0x72, 0x69, 0x6e, 0x6b, 0x20, 0x6f, 0x66, /* |brink of| */ + 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20, /* | second | */ + 0x62, 0x61, 0x69, 0x6c, 0x6f, 0x75, 0x74, 0x20, /* |bailout | */ + 0x66, 0x6f, 0x72, 0x20, 0x62, 0x61, 0x6e, 0x6b, /* |for bank| */ + 0x73, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* |s.......| */ + 0xff, 0x01, 0x00, 0xf2, 0x05, 0x2a, 0x01, 0x00, /* |.....*..| */ + 0x00, 0x00, 0x43, 0x41, 0x04, 0x67, 0x8a, 0xfd, /* |..CA.g..| */ + 0xb0, 0xfe, 0x55, 0x48, 0x27, 0x19, 0x67, 0xf1, /* |..UH'.g.| */ + 0xa6, 0x71, 0x30, 0xb7, 0x10, 0x5c, 0xd6, 0xa8, /* |.q0..\..| */ + 0x28, 0xe0, 0x39, 0x09, 0xa6, 0x79, 0x62, 0xe0, /* |(.9..yb.| */ + 0xea, 0x1f, 0x61, 0xde, 0xb6, 0x49, 0xf6, 0xbc, /* |..a..I..| */ + 0x3f, 0x4c, 0xef, 0x38, 0xc4, 0xf3, 0x55, 0x04, /* |?L.8..U.| */ + 0xe5, 0x1e, 0xc1, 0x12, 0xde, 0x5c, 0x38, 0x4d, /* |.....\8M| */ + 0xf7, 0xba, 0x0b, 0x8d, 0x57, 0x8a, 0x4c, 0x70, /* |....W.Lp| */ + 0x2b, 0x6b, 0xf1, 0x1d, 0x5f, 0xac, 0x00, 0x00, /* |+k.._...| */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* |......| */ } diff --git a/database/example_test.go b/database/example_test.go index 02bedfa9e..08d5cfb1e 100644 --- a/database/example_test.go +++ b/database/example_test.go @@ -13,8 +13,8 @@ import ( "github.com/daglabs/btcd/dagconfig" "github.com/daglabs/btcd/database" _ "github.com/daglabs/btcd/database/ffldb" - "github.com/daglabs/btcd/wire" "github.com/daglabs/btcd/util" + "github.com/daglabs/btcd/wire" ) // This example demonstrates creating a new database. @@ -173,5 +173,5 @@ func Example_blockStorageAndRetrieval() { fmt.Printf("Serialized block size: %d bytes\n", len(loadedBlockBytes)) // Output: - // Serialized block size: 266 bytes + // Serialized block size: 270 bytes } diff --git a/database/ffldb/interface_test.go b/database/ffldb/interface_test.go index 13295898e..630fa0a51 100644 --- a/database/ffldb/interface_test.go +++ b/database/ffldb/interface_test.go @@ -28,8 +28,8 @@ import ( "github.com/daglabs/btcd/dagconfig" "github.com/daglabs/btcd/dagconfig/daghash" "github.com/daglabs/btcd/database" - "github.com/daglabs/btcd/wire" "github.com/daglabs/btcd/util" + "github.com/daglabs/btcd/wire" ) var ( diff --git a/database/testdata/blocks1-256.bz2 b/database/testdata/blocks1-256.bz2 index 91abc00a3..f620d42f8 100644 Binary files a/database/testdata/blocks1-256.bz2 and b/database/testdata/blocks1-256.bz2 differ diff --git a/integration/rpctest/blockgen.go b/integration/rpctest/blockgen.go index 04fc68403..69a64c35c 100644 --- a/integration/rpctest/blockgen.go +++ b/integration/rpctest/blockgen.go @@ -15,8 +15,8 @@ import ( "github.com/daglabs/btcd/dagconfig" "github.com/daglabs/btcd/dagconfig/daghash" "github.com/daglabs/btcd/txscript" - "github.com/daglabs/btcd/wire" "github.com/daglabs/btcd/util" + "github.com/daglabs/btcd/wire" ) // solveBlock attempts to find a nonce which makes the passed block header hash @@ -27,14 +27,14 @@ func solveBlock(header *wire.BlockHeader, targetDifficulty *big.Int) bool { // sbResult is used by the solver goroutines to send results. type sbResult struct { found bool - nonce uint32 + nonce uint64 } // solver accepts a block header and a nonce range to test. It is // intended to be run as a goroutine. quit := make(chan bool) results := make(chan sbResult) - solver := func(hdr wire.BlockHeader, startNonce, stopNonce uint32) { + solver := func(hdr wire.BlockHeader, startNonce, stopNonce uint64) { // We need to modify the nonce field of the header, so make sure // we work with a copy of the original header. for i := startNonce; i >= startNonce && i <= stopNonce; i++ { @@ -61,11 +61,11 @@ func solveBlock(header *wire.BlockHeader, targetDifficulty *big.Int) bool { } } - startNonce := uint32(0) - stopNonce := uint32(math.MaxUint32) - numCores := uint32(runtime.NumCPU()) + startNonce := uint64(0) + stopNonce := uint64(math.MaxUint64) + numCores := uint64(runtime.NumCPU()) noncesPerCore := (stopNonce - startNonce) / numCores - for i := uint32(0); i < numCores; i++ { + for i := uint64(0); i < numCores; i++ { rangeStart := startNonce + (noncesPerCore * i) rangeStop := startNonce + (noncesPerCore * (i + 1)) - 1 if i == numCores-1 { @@ -73,7 +73,7 @@ func solveBlock(header *wire.BlockHeader, targetDifficulty *big.Int) bool { } go solver(*header, rangeStart, rangeStop) } - for i := uint32(0); i < numCores; i++ { + for i := uint64(0); i < numCores; i++ { result := <-results if result.found { close(quit) diff --git a/mining/cpuminer/cpuminer.go b/mining/cpuminer/cpuminer.go index 30677c78c..933eacedd 100644 --- a/mining/cpuminer/cpuminer.go +++ b/mining/cpuminer/cpuminer.go @@ -22,7 +22,7 @@ import ( const ( // maxNonce is the maximum value a nonce can be in a block header. - maxNonce = ^uint32(0) // 2^32 - 1 + maxNonce = ^uint64(0) // 2^64 - 1 // maxExtraNonce is the maximum value an extra nonce used in a coinbase // transaction can be. @@ -237,7 +237,7 @@ func (m *CPUMiner) solveBlock(msgBlock *wire.MsgBlock, blockHeight int32, // Search through the entire nonce range for a solution while // periodically checking for early quit and stale block // conditions along with updates to the speed monitor. - for i := uint32(0); i <= maxNonce; i++ { + for i := uint64(0); i <= maxNonce; i++ { select { case <-quit: return false diff --git a/server/rpc/rpcserver.go b/server/rpc/rpcserver.go index cb69789f5..7c49381ca 100644 --- a/server/rpc/rpcserver.go +++ b/server/rpc/rpcserver.go @@ -69,10 +69,10 @@ const ( // 256-bit integer. uint256Size = 32 - // gbtNonceRange is two 32-bit big-endian hexadecimal integers which + // gbtNonceRange is two 64-bit big-endian hexadecimal integers which // represent the valid ranges of nonces returned by the getblocktemplate // RPC. - gbtNonceRange = "00000000ffffffff" + gbtNonceRange = "000000000000ffffffffffff" // gbtRegenerateSeconds is the number of seconds that must pass before // a new template is generated when the previous block hash has not diff --git a/server/rpc/rpcserverhelp.go b/server/rpc/rpcserverhelp.go index cd239a7c3..80f98adce 100644 --- a/server/rpc/rpcserverhelp.go +++ b/server/rpc/rpcserverhelp.go @@ -317,7 +317,7 @@ var helpDescsEnUS = map[string]string{ "getblocktemplateresult-maxtime": "Maximum allowed time", "getblocktemplateresult-mintime": "Minimum allowed time", "getblocktemplateresult-mutable": "List of mutations the server explicitly allows", - "getblocktemplateresult-noncerange": "Two concatenated hex-encoded big-endian 32-bit integers which represent the valid ranges of nonces the miner may scan", + "getblocktemplateresult-noncerange": "Two concatenated hex-encoded big-endian 64-bit integers which represent the valid ranges of nonces the miner may scan", "getblocktemplateresult-capabilities": "List of server capabilities including 'proposal' to indicate support for block proposals", "getblocktemplateresult-reject-reason": "Reason the proposal was invalid as-is (only applies to proposal responses)", diff --git a/util/block_test.go b/util/block_test.go index f7adac075..11178dfa7 100644 --- a/util/block_test.go +++ b/util/block_test.go @@ -13,8 +13,8 @@ import ( "time" "github.com/daglabs/btcd/dagconfig/daghash" - "github.com/daglabs/btcd/wire" "github.com/daglabs/btcd/util" + "github.com/daglabs/btcd/wire" "github.com/davecgh/go-spew/spew" ) @@ -37,7 +37,7 @@ func TestBlock(t *testing.T) { } // Hash for block 100,000. - wantHashStr := "e91f05cb0ca4c761f74f5488ff6f5039587abf37ae33566259c51c1d21a5666a" + wantHashStr := "b75e32d07046b5290e131686c2b98636483cc4119573926eebc9dc944496d53b" wantHash, err := daghash.NewHashFromStr(wantHashStr) if err != nil { t.Errorf("NewHashFromStr: %v", err) @@ -146,10 +146,10 @@ func TestBlock(t *testing.T) { // Transaction offsets and length for the transaction in Block100000. wantTxLocs := []wire.TxLoc{ - {TxStart: 118, TxLen: 143}, - {TxStart: 261, TxLen: 267}, - {TxStart: 528, TxLen: 265}, - {TxStart: 793, TxLen: 233}, + {TxStart: 122, TxLen: 143}, + {TxStart: 265, TxLen: 267}, + {TxStart: 532, TxLen: 265}, + {TxStart: 797, TxLen: 233}, } // Ensure the transaction location information is accurate. @@ -258,7 +258,7 @@ func TestBlockErrors(t *testing.T) { } // Truncate the block byte buffer to force errors. - shortBytes := block100000Bytes[:118] + shortBytes := block100000Bytes[:122] _, err = util.NewBlockFromBytes(shortBytes) if err != io.EOF { t.Errorf("NewBlockFromBytes: did not get expected error - "+ diff --git a/util/bloom/filter_test.go b/util/bloom/filter_test.go index 44b43fe74..53e04f636 100644 --- a/util/bloom/filter_test.go +++ b/util/bloom/filter_test.go @@ -10,9 +10,9 @@ import ( "testing" "github.com/daglabs/btcd/dagconfig/daghash" - "github.com/daglabs/btcd/wire" "github.com/daglabs/btcd/util" "github.com/daglabs/btcd/util/bloom" + "github.com/daglabs/btcd/wire" ) // TestFilterLarge ensures a maximum sized filter can be created. @@ -496,7 +496,7 @@ func TestFilterInsertP2PubKeyOnly(t *testing.T) { 0x7B, 0x3C, 0x30, 0xC1, 0xF8, 0xFD, 0xD0, 0xD9, 0x72, 0x87, 0x76, 0x38, 0x1B, 0x4D, 0x00, 0x00, 0x00, 0x00, // Time 0x4C, 0x86, 0x04, 0x1B, // Bits - 0x55, 0x4B, 0x85, 0x29, //Nonce + 0x55, 0x4B, 0x85, 0x29, 0x00, 0x00, 0x00, 0x00, // Fake Nonce. TODO: (Ori) Replace to a real nonce 0x07, // NumTxns 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //Txs[0] 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, diff --git a/util/bloom/merkleblock_test.go b/util/bloom/merkleblock_test.go index 98d66783b..bc8da423e 100644 --- a/util/bloom/merkleblock_test.go +++ b/util/bloom/merkleblock_test.go @@ -9,10 +9,10 @@ import ( "testing" "github.com/daglabs/btcd/dagconfig/daghash" - "github.com/daglabs/btcd/wire" "github.com/daglabs/btcd/util" - "github.com/davecgh/go-spew/spew" "github.com/daglabs/btcd/util/bloom" + "github.com/daglabs/btcd/wire" + "github.com/davecgh/go-spew/spew" ) func TestMerkleBlock3(t *testing.T) { @@ -27,7 +27,7 @@ func TestMerkleBlock3(t *testing.T) { 0x6B, 0x2C, 0x3F, 0xF6, 0x0A, 0xBE, 0x18, 0x4F, 0x19, 0x63, 0x67, 0x29, 0x1B, 0x4D, 0x00, 0x00, 0x00, 0x00, //Time 0x4C, 0x86, 0x04, 0x1B, // Bits - 0x8F, 0xA4, 0x5D, 0x63, // Nonce + 0x8F, 0xA4, 0x5D, 0x63, 0x00, 0x00, 0x00, 0x00, // Fake Nonce. TODO: (Ori) Replace to a real nonce 0x01, // NumTxs 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Tx 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -68,9 +68,9 @@ func TestMerkleBlock3(t *testing.T) { 0x00, 0x00, 0x00, 0x00, 0x00, 0xb5, 0x0c, 0xc0, 0x69, 0xd6, 0xa3, 0xe3, 0x3e, 0x3f, 0xf8, 0x4a, 0x5c, 0x41, 0xd9, 0xd3, 0xfe, 0xbe, 0x7c, 0x77, 0x0f, 0xdc, 0xc9, 0x6b, 0x2c, 0x3f, 0xf6, 0x0a, 0xbe, 0x18, 0x4f, 0x19, 0x63, 0x67, 0x29, 0x1b, 0x4d, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x86, 0x04, - 0x1b, 0x8f, 0xa4, 0x5d, 0x63, 0x01, 0x00, 0x00, 0x00, 0x01, 0x70, 0x2b, 0x1e, 0x73, 0x5a, 0x15, - 0xbc, 0xd7, 0xdb, 0xc9, 0x6f, 0xe5, 0x0f, 0x86, 0xe9, 0xd1, 0x9b, 0xdf, 0x75, 0x95, 0x30, 0xa6, - 0x95, 0x06, 0x6e, 0xe5, 0x1e, 0xb0, 0xb9, 0x94, 0xe8, 0x01, 0x01, 0x00, + 0x1b, 0x8f, 0xa4, 0x5d, 0x63, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x70, 0x2b, + 0x1e, 0x73, 0x5a, 0x15, 0xbc, 0xd7, 0xdb, 0xc9, 0x6f, 0xe5, 0x0f, 0x86, 0xe9, 0xd1, 0x9b, 0xdf, + 0x75, 0x95, 0x30, 0xa6, 0x95, 0x06, 0x6e, 0xe5, 0x1e, 0xb0, 0xb9, 0x94, 0xe8, 0x01, 0x01, 0x00, } t.Log(spew.Sdump(want)) if err != nil { diff --git a/wire/bench_test.go b/wire/bench_test.go index 2ce7978ef..de2bf5f28 100644 --- a/wire/bench_test.go +++ b/wire/bench_test.go @@ -359,7 +359,7 @@ func BenchmarkReadBlockHeader(b *testing.B) { 0x3a, 0x9f, 0xb8, 0xaa, 0x4b, 0x1e, 0x5e, 0x4a, // MerkleRoot 0x29, 0xab, 0x5f, 0x49, 0x00, 0x00, 0x00, 0x00, // Timestamp 0xff, 0xff, 0x00, 0x1d, // Bits - 0xf3, 0xe0, 0x01, 0x00, // Nonce + 0xf3, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // Fake Nonce. TODO: (Ori) Replace to a real nonce 0x00, // TxnCount Varint } r := bytes.NewReader(buf) @@ -429,7 +429,7 @@ func BenchmarkDecodeHeaders(b *testing.B) { } prevBlocks[i] = *hash } - m.AddBlockHeader(NewBlockHeader(1, prevBlocks, hash, 0, uint32(i))) + m.AddBlockHeader(NewBlockHeader(1, prevBlocks, hash, 0, uint64(i))) } // Serialize it so the bytes are available to test the decode below. @@ -575,7 +575,7 @@ func BenchmarkDecodeMerkleBlock(b *testing.B) { if err != nil { b.Fatalf("NewHashFromStr: unexpected error: %v", err) } - m.Header = *NewBlockHeader(1, []daghash.Hash{*hash}, hash, 0, uint32(10000)) + m.Header = *NewBlockHeader(1, []daghash.Hash{*hash}, hash, 0, uint64(10000)) for i := 0; i < 105; i++ { hash, err := daghash.NewHashFromStr(fmt.Sprintf("%x", i)) if err != nil { diff --git a/wire/blockheader.go b/wire/blockheader.go index 5fd74a8ae..e3837e565 100644 --- a/wire/blockheader.go +++ b/wire/blockheader.go @@ -14,11 +14,11 @@ import ( // BaseBlockHeaderPayload is the base number of bytes a block header can be, // not including the list of previous block headers. -// Version 4 bytes + Timestamp 8 bytes + Bits 4 bytes + Nonce 4 bytes + +// Version 4 bytes + Timestamp 8 bytes + Bits 4 bytes + Nonce 8 bytes + // + NumPrevBlocks 1 byte + MerkleRoot hash. // To get total size of block header len(PrevBlocks) * daghash.HashSize should be // added to this value -const BaseBlockHeaderPayload = 21 + (daghash.HashSize) +const BaseBlockHeaderPayload = 25 + (daghash.HashSize) // MaxNumPrevBlocks is the maximum number of previous blocks a block can reference. // Currently set to 255 as the maximum number NumPrevBlocks can be due to it being a byte @@ -50,7 +50,7 @@ type BlockHeader struct { Bits uint32 // Nonce used to generate the block. - Nonce uint32 + Nonce uint64 } // BlockHash computes the block identifier hash for the given block header. @@ -125,7 +125,7 @@ func (h *BlockHeader) SerializeSize() int { // block hash, merkle root hash, difficulty bits, and nonce used to generate the // block with defaults or calclulated values for the remaining fields. func NewBlockHeader(version int32, prevHashes []daghash.Hash, merkleRootHash *daghash.Hash, - bits uint32, nonce uint32) *BlockHeader { + bits uint32, nonce uint64) *BlockHeader { // Limit the timestamp to one second precision since the protocol // doesn't support better. diff --git a/wire/blockheader_test.go b/wire/blockheader_test.go index a82c9edf1..7f28553c2 100644 --- a/wire/blockheader_test.go +++ b/wire/blockheader_test.go @@ -16,11 +16,10 @@ import ( // TestBlockHeader tests the BlockHeader API. func TestBlockHeader(t *testing.T) { - nonce64, err := RandomUint64() + nonce, err := RandomUint64() if err != nil { t.Errorf("RandomUint64: Error generating nonce: %v", err) } - nonce := uint32(nonce64) hashes := []daghash.Hash{mainNetGenesisHash, simNetGenesisHash} @@ -50,7 +49,7 @@ func TestBlockHeader(t *testing.T) { // TestBlockHeaderWire tests the BlockHeader wire encode and decode for various // protocol versions. func TestBlockHeaderWire(t *testing.T) { - nonce := uint32(123123) // 0x1e0f3 + nonce := uint64(123123) // 0x000000000001e0f3 pver := uint32(70001) // baseBlockHdr is used in the various tests as a baseline BlockHeader. @@ -83,7 +82,7 @@ func TestBlockHeaderWire(t *testing.T) { 0x3a, 0x9f, 0xb8, 0xaa, 0x4b, 0x1e, 0x5e, 0x4a, 0x29, 0xab, 0x5f, 0x49, 0x00, 0x00, 0x00, 0x00, // Timestamp 0xff, 0xff, 0x00, 0x1d, // Bits - 0xf3, 0xe0, 0x01, 0x00, // Nonce + 0xf3, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // Fake Nonce. TODO: (Ori) Replace to a real nonce } tests := []struct { @@ -190,7 +189,7 @@ func TestBlockHeaderWire(t *testing.T) { // TestBlockHeaderSerialize tests BlockHeader serialize and deserialize. func TestBlockHeaderSerialize(t *testing.T) { - nonce := uint32(123123) // 0x1e0f3 + nonce := uint64(123123) // 0x01e0f3 // baseBlockHdr is used in the various tests as a baseline BlockHeader. bits := uint32(0x1d00ffff) @@ -222,7 +221,7 @@ func TestBlockHeaderSerialize(t *testing.T) { 0x3a, 0x9f, 0xb8, 0xaa, 0x4b, 0x1e, 0x5e, 0x4a, 0x29, 0xab, 0x5f, 0x49, 0x00, 0x00, 0x00, 0x00, // Timestamp 0xff, 0xff, 0x00, 0x1d, // Bits - 0xf3, 0xe0, 0x01, 0x00, // Nonce + 0xf3, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // Fake Nonce. TODO: (Ori) Replace to a real nonce } tests := []struct { @@ -271,7 +270,7 @@ func TestBlockHeaderSerialize(t *testing.T) { // TestBlockHeaderSerializeSize performs tests to ensure the serialize size for // various block headers is accurate. func TestBlockHeaderSerializeSize(t *testing.T) { - nonce := uint32(123123) // 0x1e0f3 + nonce := uint64(123123) // 0x1e0f3 bits := uint32(0x1d00ffff) timestamp := time.Unix(0x495fab29, 0) // 2009-01-03 12:15:05 -0600 CST baseBlockHdr := &BlockHeader{ @@ -298,10 +297,10 @@ func TestBlockHeaderSerializeSize(t *testing.T) { size int // Expected serialized size }{ // Block with no transactions. - {genesisBlockHdr, 53}, + {genesisBlockHdr, 57}, // First block in the mainnet block chain. - {baseBlockHdr, 117}, + {baseBlockHdr, 121}, } t.Logf("Running %d tests", len(tests)) @@ -317,7 +316,7 @@ func TestBlockHeaderSerializeSize(t *testing.T) { } func TestIsGenesis(t *testing.T) { - nonce := uint32(123123) // 0x1e0f3 + nonce := uint64(123123) // 0x1e0f3 bits := uint32(0x1d00ffff) timestamp := time.Unix(0x495fab29, 0) // 2009-01-03 12:15:05 -0600 CST diff --git a/wire/message_test.go b/wire/message_test.go index 82ba8fd95..fcab223e3 100644 --- a/wire/message_test.go +++ b/wire/message_test.go @@ -91,7 +91,7 @@ func TestMessage(t *testing.T) { {msgGetAddr, msgGetAddr, pver, MainNet, 24}, {msgAddr, msgAddr, pver, MainNet, 25}, {msgGetBlocks, msgGetBlocks, pver, MainNet, 61}, - {msgBlock, msgBlock, pver, MainNet, 284}, + {msgBlock, msgBlock, pver, MainNet, 288}, {msgInv, msgInv, pver, MainNet, 25}, {msgGetData, msgGetData, pver, MainNet, 25}, {msgNotFound, msgNotFound, pver, MainNet, 25}, @@ -107,7 +107,7 @@ func TestMessage(t *testing.T) { {msgFilterAdd, msgFilterAdd, pver, MainNet, 26}, {msgFilterClear, msgFilterClear, pver, MainNet, 24}, {msgFilterLoad, msgFilterLoad, pver, MainNet, 35}, - {msgMerkleBlock, msgMerkleBlock, pver, MainNet, 147}, + {msgMerkleBlock, msgMerkleBlock, pver, MainNet, 151}, {msgReject, msgReject, pver, MainNet, 79}, {msgGetCFilters, msgGetCFilters, pver, MainNet, 61}, {msgGetCFHeaders, msgGetCFHeaders, pver, MainNet, 61}, diff --git a/wire/msgblock_test.go b/wire/msgblock_test.go index cb91abef5..c66420908 100644 --- a/wire/msgblock_test.go +++ b/wire/msgblock_test.go @@ -93,7 +93,7 @@ func TestBlockTxHashes(t *testing.T) { // TestBlockHash tests the ability to generate the hash of a block accurately. func TestBlockHash(t *testing.T) { // Block 1 hash. - hashStr := "f5a1c070bed4d87e1ff0c0040d8d56f9d559aeb4c737978b4c12a83a4c6cd231" + hashStr := "5d8486ede1953cb1bc91720f10421ae670ec66565f1cc0b889fba125f79d5de3" wantHash, err := daghash.NewHashFromStr(hashStr) if err != nil { t.Errorf("NewHashFromStr: %v", err) @@ -227,9 +227,9 @@ func TestBlockWireErrors(t *testing.T) { // Force error in header nonce. {&blockOne, blockOneBytes, pver, 113, io.ErrShortWrite, io.EOF}, // Force error in transaction count. - {&blockOne, blockOneBytes, pver, 117, io.ErrShortWrite, io.EOF}, + {&blockOne, blockOneBytes, pver, 121, io.ErrShortWrite, io.EOF}, // Force error in transactions. - {&blockOne, blockOneBytes, pver, 118, io.ErrShortWrite, io.EOF}, + {&blockOne, blockOneBytes, pver, 122, io.ErrShortWrite, io.EOF}, } t.Logf("Running %d tests", len(tests)) @@ -349,9 +349,9 @@ func TestBlockSerializeErrors(t *testing.T) { // Force error in header nonce. {&blockOne, blockOneBytes, 113, io.ErrShortWrite, io.EOF}, // Force error in transaction count. - {&blockOne, blockOneBytes, 117, io.ErrShortWrite, io.EOF}, + {&blockOne, blockOneBytes, 121, io.ErrShortWrite, io.EOF}, // Force error in transactions. - {&blockOne, blockOneBytes, 118, io.ErrShortWrite, io.EOF}, + {&blockOne, blockOneBytes, 122, io.ErrShortWrite, io.EOF}, } t.Logf("Running %d tests", len(tests)) @@ -420,7 +420,7 @@ func TestBlockOverflowErrors(t *testing.T) { 0x3a, 0x9f, 0xb8, 0xaa, 0x4b, 0x1e, 0x5e, 0x4a, 0x61, 0xbc, 0x66, 0x49, 0x00, 0x00, 0x00, 0x00, // Timestamp 0xff, 0xff, 0x00, 0x1d, // Bits - 0x01, 0xe3, 0x62, 0x99, // Nonce + 0x01, 0xe3, 0x62, 0x99, 0x00, 0x00, 0x00, 0x00, // Fake Nonce. TODO: (Ori) Replace to a real nonce 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // TxnCount }, pver, &MessageError{}, @@ -470,7 +470,7 @@ func TestBlockSerializeSize(t *testing.T) { size int // Expected serialized size }{ // Block with no transactions. - {noTxBlock, 118}, + {noTxBlock, 122}, // First block in the mainnet block chain. {&blockOne, len(blockOneBytes)}, @@ -556,7 +556,7 @@ var blockOneBytes = []byte{ 0x3a, 0x9f, 0xb8, 0xaa, 0x4b, 0x1e, 0x5e, 0x4a, 0x61, 0xbc, 0x66, 0x49, 0x00, 0x00, 0x00, 0x00, // Timestamp 0xff, 0xff, 0x00, 0x1d, // Bits - 0x01, 0xe3, 0x62, 0x99, // Nonce + 0x01, 0xe3, 0x62, 0x99, 0x00, 0x00, 0x00, 0x00, // Fake Nonce. TODO: (Ori) Replace to a real nonce 0x01, // TxnCount 0x01, 0x00, 0x00, 0x00, // Version 0x01, // Varint for number of transaction inputs @@ -587,5 +587,5 @@ var blockOneBytes = []byte{ // Transaction location information for block one transactions. var blockOneTxLocs = []TxLoc{ - {TxStart: 118, TxLen: 142}, + {TxStart: 122, TxLen: 142}, } diff --git a/wire/msgheaders_test.go b/wire/msgheaders_test.go index 5e548258d..d7d6ae944 100644 --- a/wire/msgheaders_test.go +++ b/wire/msgheaders_test.go @@ -29,7 +29,7 @@ func TestHeaders(t *testing.T) { // Ensure max payload is expected value for latest protocol version. // Num headers (varInt) + max allowed headers (header length + 1 byte // for the number of transactions which is always 0). - wantPayload := uint32(16428009) + wantPayload := uint32(16436009) maxPayload := msg.MaxPayloadLength(pver) if maxPayload != wantPayload { t.Errorf("MaxPayloadLength: wrong max payload length for "+ @@ -64,7 +64,7 @@ func TestHeadersWire(t *testing.T) { hashes := []daghash.Hash{mainNetGenesisHash, simNetGenesisHash} merkleHash := blockOne.Header.MerkleRoot bits := uint32(0x1d00ffff) - nonce := uint32(0x9962e301) + nonce := uint64(0x9962e301) bh := NewBlockHeader(1, hashes, &merkleHash, bits, nonce) bh.Version = blockOne.Header.Version bh.Timestamp = blockOne.Header.Timestamp @@ -96,7 +96,7 @@ func TestHeadersWire(t *testing.T) { 0x3a, 0x9f, 0xb8, 0xaa, 0x4b, 0x1e, 0x5e, 0x4a, 0x61, 0xbc, 0x66, 0x49, 0x00, 0x00, 0x00, 0x00, // Timestamp 0xff, 0xff, 0x00, 0x1d, // Bits - 0x01, 0xe3, 0x62, 0x99, // Nonce + 0x01, 0xe3, 0x62, 0x99, 0x00, 0x00, 0x00, 0x00, // Fake Nonce. TODO: (Ori) Replace to a real nonce 0x00, // TxnCount (0 for headers message) } @@ -226,7 +226,7 @@ func TestHeadersWireErrors(t *testing.T) { hashes := []daghash.Hash{mainNetGenesisHash, simNetGenesisHash} merkleHash := blockOne.Header.MerkleRoot bits := uint32(0x1d00ffff) - nonce := uint32(0x9962e301) + nonce := uint64(0x9962e301) bh := NewBlockHeader(1, hashes, &merkleHash, bits, nonce) bh.Version = blockOne.Header.Version bh.Timestamp = blockOne.Header.Timestamp @@ -252,7 +252,7 @@ func TestHeadersWireErrors(t *testing.T) { 0x3a, 0x9f, 0xb8, 0xaa, 0x4b, 0x1e, 0x5e, 0x4a, 0x61, 0xbc, 0x66, 0x49, 0x00, 0x00, 0x00, 0x00, // Timestamp 0xff, 0xff, 0x00, 0x1d, // Bits - 0x01, 0xe3, 0x62, 0x99, // Nonce + 0x01, 0xe3, 0x62, 0x99, 0x00, 0x00, 0x00, 0x00, // Fake Nonce. TODO: (Ori) Replace to a real nonce 0x00, // TxnCount (0 for headers message) } @@ -293,7 +293,7 @@ func TestHeadersWireErrors(t *testing.T) { 0x3a, 0x9f, 0xb8, 0xaa, 0x4b, 0x1e, 0x5e, 0x4a, 0x61, 0xbc, 0x66, 0x49, 0x00, 0x00, 0x00, 0x00, // Timestamp 0xff, 0xff, 0x00, 0x1d, // Bits - 0x01, 0xe3, 0x62, 0x99, // Nonce + 0x01, 0xe3, 0x62, 0x99, 0x00, 0x00, 0x00, 0x00, // Fake Nonce. TODO: (Ori) Replace to a real nonce 0x01, // TxnCount (should be 0 for headers message, but 1 to force error) } diff --git a/wire/msgmerkleblock_test.go b/wire/msgmerkleblock_test.go index b03be6dc0..184d10b97 100644 --- a/wire/msgmerkleblock_test.go +++ b/wire/msgmerkleblock_test.go @@ -224,17 +224,17 @@ func TestMerkleBlockWireErrors(t *testing.T) { // Force error in header nonce. {&merkleBlockOne, merkleBlockOneBytes, pver, 113, io.ErrShortWrite, io.EOF}, // Force error in transaction count. - {&merkleBlockOne, merkleBlockOneBytes, pver, 117, io.ErrShortWrite, io.EOF}, - // Force error in num hashes. {&merkleBlockOne, merkleBlockOneBytes, pver, 121, io.ErrShortWrite, io.EOF}, + // Force error in num hashes. + {&merkleBlockOne, merkleBlockOneBytes, pver, 125, io.ErrShortWrite, io.EOF}, // Force error in hashes. - {&merkleBlockOne, merkleBlockOneBytes, pver, 122, io.ErrShortWrite, io.EOF}, + {&merkleBlockOne, merkleBlockOneBytes, pver, 126, io.ErrShortWrite, io.EOF}, // Force error in num flag bytes. - {&merkleBlockOne, merkleBlockOneBytes, pver, 154, io.ErrShortWrite, io.EOF}, + {&merkleBlockOne, merkleBlockOneBytes, pver, 158, io.ErrShortWrite, io.EOF}, // Force error in flag bytes. - {&merkleBlockOne, merkleBlockOneBytes, pver, 155, io.ErrShortWrite, io.EOF}, + {&merkleBlockOne, merkleBlockOneBytes, pver, 159, io.ErrShortWrite, io.EOF}, // Force error due to unsupported protocol version. - {&merkleBlockOne, merkleBlockOneBytes, pverNoMerkleBlock, 155, wireErr, wireErr}, + {&merkleBlockOne, merkleBlockOneBytes, pverNoMerkleBlock, 159, wireErr, wireErr}, } t.Logf("Running %d tests", len(tests)) @@ -294,7 +294,7 @@ func TestMerkleBlockOverflowErrors(t *testing.T) { // allowed tx hashes. var buf bytes.Buffer WriteVarInt(&buf, pver, maxTxPerBlock+1) - numHashesOffset := 121 + numHashesOffset := 125 exceedMaxHashes := make([]byte, numHashesOffset) copy(exceedMaxHashes, merkleBlockOneBytes[:numHashesOffset]) exceedMaxHashes = append(exceedMaxHashes, buf.Bytes()...) @@ -303,7 +303,7 @@ func TestMerkleBlockOverflowErrors(t *testing.T) { // allowed flag bytes. buf.Reset() WriteVarInt(&buf, pver, maxFlagsPerMerkleBlock+1) - numFlagBytesOffset := 154 + numFlagBytesOffset := 158 exceedMaxFlagBytes := make([]byte, numFlagBytesOffset) copy(exceedMaxFlagBytes, merkleBlockOneBytes[:numFlagBytesOffset]) exceedMaxFlagBytes = append(exceedMaxFlagBytes, buf.Bytes()...) @@ -381,7 +381,7 @@ var merkleBlockOneBytes = []byte{ 0xcd, 0xb6, 0x06, 0xe8, 0x57, 0x23, 0x3e, 0x0e, // MerkleRoot 0x61, 0xbc, 0x66, 0x49, 0x00, 0x00, 0x00, 0x00, // Timestamp 0xff, 0xff, 0x00, 0x1d, // Bits - 0x01, 0xe3, 0x62, 0x99, // Nonce + 0x01, 0xe3, 0x62, 0x99, 0x00, 0x00, 0x00, 0x00, // Fake Nonce. TODO: (Ori) Replace to a real nonce 0x01, 0x00, 0x00, 0x00, // TxnCount 0x01, // Num hashes 0x98, 0x20, 0x51, 0xfd, 0x1e, 0x4b, 0xa7, 0x44, diff --git a/wire/msgversion_test.go b/wire/msgversion_test.go index c451b543c..84642b002 100644 --- a/wire/msgversion_test.go +++ b/wire/msgversion_test.go @@ -493,7 +493,7 @@ var baseVersionEncoded = []byte{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1 0x20, 0x8d, // Port 8333 in big-endian - 0xf3, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // Nonce + 0xf3, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // Fake Nonce. TODO: (Ori) Replace to a real nonce 0x10, // Varint for user agent length 0x2f, 0x62, 0x74, 0x63, 0x64, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x2f, // User agent @@ -539,7 +539,7 @@ var baseVersionBIP0037Encoded = []byte{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1 0x20, 0x8d, // Port 8333 in big-endian - 0xf3, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // Nonce + 0xf3, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // Fake Nonce. TODO: (Ori) Replace to a real nonce 0x10, // Varint for user agent length 0x2f, 0x62, 0x74, 0x63, 0x64, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x2f, // User agent