6 "github.com/vapor/consensus"
7 "github.com/vapor/protocol/bc"
8 "github.com/vapor/protocol/bc/types"
9 "github.com/vapor/protocol/state"
10 "github.com/vapor/testutil"
13 const utxoPreFix = "UT:"
15 func calcUtxoKey(hash *bc.Hash) []byte {
16 return []byte(utxoPreFix + hash.String())
23 func newTx(t *types.Tx) *tx {
29 func (t *tx) getSourceID(outIndex int) *bc.Hash {
30 output := t.Tx.Entries[*t.Tx.OutputID(outIndex)].(*bc.IntraChainOutput)
31 return output.Source.Ref
34 func (t *tx) getAmount(outIndex int) uint64 {
35 output := t.Tx.Entries[*t.Tx.OutputID(outIndex)].(*bc.IntraChainOutput)
36 return output.Source.Value.Amount
39 func (t *tx) getSpentOutputID(index int) bc.Hash {
40 input, err := t.Tx.Spend(t.Tx.InputIDs[index])
45 return *input.SpentOutputId
48 func (t *tx) OutputHash(outIndex int) *bc.Hash {
49 return t.Tx.ResultIds[outIndex]
52 func blockNode(header *bc.BlockHeader) *state.BlockNode {
53 h := types.BlockHeader{
54 Version: header.Version,
55 Height: header.Height,
56 PreviousBlockHash: *header.PreviousBlockId,
57 Timestamp: header.Timestamp,
59 return &state.BlockNode{
64 Timestamp: h.Timestamp,
68 func mustDecodeHex(str string) []byte {
69 data, err := hex.DecodeString(str)
76 func coinBaseTx(amount uint64, arbitrary string) *types.Tx {
77 return types.NewTx(types.TxData{
78 Inputs: []*types.TxInput{
79 types.NewCoinbaseInput([]byte(arbitrary)),
81 Outputs: []*types.TxOutput{
82 types.NewIntraChainOutput(*consensus.BTMAssetID, amount, mustDecodeHex("00144431c4278632c6e35dd2870faa1a4b8e0a275cbc")),
87 var mockTransaction = []*tx{}
88 var mockBlocks = []*block{}
90 func toHash(hash string) bc.Hash {
92 sourceID.UnmarshalText([]byte(hash))
96 func toAssetID(assetID string) bc.AssetID {
98 if err := asset.UnmarshalText([]byte(assetID)); err != nil {
110 mockTransaction = []*tx{}
112 Tx: types.NewTx(types.TxData{
113 Inputs: []*types.TxInput{
114 types.NewSpendInput(nil, toHash("ca9b179e549406aa583869e124e39817414d4500a8ce5476e95b6018d182b966"), *consensus.BTMAssetID, 41250000000, 0, []byte("00144431c4278632c6e35dd2870faa1a4b8e0a275cbc")),
116 Outputs: []*types.TxOutput{
117 types.NewIntraChainOutput(*consensus.BTMAssetID, 100000000, []byte("00148c704747e94387fa0b8712b053ed2132d84820ac")),
118 types.NewIntraChainOutput(*consensus.BTMAssetID, 41150000000, []byte("00144431c4278632c6e35dd2870faa1a4b8e0a275cbc")),
122 mockTransaction = append(mockTransaction, t)
126 Tx: types.NewTx(types.TxData{
127 Inputs: []*types.TxInput{
128 types.NewSpendInput(nil, *mockTransaction[0].getSourceID(1), *consensus.BTMAssetID, 41150000000, 1, []byte("00144431c4278632c6e35dd2870faa1a4b8e0a275cbc")),
130 Outputs: []*types.TxOutput{
131 types.NewIntraChainOutput(*consensus.BTMAssetID, 100000000, []byte("00148c704747e94387fa0b8712b053ed2132d84820ac")),
132 types.NewIntraChainOutput(*consensus.BTMAssetID, 41050000000, []byte("00144431c4278632c6e35dd2870faa1a4b8e0a275cbc")),
136 mockTransaction = append(mockTransaction, t)
140 Tx: types.NewTx(types.TxData{
141 Inputs: []*types.TxInput{
142 types.NewSpendInput(nil, *mockTransaction[1].getSourceID(1), *consensus.BTMAssetID, 41050000000, 1, []byte("00144431c4278632c6e35dd2870faa1a4b8e0a275cbc")),
144 Outputs: []*types.TxOutput{
145 types.NewIntraChainOutput(*consensus.BTMAssetID, 100000000, []byte("00148c704747e94387fa0b8712b053ed2132d84820ac")),
146 types.NewIntraChainOutput(*consensus.BTMAssetID, 40950000000, []byte("00144431c4278632c6e35dd2870faa1a4b8e0a275cbc")),
150 mockTransaction = append(mockTransaction, t)
152 // 3: 00140b0c5059514c751a80c4e1c94f8ecfe16d80671b -> 0014b103d8f2dc10e7bbbe2557ff8b9876524dec0a7e
153 assetID := toAssetID("5c3b60753fe1f8321298d64ab3881b200fa1d7e56f1b2a2df587233c532c5eb6")
155 Tx: types.NewTx(types.TxData{
156 Inputs: []*types.TxInput{
157 types.NewSpendInput(nil, toHash("453936067da4be89a99bbd78aa8c7eb88cbe92ae0941e1013a58b8d6af65d344"), *consensus.BTMAssetID, 41250000000, 0, []byte("00140b0c5059514c751a80c4e1c94f8ecfe16d80671b")),
158 types.NewSpendInput(nil, toHash("50d1c966b3a58f9092a696136a75ceb801ea7da2470784d80ebf3f17a76b8a98"), assetID, 800000000000, 0, []byte("00140b0c5059514c751a80c4e1c94f8ecfe16d80671b")),
160 Outputs: []*types.TxOutput{
161 types.NewIntraChainOutput(*consensus.BTMAssetID, 41150000000, []byte("0014b103d8f2dc10e7bbbe2557ff8b9876524dec0a7e")),
162 types.NewIntraChainOutput(*consensus.BTMAssetID, 100000000, []byte("00140b0c5059514c751a80c4e1c94f8ecfe16d80671b")),
163 types.NewIntraChainOutput(assetID, 700000000000, []byte("0014b103d8f2dc10e7bbbe2557ff8b9876524dec0a7e")),
164 types.NewIntraChainOutput(assetID, 100000000000, []byte("00140b0c5059514c751a80c4e1c94f8ecfe16d80671b")),
168 mockTransaction = append(mockTransaction, t)
172 Tx: types.NewTx(types.TxData{
173 Inputs: []*types.TxInput{
174 types.NewSpendInput(nil, toHash("ca9b179e549406aa583869e124e39817514d4500a8ce5476e95b6018d182b966"), *consensus.BTMAssetID, 41250000000, 0, []byte("00142b248deeffe82f9cd94fab43849468e0dfe97806")),
175 types.NewSpendInput(nil, toHash("d9a9b64e4f842060a40b15325d9aae61987776f7748e7e6a2887a474e84294ef"), assetID, 600000000000, 0, []byte("00142b248deeffe82f9cd94fab43849468e0dfe97806")),
177 Outputs: []*types.TxOutput{
178 types.NewIntraChainOutput(*consensus.BTMAssetID, 100000000, []byte("0014492d5b0f09f83bd9bff6a44514dcc9b11c091dce")),
179 types.NewIntraChainOutput(*consensus.BTMAssetID, 41150000000, []byte("00142b248deeffe82f9cd94fab43849468e0dfe97806")),
180 types.NewIntraChainOutput(assetID, 600000000000, []byte("0014492d5b0f09f83bd9bff6a44514dcc9b11c091dce")),
181 types.NewIntraChainOutput(assetID, 400000000000, []byte("00142b248deeffe82f9cd94fab43849468e0dfe97806")),
185 mockTransaction = append(mockTransaction, t)
187 // 5: 0014b103d8f2dc10e7bbbe2557ff8b9876524dec0a7e -> 00142b248deeffe82f9cd94fab43849468e0dfe97806
189 Tx: types.NewTx(types.TxData{
190 Inputs: []*types.TxInput{
191 types.NewSpendInput(nil, toHash("ca9b179e549406aa583869e124e39817514d4500a8ce5476e95b6018d182b966"), *consensus.BTMAssetID, 41150000000, 1, []byte("0014b103d8f2dc10e7bbbe2557ff8b9876524dec0a7e")),
192 types.NewSpendInput(nil, toHash("466e6a9261d7b51f227d6c05b7cd3cc36487cc6f0cfb79c58794021e68d4c877"), assetID, 300000000000, 0, []byte("0014b103d8f2dc10e7bbbe2557ff8b9876524dec0a7e")),
194 Outputs: []*types.TxOutput{
195 types.NewIntraChainOutput(*consensus.BTMAssetID, 41050000000, []byte("00142b248deeffe82f9cd94fab43849468e0dfe97806")),
196 types.NewIntraChainOutput(*consensus.BTMAssetID, 100000000, []byte("0014b103d8f2dc10e7bbbe2557ff8b9876524dec0a7e")),
197 types.NewIntraChainOutput(assetID, 200000000000, []byte("00142b248deeffe82f9cd94fab43849468e0dfe97806")),
198 types.NewIntraChainOutput(assetID, 100000000000, []byte("0014b103d8f2dc10e7bbbe2557ff8b9876524dec0a7e")),
202 mockTransaction = append(mockTransaction, t)
204 //6: 00142b248deeffe82f9cd94fab43849468e0dfe97806 -> 0014492d5b0f09f83bd9bff6a44514dcc9b11c091dce
206 Tx: types.NewTx(types.TxData{
207 Inputs: []*types.TxInput{
208 types.NewSpendInput(nil, toHash("ca9b179e549406aa583869e124e39817514d4500a8ce5476e95b6018d182b966"), *consensus.BTMAssetID, 41050000000, 2, []byte("00142b248deeffe82f9cd94fab43849468e0dfe97806")),
209 types.NewSpendInput(nil, toHash("e5757774fb46287ebda3479e19c8643d2fcdb5de3b1ac84d4020c1971bb3f531"), assetID, 100000000000, 0, []byte("00142b248deeffe82f9cd94fab43849468e0dfe97806")),
211 Outputs: []*types.TxOutput{
212 types.NewIntraChainOutput(*consensus.BTMAssetID, 40950000000, []byte("0014492d5b0f09f83bd9bff6a44514dcc9b11c091dce")),
213 types.NewIntraChainOutput(*consensus.BTMAssetID, 100000000, []byte("00142b248deeffe82f9cd94fab43849468e0dfe97806")),
214 types.NewIntraChainOutput(assetID, 50000000000, []byte("0014492d5b0f09f83bd9bff6a44514dcc9b11c091dce")),
215 types.NewIntraChainOutput(assetID, 50000000000, []byte("00142b248deeffe82f9cd94fab43849468e0dfe97806")),
219 mockTransaction = append(mockTransaction, t)
221 // 7: 0014492d5b0f09f83bd9bff6a44514dcc9b11c091dce -> 0014e3bb841fb722d1840a959d86e12a174c54a3a6e8
223 Tx: types.NewTx(types.TxData{
224 Inputs: []*types.TxInput{
225 types.NewSpendInput(nil, toHash("ca9b179e549406aa583869e124e39817514d4500a8ce5476e95b6018d182b966"), *consensus.BTMAssetID, 40950000000, 3, []byte("0014492d5b0f09f83bd9bff6a44514dcc9b11c091dce")),
227 Outputs: []*types.TxOutput{
228 types.NewIntraChainOutput(*consensus.BTMAssetID, 40850000000, []byte("0014e3bb841fb722d1840a959d86e12a174c54a3a6e8")),
229 types.NewIntraChainOutput(*consensus.BTMAssetID, 100000000, []byte("0014492d5b0f09f83bd9bff6a44514dcc9b11c091dce")),
233 mockTransaction = append(mockTransaction, t)
235 // 8: 0014e3bb841fb722d1840a959d86e12a174c54a3a6e8 -> 001449601d4cfb6e7a1b990778497b3c364f66bc17d2
237 Tx: types.NewTx(types.TxData{
238 Inputs: []*types.TxInput{
239 types.NewSpendInput(nil, toHash("ca9b179e549406aa583869e124e39817514d4500a8ce5476e95b6018d182b966"), *consensus.BTMAssetID, 40850000000, 4, []byte("0014e3bb841fb722d1840a959d86e12a174c54a3a6e8")),
241 Outputs: []*types.TxOutput{
242 types.NewIntraChainOutput(*consensus.BTMAssetID, 40750000000, []byte("001449601d4cfb6e7a1b990778497b3c364f66bc17d2")),
243 types.NewIntraChainOutput(*consensus.BTMAssetID, 100000000, []byte("0014e3bb841fb722d1840a959d86e12a174c54a3a6e8")),
247 mockTransaction = append(mockTransaction, t)
249 // 9: 001449601d4cfb6e7a1b990778497b3c364f66bc17d2 -> 0014bd3d70b1bcd62ece61c06a2fe097a4732e5f006b
251 Tx: types.NewTx(types.TxData{
252 Inputs: []*types.TxInput{
253 types.NewSpendInput(nil, toHash("ca9b179e549406aa583869e124e39817514d4500a8ce5476e95b6018d182b966"), *consensus.BTMAssetID, 40750000000, 5, []byte("001449601d4cfb6e7a1b990778497b3c364f66bc17d2")),
255 Outputs: []*types.TxOutput{
256 types.NewIntraChainOutput(*consensus.BTMAssetID, 40650000000, []byte("0014bd3d70b1bcd62ece61c06a2fe097a4732e5f006b")),
257 types.NewIntraChainOutput(*consensus.BTMAssetID, 100000000, []byte("001449601d4cfb6e7a1b990778497b3c364f66bc17d2")),
261 mockTransaction = append(mockTransaction, t)
263 // 10: 0014bd3d70b1bcd62ece61c06a2fe097a4732e5f006b -> 0014e809cb6f328db1e624821dec508cbe08fe1ed08d
265 Tx: types.NewTx(types.TxData{
266 Inputs: []*types.TxInput{
267 types.NewSpendInput(nil, toHash("ca9b179e549406aa583869e124e39817514d4500a8ce5476e95b6018d182b966"), *consensus.BTMAssetID, 40650000000, 6, []byte("0014bd3d70b1bcd62ece61c06a2fe097a4732e5f006b")),
269 Outputs: []*types.TxOutput{
270 types.NewIntraChainOutput(*consensus.BTMAssetID, 40550000000, []byte("0014e809cb6f328db1e624821dec508cbe08fe1ed08d")),
271 types.NewIntraChainOutput(*consensus.BTMAssetID, 100000000, []byte("0014bd3d70b1bcd62ece61c06a2fe097a4732e5f006b")),
275 mockTransaction = append(mockTransaction, t)
278 // 11: 0014b103d8f2dc10e7bbbe2557ff8b9876524dec0a7e -> 00142b248deeffe82f9cd94fab43849468e0dfe97806
280 Tx: types.NewTx(types.TxData{
281 Inputs: []*types.TxInput{
282 types.NewSpendInput(nil, *mockTransaction[3].getSourceID(0), *consensus.BTMAssetID, 41150000000, 0, []byte("0014b103d8f2dc10e7bbbe2557ff8b9876524dec0a7e")),
284 Outputs: []*types.TxOutput{
285 types.NewIntraChainOutput(*consensus.BTMAssetID, 41050000000, []byte("00142b248deeffe82f9cd94fab43849468e0dfe97806")),
286 types.NewIntraChainOutput(*consensus.BTMAssetID, 100000000, []byte("0014b103d8f2dc10e7bbbe2557ff8b9876524dec0a7e")),
290 mockTransaction = append(mockTransaction, t)
292 //12: 00142b248deeffe82f9cd94fab43849468e0dfe97806 -> 0014492d5b0f09f83bd9bff6a44514dcc9b11c091dce
294 Tx: types.NewTx(types.TxData{
295 Inputs: []*types.TxInput{
296 types.NewSpendInput(nil, *mockTransaction[11].getSourceID(0), *consensus.BTMAssetID, 41050000000, 0, []byte("00142b248deeffe82f9cd94fab43849468e0dfe97806")),
298 Outputs: []*types.TxOutput{
299 types.NewIntraChainOutput(*consensus.BTMAssetID, 40950000000, []byte("0014492d5b0f09f83bd9bff6a44514dcc9b11c091dce")),
300 types.NewIntraChainOutput(*consensus.BTMAssetID, 100000000, []byte("00142b248deeffe82f9cd94fab43849468e0dfe97806")),
304 mockTransaction = append(mockTransaction, t)
306 // 13: 0014492d5b0f09f83bd9bff6a44514dcc9b11c091dce -> 0014e3bb841fb722d1840a959d86e12a174c54a3a6e8
308 Tx: types.NewTx(types.TxData{
309 Inputs: []*types.TxInput{
310 types.NewSpendInput(nil, *mockTransaction[12].getSourceID(0), *consensus.BTMAssetID, 40950000000, 0, []byte("0014492d5b0f09f83bd9bff6a44514dcc9b11c091dce")),
312 Outputs: []*types.TxOutput{
313 types.NewIntraChainOutput(*consensus.BTMAssetID, 40850000000, []byte("0014e3bb841fb722d1840a959d86e12a174c54a3a6e8")),
314 types.NewIntraChainOutput(*consensus.BTMAssetID, 100000000, []byte("0014492d5b0f09f83bd9bff6a44514dcc9b11c091dce")),
318 mockTransaction = append(mockTransaction, t)
320 // 14: 0014e3bb841fb722d1840a959d86e12a174c54a3a6e8 -> 001449601d4cfb6e7a1b990778497b3c364f66bc17d2
322 Tx: types.NewTx(types.TxData{
323 Inputs: []*types.TxInput{
324 types.NewSpendInput(nil, *mockTransaction[13].getSourceID(0), *consensus.BTMAssetID, 40850000000, 0, []byte("0014e3bb841fb722d1840a959d86e12a174c54a3a6e8")),
326 Outputs: []*types.TxOutput{
327 types.NewIntraChainOutput(*consensus.BTMAssetID, 40750000000, []byte("001449601d4cfb6e7a1b990778497b3c364f66bc17d2")),
328 types.NewIntraChainOutput(*consensus.BTMAssetID, 100000000, []byte("0014e3bb841fb722d1840a959d86e12a174c54a3a6e8")),
332 mockTransaction = append(mockTransaction, t)
334 // 15: 001449601d4cfb6e7a1b990778497b3c364f66bc17d2 -> 0014bd3d70b1bcd62ece61c06a2fe097a4732e5f006b
336 Tx: types.NewTx(types.TxData{
337 Inputs: []*types.TxInput{
338 types.NewSpendInput(nil, *mockTransaction[14].getSourceID(0), *consensus.BTMAssetID, 40750000000, 0, []byte("001449601d4cfb6e7a1b990778497b3c364f66bc17d2")),
340 Outputs: []*types.TxOutput{
341 types.NewIntraChainOutput(*consensus.BTMAssetID, 40650000000, []byte("0014bd3d70b1bcd62ece61c06a2fe097a4732e5f006b")),
342 types.NewIntraChainOutput(*consensus.BTMAssetID, 100000000, []byte("001449601d4cfb6e7a1b990778497b3c364f66bc17d2")),
346 mockTransaction = append(mockTransaction, t)
348 // 16: 0014bd3d70b1bcd62ece61c06a2fe097a4732e5f006b -> 0014e809cb6f328db1e624821dec508cbe08fe1ed08d
350 Tx: types.NewTx(types.TxData{
351 Inputs: []*types.TxInput{
352 types.NewSpendInput(nil, *mockTransaction[15].getSourceID(0), *consensus.BTMAssetID, 40650000000, 0, []byte("0014bd3d70b1bcd62ece61c06a2fe097a4732e5f006b")),
354 Outputs: []*types.TxOutput{
355 types.NewIntraChainOutput(*consensus.BTMAssetID, 40550000000, []byte("0014e809cb6f328db1e624821dec508cbe08fe1ed08d")),
356 types.NewIntraChainOutput(*consensus.BTMAssetID, 100000000, []byte("0014bd3d70b1bcd62ece61c06a2fe097a4732e5f006b")),
360 mockTransaction = append(mockTransaction, t)
362 mockBlocks = []*block{
364 &block{Block: types.Block{
365 BlockHeader: types.BlockHeader{
367 PreviousBlockHash: testutil.MustDecodeHash("0ab29c0bd7bff3b3b7eb98802f8d5f8833884c86c0fb21559a65cc58dda99667"),
368 Timestamp: 1522908275,
370 Transactions: []*types.Tx{
371 coinBaseTx(41250000000, "arbitrary block0"),
376 &block{Block: types.Block{
377 BlockHeader: types.BlockHeader{
379 PreviousBlockHash: testutil.MustDecodeHash("0ab29c0bd7bff3b3b7eb98802f8d5f8833884c86c0fb21559a65cc58dda99667"),
380 Timestamp: 1522908275,
382 Transactions: []*types.Tx{
383 coinBaseTx(41250000000, "arbitrary block1"),
384 mockTransaction[0].Tx,
385 mockTransaction[1].Tx,
386 mockTransaction[2].Tx,
390 // detach block 1, attach block 2
391 &block{Block: types.Block{
392 BlockHeader: types.BlockHeader{
394 PreviousBlockHash: testutil.MustDecodeHash("0ab29c0bd7bff3b3b7eb98802f8d5f8833884c86c0fb21559a65cc58dda99667"),
395 Timestamp: 1522908275,
397 Transactions: []*types.Tx{
398 coinBaseTx(41250000000, "arbitrary block2"),
399 mockTransaction[0].Tx,
403 &block{Block: types.Block{
404 BlockHeader: types.BlockHeader{
406 PreviousBlockHash: testutil.MustDecodeHash("0ab29c0bd7bff3b3b7eb98802f8d5f8833884c86c0fb21559a65cc58dda99667"),
407 Timestamp: 1522908275,
409 Transactions: []*types.Tx{
410 coinBaseTx(41250000000, "arbitrary block3"),
411 mockTransaction[0].Tx,
415 &block{Block: types.Block{
416 BlockHeader: types.BlockHeader{
418 PreviousBlockHash: testutil.MustDecodeHash("0ab29c0bd7bff3b3b7eb98802f8d5f8833884c86c0fb21559a65cc58dda99667"),
419 Timestamp: 1522908275,
421 Transactions: []*types.Tx{
422 coinBaseTx(41250000000, "arbitrary block4"),
423 mockTransaction[1].Tx,
427 // detach block 5, attach block 2
428 &block{Block: types.Block{
429 BlockHeader: types.BlockHeader{
431 PreviousBlockHash: testutil.MustDecodeHash("0ab29c0bd7bff3b3b7eb98802f8d5f8833884c86c0fb21559a65cc58dda99667"),
432 Timestamp: 1522908275,
434 Transactions: []*types.Tx{
435 coinBaseTx(41250000000, "arbitrary block5"),
436 mockTransaction[2].Tx,
439 &block{Block: types.Block{
440 BlockHeader: types.BlockHeader{
442 PreviousBlockHash: testutil.MustDecodeHash("0ab29c0bd7bff3b3b7eb98802f8d5f8833884c86c0fb21559a65cc58dda99667"),
443 Timestamp: 1522908275,
445 Transactions: []*types.Tx{
446 coinBaseTx(41250000000, "arbitrary block6"),
447 mockTransaction[3].Tx,
448 mockTransaction[4].Tx,
451 &block{Block: types.Block{
452 BlockHeader: types.BlockHeader{
454 PreviousBlockHash: testutil.MustDecodeHash("0ab29c0bd7bff3b3b7eb98802f8d5f8833884c86c0fb21559a65cc58dda99667"),
455 Timestamp: 1522908275,
457 Transactions: []*types.Tx{
458 coinBaseTx(41250000000, "arbitrary block7"),
459 mockTransaction[5].Tx,
462 &block{Block: types.Block{
463 BlockHeader: types.BlockHeader{
465 PreviousBlockHash: testutil.MustDecodeHash("0ab29c0bd7bff3b3b7eb98802f8d5f8833884c86c0fb21559a65cc58dda99667"),
466 Timestamp: 1522908275,
468 Transactions: []*types.Tx{
469 coinBaseTx(41250000000, "arbitrary block8"),
470 mockTransaction[6].Tx,
471 mockTransaction[7].Tx,
472 mockTransaction[8].Tx,
475 &block{Block: types.Block{
476 BlockHeader: types.BlockHeader{
478 PreviousBlockHash: testutil.MustDecodeHash("0ab29c0bd7bff3b3b7eb98802f8d5f8833884c86c0fb21559a65cc58dda99667"),
479 Timestamp: 1522908275,
481 Transactions: []*types.Tx{
482 coinBaseTx(41250000000, "arbitrary block9"),
483 mockTransaction[9].Tx,
487 // detach block 5, attach block 2. Chain trading
488 &block{Block: types.Block{
489 BlockHeader: types.BlockHeader{
491 PreviousBlockHash: testutil.MustDecodeHash("0ab29c0bd7bff3b3b7eb98802f8d5f8833884c86c0fb21559a65cc58dda99667"),
492 Timestamp: 1522908275,
494 Transactions: []*types.Tx{
495 coinBaseTx(41250000000, "arbitrary block10"),
496 mockTransaction[2].Tx,
497 mockTransaction[3].Tx,
498 mockTransaction[4].Tx,
499 mockTransaction[5].Tx,
500 mockTransaction[6].Tx,
504 &block{Block: types.Block{
505 BlockHeader: types.BlockHeader{
507 PreviousBlockHash: testutil.MustDecodeHash("0ab29c0bd7bff3b3b7eb98802f8d5f8833884c86c0fb21559a65cc58dda99667"),
508 Timestamp: 1522908275,
510 Transactions: []*types.Tx{
511 coinBaseTx(41250000000, "arbitrary block11"),
512 mockTransaction[7].Tx,
513 mockTransaction[8].Tx,
514 mockTransaction[9].Tx,
518 // detach block 2, attach block 1. Chain trading
519 &block{Block: types.Block{
520 BlockHeader: types.BlockHeader{
522 PreviousBlockHash: testutil.MustDecodeHash("0ab29c0bd7bff3b3b7eb98802f8d5f8833884c86c0fb21559a65cc58dda99667"),
523 Timestamp: 1522908275,
525 Transactions: []*types.Tx{
526 coinBaseTx(41250000000, "arbitrary block12"),
527 mockTransaction[11].Tx,
528 mockTransaction[12].Tx,
529 mockTransaction[13].Tx,
530 mockTransaction[14].Tx,
533 &block{Block: types.Block{
534 BlockHeader: types.BlockHeader{
536 PreviousBlockHash: testutil.MustDecodeHash("0ab29c0bd7bff3b3b7eb98802f8d5f8833884c86c0fb21559a65cc58dda99667"),
537 Timestamp: 1522908275,
539 Transactions: []*types.Tx{
540 coinBaseTx(41250000000, "arbitrary block13"),
541 mockTransaction[15].Tx,
542 mockTransaction[16].Tx,
546 &block{Block: types.Block{
547 BlockHeader: types.BlockHeader{
549 PreviousBlockHash: testutil.MustDecodeHash("0ab29c0bd7bff3b3b7eb98802f8d5f8833884c86c0fb21559a65cc58dda99667"),
550 Timestamp: 1522908275,
552 Transactions: []*types.Tx{
553 coinBaseTx(41250000000, "arbitrary block14"),