6 "github.com/bytom/bytom/consensus"
7 "github.com/bytom/bytom/protocol/bc"
8 "github.com/bytom/bytom/protocol/bc/types"
9 "github.com/bytom/bytom/testutil"
12 const utxoPreFix = "UT:"
14 func calcUtxoKey(hash *bc.Hash) []byte {
15 return []byte(utxoPreFix + hash.String())
22 func newTx(t *types.Tx) *tx {
28 func (t *tx) getSourceID(outIndex int) *bc.Hash {
29 output := t.Tx.Entries[*t.Tx.OutputID(outIndex)].(*bc.OriginalOutput)
30 return output.Source.Ref
33 func (t *tx) getAmount(outIndex int) uint64 {
34 output := t.Tx.Entries[*t.Tx.OutputID(outIndex)].(*bc.OriginalOutput)
35 return output.Source.Value.Amount
38 func (t *tx) getSpentOutputID(index int) bc.Hash {
39 input, err := t.Tx.Spend(t.Tx.InputIDs[index])
44 return *input.SpentOutputId
47 func (t *tx) OutputHash(outIndex int) *bc.Hash {
48 return t.Tx.ResultIds[outIndex]
51 func mustDecodeHex(str string) []byte {
52 data, err := hex.DecodeString(str)
59 func coinBaseTx(amount uint64, arbitrary string) *types.Tx {
60 return types.NewTx(types.TxData{
61 Inputs: []*types.TxInput{
62 types.NewCoinbaseInput([]byte(arbitrary)),
64 Outputs: []*types.TxOutput{
65 types.NewOriginalTxOutput(*consensus.BTMAssetID, amount, mustDecodeHex("00144431c4278632c6e35dd2870faa1a4b8e0a275cbc"), nil),
70 var mockTransaction = []*tx{}
71 var mockBlocks = []*block{}
73 func toHash(hash string) bc.Hash {
75 sourceID.UnmarshalText([]byte(hash))
79 func toAssetID(assetID string) bc.AssetID {
81 if err := asset.UnmarshalText([]byte(assetID)); err != nil {
93 mockTransaction = []*tx{}
95 Tx: types.NewTx(types.TxData{
96 Inputs: []*types.TxInput{
97 types.NewSpendInput(nil, toHash("ca9b179e549406aa583869e124e39817414d4500a8ce5476e95b6018d182b966"), *consensus.BTMAssetID, 41250000000, 0, []byte("00144431c4278632c6e35dd2870faa1a4b8e0a275cbc"), nil),
99 Outputs: []*types.TxOutput{
100 types.NewOriginalTxOutput(*consensus.BTMAssetID, 100000000, []byte("00148c704747e94387fa0b8712b053ed2132d84820ac"), nil),
101 types.NewOriginalTxOutput(*consensus.BTMAssetID, 41150000000, []byte("00144431c4278632c6e35dd2870faa1a4b8e0a275cbc"), nil),
105 mockTransaction = append(mockTransaction, t)
109 Tx: types.NewTx(types.TxData{
110 Inputs: []*types.TxInput{
111 types.NewSpendInput(nil, *mockTransaction[0].getSourceID(1), *consensus.BTMAssetID, 41150000000, 1, []byte("00144431c4278632c6e35dd2870faa1a4b8e0a275cbc"), nil),
113 Outputs: []*types.TxOutput{
114 types.NewOriginalTxOutput(*consensus.BTMAssetID, 100000000, []byte("00148c704747e94387fa0b8712b053ed2132d84820ac"), nil),
115 types.NewOriginalTxOutput(*consensus.BTMAssetID, 41050000000, []byte("00144431c4278632c6e35dd2870faa1a4b8e0a275cbc"), nil),
119 mockTransaction = append(mockTransaction, t)
123 Tx: types.NewTx(types.TxData{
124 Inputs: []*types.TxInput{
125 types.NewSpendInput(nil, *mockTransaction[1].getSourceID(1), *consensus.BTMAssetID, 41050000000, 1, []byte("00144431c4278632c6e35dd2870faa1a4b8e0a275cbc"), nil),
127 Outputs: []*types.TxOutput{
128 types.NewOriginalTxOutput(*consensus.BTMAssetID, 100000000, []byte("00148c704747e94387fa0b8712b053ed2132d84820ac"), nil),
129 types.NewOriginalTxOutput(*consensus.BTMAssetID, 40950000000, []byte("00144431c4278632c6e35dd2870faa1a4b8e0a275cbc"), nil),
133 mockTransaction = append(mockTransaction, t)
135 // 3: 00140b0c5059514c751a80c4e1c94f8ecfe16d80671b -> 0014b103d8f2dc10e7bbbe2557ff8b9876524dec0a7e
136 assetID := toAssetID("5c3b60753fe1f8321298d64ab3881b200fa1d7e56f1b2a2df587233c532c5eb6")
138 Tx: types.NewTx(types.TxData{
139 Inputs: []*types.TxInput{
140 types.NewSpendInput(nil, toHash("453936067da4be89a99bbd78aa8c7eb88cbe92ae0941e1013a58b8d6af65d344"), *consensus.BTMAssetID, 41250000000, 0, []byte("00140b0c5059514c751a80c4e1c94f8ecfe16d80671b"), nil),
141 types.NewSpendInput(nil, toHash("50d1c966b3a58f9092a696136a75ceb801ea7da2470784d80ebf3f17a76b8a98"), assetID, 800000000000, 0, []byte("00140b0c5059514c751a80c4e1c94f8ecfe16d80671b"), nil),
143 Outputs: []*types.TxOutput{
144 types.NewOriginalTxOutput(*consensus.BTMAssetID, 41150000000, []byte("0014b103d8f2dc10e7bbbe2557ff8b9876524dec0a7e"), nil),
145 types.NewOriginalTxOutput(*consensus.BTMAssetID, 100000000, []byte("00140b0c5059514c751a80c4e1c94f8ecfe16d80671b"), nil),
146 types.NewOriginalTxOutput(assetID, 700000000000, []byte("0014b103d8f2dc10e7bbbe2557ff8b9876524dec0a7e"), nil),
147 types.NewOriginalTxOutput(assetID, 100000000000, []byte("00140b0c5059514c751a80c4e1c94f8ecfe16d80671b"), nil),
151 mockTransaction = append(mockTransaction, t)
155 Tx: types.NewTx(types.TxData{
156 Inputs: []*types.TxInput{
157 types.NewSpendInput(nil, toHash("ca9b179e549406aa583869e124e39817514d4500a8ce5476e95b6018d182b966"), *consensus.BTMAssetID, 41250000000, 0, []byte("00142b248deeffe82f9cd94fab43849468e0dfe97806"), nil),
158 types.NewSpendInput(nil, toHash("d9a9b64e4f842060a40b15325d9aae61987776f7748e7e6a2887a474e84294ef"), assetID, 600000000000, 0, []byte("00142b248deeffe82f9cd94fab43849468e0dfe97806"), nil),
160 Outputs: []*types.TxOutput{
161 types.NewOriginalTxOutput(*consensus.BTMAssetID, 100000000, []byte("0014492d5b0f09f83bd9bff6a44514dcc9b11c091dce"), nil),
162 types.NewOriginalTxOutput(*consensus.BTMAssetID, 41150000000, []byte("00142b248deeffe82f9cd94fab43849468e0dfe97806"), nil),
163 types.NewOriginalTxOutput(assetID, 600000000000, []byte("0014492d5b0f09f83bd9bff6a44514dcc9b11c091dce"), nil),
164 types.NewOriginalTxOutput(assetID, 400000000000, []byte("00142b248deeffe82f9cd94fab43849468e0dfe97806"), nil),
168 mockTransaction = append(mockTransaction, t)
170 // 5: 0014b103d8f2dc10e7bbbe2557ff8b9876524dec0a7e -> 00142b248deeffe82f9cd94fab43849468e0dfe97806
172 Tx: types.NewTx(types.TxData{
173 Inputs: []*types.TxInput{
174 types.NewSpendInput(nil, toHash("ca9b179e549406aa583869e124e39817514d4500a8ce5476e95b6018d182b966"), *consensus.BTMAssetID, 41150000000, 1, []byte("0014b103d8f2dc10e7bbbe2557ff8b9876524dec0a7e"), nil),
175 types.NewSpendInput(nil, toHash("466e6a9261d7b51f227d6c05b7cd3cc36487cc6f0cfb79c58794021e68d4c877"), assetID, 300000000000, 0, []byte("0014b103d8f2dc10e7bbbe2557ff8b9876524dec0a7e"), nil),
177 Outputs: []*types.TxOutput{
178 types.NewOriginalTxOutput(*consensus.BTMAssetID, 41050000000, []byte("00142b248deeffe82f9cd94fab43849468e0dfe97806"), nil),
179 types.NewOriginalTxOutput(*consensus.BTMAssetID, 100000000, []byte("0014b103d8f2dc10e7bbbe2557ff8b9876524dec0a7e"), nil),
180 types.NewOriginalTxOutput(assetID, 200000000000, []byte("00142b248deeffe82f9cd94fab43849468e0dfe97806"), nil),
181 types.NewOriginalTxOutput(assetID, 100000000000, []byte("0014b103d8f2dc10e7bbbe2557ff8b9876524dec0a7e"), nil),
185 mockTransaction = append(mockTransaction, t)
187 //6: 00142b248deeffe82f9cd94fab43849468e0dfe97806 -> 0014492d5b0f09f83bd9bff6a44514dcc9b11c091dce
189 Tx: types.NewTx(types.TxData{
190 Inputs: []*types.TxInput{
191 types.NewSpendInput(nil, toHash("ca9b179e549406aa583869e124e39817514d4500a8ce5476e95b6018d182b966"), *consensus.BTMAssetID, 41050000000, 2, []byte("00142b248deeffe82f9cd94fab43849468e0dfe97806"), nil),
192 types.NewSpendInput(nil, toHash("e5757774fb46287ebda3479e19c8643d2fcdb5de3b1ac84d4020c1971bb3f531"), assetID, 100000000000, 0, []byte("00142b248deeffe82f9cd94fab43849468e0dfe97806"), nil),
194 Outputs: []*types.TxOutput{
195 types.NewOriginalTxOutput(*consensus.BTMAssetID, 40950000000, []byte("0014492d5b0f09f83bd9bff6a44514dcc9b11c091dce"), nil),
196 types.NewOriginalTxOutput(*consensus.BTMAssetID, 100000000, []byte("00142b248deeffe82f9cd94fab43849468e0dfe97806"), nil),
197 types.NewOriginalTxOutput(assetID, 50000000000, []byte("0014492d5b0f09f83bd9bff6a44514dcc9b11c091dce"), nil),
198 types.NewOriginalTxOutput(assetID, 50000000000, []byte("00142b248deeffe82f9cd94fab43849468e0dfe97806"), nil),
202 mockTransaction = append(mockTransaction, t)
204 // 7: 0014492d5b0f09f83bd9bff6a44514dcc9b11c091dce -> 0014e3bb841fb722d1840a959d86e12a174c54a3a6e8
206 Tx: types.NewTx(types.TxData{
207 Inputs: []*types.TxInput{
208 types.NewSpendInput(nil, toHash("ca9b179e549406aa583869e124e39817514d4500a8ce5476e95b6018d182b966"), *consensus.BTMAssetID, 40950000000, 3, []byte("0014492d5b0f09f83bd9bff6a44514dcc9b11c091dce"), nil),
210 Outputs: []*types.TxOutput{
211 types.NewOriginalTxOutput(*consensus.BTMAssetID, 40850000000, []byte("0014e3bb841fb722d1840a959d86e12a174c54a3a6e8"), nil),
212 types.NewOriginalTxOutput(*consensus.BTMAssetID, 100000000, []byte("0014492d5b0f09f83bd9bff6a44514dcc9b11c091dce"), nil),
216 mockTransaction = append(mockTransaction, t)
218 // 8: 0014e3bb841fb722d1840a959d86e12a174c54a3a6e8 -> 001449601d4cfb6e7a1b990778497b3c364f66bc17d2
220 Tx: types.NewTx(types.TxData{
221 Inputs: []*types.TxInput{
222 types.NewSpendInput(nil, toHash("ca9b179e549406aa583869e124e39817514d4500a8ce5476e95b6018d182b966"), *consensus.BTMAssetID, 40850000000, 4, []byte("0014e3bb841fb722d1840a959d86e12a174c54a3a6e8"), nil),
224 Outputs: []*types.TxOutput{
225 types.NewOriginalTxOutput(*consensus.BTMAssetID, 40750000000, []byte("001449601d4cfb6e7a1b990778497b3c364f66bc17d2"), nil),
226 types.NewOriginalTxOutput(*consensus.BTMAssetID, 100000000, []byte("0014e3bb841fb722d1840a959d86e12a174c54a3a6e8"), nil),
230 mockTransaction = append(mockTransaction, t)
232 // 9: 001449601d4cfb6e7a1b990778497b3c364f66bc17d2 -> 0014bd3d70b1bcd62ece61c06a2fe097a4732e5f006b
234 Tx: types.NewTx(types.TxData{
235 Inputs: []*types.TxInput{
236 types.NewSpendInput(nil, toHash("ca9b179e549406aa583869e124e39817514d4500a8ce5476e95b6018d182b966"), *consensus.BTMAssetID, 40750000000, 5, []byte("001449601d4cfb6e7a1b990778497b3c364f66bc17d2"), nil),
238 Outputs: []*types.TxOutput{
239 types.NewOriginalTxOutput(*consensus.BTMAssetID, 40650000000, []byte("0014bd3d70b1bcd62ece61c06a2fe097a4732e5f006b"), nil),
240 types.NewOriginalTxOutput(*consensus.BTMAssetID, 100000000, []byte("001449601d4cfb6e7a1b990778497b3c364f66bc17d2"), nil),
244 mockTransaction = append(mockTransaction, t)
246 // 10: 0014bd3d70b1bcd62ece61c06a2fe097a4732e5f006b -> 0014e809cb6f328db1e624821dec508cbe08fe1ed08d
248 Tx: types.NewTx(types.TxData{
249 Inputs: []*types.TxInput{
250 types.NewSpendInput(nil, toHash("ca9b179e549406aa583869e124e39817514d4500a8ce5476e95b6018d182b966"), *consensus.BTMAssetID, 40650000000, 6, []byte("0014bd3d70b1bcd62ece61c06a2fe097a4732e5f006b"), nil),
252 Outputs: []*types.TxOutput{
253 types.NewOriginalTxOutput(*consensus.BTMAssetID, 40550000000, []byte("0014e809cb6f328db1e624821dec508cbe08fe1ed08d"), nil),
254 types.NewOriginalTxOutput(*consensus.BTMAssetID, 100000000, []byte("0014bd3d70b1bcd62ece61c06a2fe097a4732e5f006b"), nil),
258 mockTransaction = append(mockTransaction, t)
261 // 11: 0014b103d8f2dc10e7bbbe2557ff8b9876524dec0a7e -> 00142b248deeffe82f9cd94fab43849468e0dfe97806
263 Tx: types.NewTx(types.TxData{
264 Inputs: []*types.TxInput{
265 types.NewSpendInput(nil, *mockTransaction[3].getSourceID(0), *consensus.BTMAssetID, 41150000000, 0, []byte("0014b103d8f2dc10e7bbbe2557ff8b9876524dec0a7e"), nil),
267 Outputs: []*types.TxOutput{
268 types.NewOriginalTxOutput(*consensus.BTMAssetID, 41050000000, []byte("00142b248deeffe82f9cd94fab43849468e0dfe97806"), nil),
269 types.NewOriginalTxOutput(*consensus.BTMAssetID, 100000000, []byte("0014b103d8f2dc10e7bbbe2557ff8b9876524dec0a7e"), nil),
273 mockTransaction = append(mockTransaction, t)
275 //12: 00142b248deeffe82f9cd94fab43849468e0dfe97806 -> 0014492d5b0f09f83bd9bff6a44514dcc9b11c091dce
277 Tx: types.NewTx(types.TxData{
278 Inputs: []*types.TxInput{
279 types.NewSpendInput(nil, *mockTransaction[11].getSourceID(0), *consensus.BTMAssetID, 41050000000, 0, []byte("00142b248deeffe82f9cd94fab43849468e0dfe97806"), nil),
281 Outputs: []*types.TxOutput{
282 types.NewOriginalTxOutput(*consensus.BTMAssetID, 40950000000, []byte("0014492d5b0f09f83bd9bff6a44514dcc9b11c091dce"), nil),
283 types.NewOriginalTxOutput(*consensus.BTMAssetID, 100000000, []byte("00142b248deeffe82f9cd94fab43849468e0dfe97806"), nil),
287 mockTransaction = append(mockTransaction, t)
289 // 13: 0014492d5b0f09f83bd9bff6a44514dcc9b11c091dce -> 0014e3bb841fb722d1840a959d86e12a174c54a3a6e8
291 Tx: types.NewTx(types.TxData{
292 Inputs: []*types.TxInput{
293 types.NewSpendInput(nil, *mockTransaction[12].getSourceID(0), *consensus.BTMAssetID, 40950000000, 0, []byte("0014492d5b0f09f83bd9bff6a44514dcc9b11c091dce"), nil),
295 Outputs: []*types.TxOutput{
296 types.NewOriginalTxOutput(*consensus.BTMAssetID, 40850000000, []byte("0014e3bb841fb722d1840a959d86e12a174c54a3a6e8"), nil),
297 types.NewOriginalTxOutput(*consensus.BTMAssetID, 100000000, []byte("0014492d5b0f09f83bd9bff6a44514dcc9b11c091dce"), nil),
301 mockTransaction = append(mockTransaction, t)
303 // 14: 0014e3bb841fb722d1840a959d86e12a174c54a3a6e8 -> 001449601d4cfb6e7a1b990778497b3c364f66bc17d2
305 Tx: types.NewTx(types.TxData{
306 Inputs: []*types.TxInput{
307 types.NewSpendInput(nil, *mockTransaction[13].getSourceID(0), *consensus.BTMAssetID, 40850000000, 0, []byte("0014e3bb841fb722d1840a959d86e12a174c54a3a6e8"), nil),
309 Outputs: []*types.TxOutput{
310 types.NewOriginalTxOutput(*consensus.BTMAssetID, 40750000000, []byte("001449601d4cfb6e7a1b990778497b3c364f66bc17d2"), nil),
311 types.NewOriginalTxOutput(*consensus.BTMAssetID, 100000000, []byte("0014e3bb841fb722d1840a959d86e12a174c54a3a6e8"), nil),
315 mockTransaction = append(mockTransaction, t)
317 // 15: 001449601d4cfb6e7a1b990778497b3c364f66bc17d2 -> 0014bd3d70b1bcd62ece61c06a2fe097a4732e5f006b
319 Tx: types.NewTx(types.TxData{
320 Inputs: []*types.TxInput{
321 types.NewSpendInput(nil, *mockTransaction[14].getSourceID(0), *consensus.BTMAssetID, 40750000000, 0, []byte("001449601d4cfb6e7a1b990778497b3c364f66bc17d2"), nil),
323 Outputs: []*types.TxOutput{
324 types.NewOriginalTxOutput(*consensus.BTMAssetID, 40650000000, []byte("0014bd3d70b1bcd62ece61c06a2fe097a4732e5f006b"), nil),
325 types.NewOriginalTxOutput(*consensus.BTMAssetID, 100000000, []byte("001449601d4cfb6e7a1b990778497b3c364f66bc17d2"), nil),
329 mockTransaction = append(mockTransaction, t)
331 // 16: 0014bd3d70b1bcd62ece61c06a2fe097a4732e5f006b -> 0014e809cb6f328db1e624821dec508cbe08fe1ed08d
333 Tx: types.NewTx(types.TxData{
334 Inputs: []*types.TxInput{
335 types.NewSpendInput(nil, *mockTransaction[15].getSourceID(0), *consensus.BTMAssetID, 40650000000, 0, []byte("0014bd3d70b1bcd62ece61c06a2fe097a4732e5f006b"), nil),
337 Outputs: []*types.TxOutput{
338 types.NewOriginalTxOutput(*consensus.BTMAssetID, 40550000000, []byte("0014e809cb6f328db1e624821dec508cbe08fe1ed08d"), nil),
339 types.NewOriginalTxOutput(*consensus.BTMAssetID, 100000000, []byte("0014bd3d70b1bcd62ece61c06a2fe097a4732e5f006b"), nil),
343 mockTransaction = append(mockTransaction, t)
345 mockBlocks = []*block{
347 &block{Block: types.Block{
348 BlockHeader: types.BlockHeader{
350 PreviousBlockHash: testutil.MustDecodeHash("0ab29c0bd7bff3b3b7eb98802f8d5f8833884c86c0fb21559a65cc58dda99667"),
351 Timestamp: 1522908275,
353 Transactions: []*types.Tx{
354 coinBaseTx(41250000000, "arbitrary block0"),
359 &block{Block: types.Block{
360 BlockHeader: types.BlockHeader{
362 PreviousBlockHash: testutil.MustDecodeHash("0ab29c0bd7bff3b3b7eb98802f8d5f8833884c86c0fb21559a65cc58dda99667"),
363 Timestamp: 1522908275,
365 Transactions: []*types.Tx{
366 coinBaseTx(41250000000, "arbitrary block1"),
367 mockTransaction[0].Tx,
368 mockTransaction[1].Tx,
369 mockTransaction[2].Tx,
373 // detach block 1, attach block 2
374 &block{Block: types.Block{
375 BlockHeader: types.BlockHeader{
377 PreviousBlockHash: testutil.MustDecodeHash("0ab29c0bd7bff3b3b7eb98802f8d5f8833884c86c0fb21559a65cc58dda99667"),
378 Timestamp: 1522908275,
380 Transactions: []*types.Tx{
381 coinBaseTx(41250000000, "arbitrary block2"),
382 mockTransaction[0].Tx,
386 &block{Block: types.Block{
387 BlockHeader: types.BlockHeader{
389 PreviousBlockHash: testutil.MustDecodeHash("0ab29c0bd7bff3b3b7eb98802f8d5f8833884c86c0fb21559a65cc58dda99667"),
390 Timestamp: 1522908275,
392 Transactions: []*types.Tx{
393 coinBaseTx(41250000000, "arbitrary block3"),
394 mockTransaction[0].Tx,
398 &block{Block: types.Block{
399 BlockHeader: types.BlockHeader{
401 PreviousBlockHash: testutil.MustDecodeHash("0ab29c0bd7bff3b3b7eb98802f8d5f8833884c86c0fb21559a65cc58dda99667"),
402 Timestamp: 1522908275,
404 Transactions: []*types.Tx{
405 coinBaseTx(41250000000, "arbitrary block4"),
406 mockTransaction[1].Tx,
410 // detach block 5, attach block 2
411 &block{Block: types.Block{
412 BlockHeader: types.BlockHeader{
414 PreviousBlockHash: testutil.MustDecodeHash("0ab29c0bd7bff3b3b7eb98802f8d5f8833884c86c0fb21559a65cc58dda99667"),
415 Timestamp: 1522908275,
417 Transactions: []*types.Tx{
418 coinBaseTx(41250000000, "arbitrary block5"),
419 mockTransaction[2].Tx,
422 &block{Block: types.Block{
423 BlockHeader: types.BlockHeader{
425 PreviousBlockHash: testutil.MustDecodeHash("0ab29c0bd7bff3b3b7eb98802f8d5f8833884c86c0fb21559a65cc58dda99667"),
426 Timestamp: 1522908275,
428 Transactions: []*types.Tx{
429 coinBaseTx(41250000000, "arbitrary block6"),
430 mockTransaction[3].Tx,
431 mockTransaction[4].Tx,
434 &block{Block: types.Block{
435 BlockHeader: types.BlockHeader{
437 PreviousBlockHash: testutil.MustDecodeHash("0ab29c0bd7bff3b3b7eb98802f8d5f8833884c86c0fb21559a65cc58dda99667"),
438 Timestamp: 1522908275,
440 Transactions: []*types.Tx{
441 coinBaseTx(41250000000, "arbitrary block7"),
442 mockTransaction[5].Tx,
445 &block{Block: types.Block{
446 BlockHeader: types.BlockHeader{
448 PreviousBlockHash: testutil.MustDecodeHash("0ab29c0bd7bff3b3b7eb98802f8d5f8833884c86c0fb21559a65cc58dda99667"),
449 Timestamp: 1522908275,
451 Transactions: []*types.Tx{
452 coinBaseTx(41250000000, "arbitrary block8"),
453 mockTransaction[6].Tx,
454 mockTransaction[7].Tx,
455 mockTransaction[8].Tx,
458 &block{Block: types.Block{
459 BlockHeader: types.BlockHeader{
461 PreviousBlockHash: testutil.MustDecodeHash("0ab29c0bd7bff3b3b7eb98802f8d5f8833884c86c0fb21559a65cc58dda99667"),
462 Timestamp: 1522908275,
464 Transactions: []*types.Tx{
465 coinBaseTx(41250000000, "arbitrary block9"),
466 mockTransaction[9].Tx,
470 // detach block 5, attach block 2. Chain trading
471 &block{Block: types.Block{
472 BlockHeader: types.BlockHeader{
474 PreviousBlockHash: testutil.MustDecodeHash("0ab29c0bd7bff3b3b7eb98802f8d5f8833884c86c0fb21559a65cc58dda99667"),
475 Timestamp: 1522908275,
477 Transactions: []*types.Tx{
478 coinBaseTx(41250000000, "arbitrary block10"),
479 mockTransaction[2].Tx,
480 mockTransaction[3].Tx,
481 mockTransaction[4].Tx,
482 mockTransaction[5].Tx,
483 mockTransaction[6].Tx,
487 &block{Block: types.Block{
488 BlockHeader: types.BlockHeader{
490 PreviousBlockHash: testutil.MustDecodeHash("0ab29c0bd7bff3b3b7eb98802f8d5f8833884c86c0fb21559a65cc58dda99667"),
491 Timestamp: 1522908275,
493 Transactions: []*types.Tx{
494 coinBaseTx(41250000000, "arbitrary block11"),
495 mockTransaction[7].Tx,
496 mockTransaction[8].Tx,
497 mockTransaction[9].Tx,
501 // detach block 2, attach block 1. Chain trading
502 &block{Block: types.Block{
503 BlockHeader: types.BlockHeader{
505 PreviousBlockHash: testutil.MustDecodeHash("0ab29c0bd7bff3b3b7eb98802f8d5f8833884c86c0fb21559a65cc58dda99667"),
506 Timestamp: 1522908275,
508 Transactions: []*types.Tx{
509 coinBaseTx(41250000000, "arbitrary block12"),
510 mockTransaction[11].Tx,
511 mockTransaction[12].Tx,
512 mockTransaction[13].Tx,
513 mockTransaction[14].Tx,
516 &block{Block: types.Block{
517 BlockHeader: types.BlockHeader{
519 PreviousBlockHash: testutil.MustDecodeHash("0ab29c0bd7bff3b3b7eb98802f8d5f8833884c86c0fb21559a65cc58dda99667"),
520 Timestamp: 1522908275,
522 Transactions: []*types.Tx{
523 coinBaseTx(41250000000, "arbitrary block13"),
524 mockTransaction[15].Tx,
525 mockTransaction[16].Tx,
529 &block{Block: types.Block{
530 BlockHeader: types.BlockHeader{
532 PreviousBlockHash: testutil.MustDecodeHash("0ab29c0bd7bff3b3b7eb98802f8d5f8833884c86c0fb21559a65cc58dda99667"),
533 Timestamp: 1522908275,
535 Transactions: []*types.Tx{
536 coinBaseTx(41250000000, "arbitrary block14"),