/
dbtestdata.go
254 lines (245 loc) · 6.42 KB
/
dbtestdata.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
package dbtestdata
import (
"blockbook/bchain"
"encoding/hex"
"math/big"
"github.com/golang/glog"
)
const (
TxidB1T1 = "00b2c06055e5e90e9c82bd4181fde310104391a7fa4f289b1704e5d90caa3840"
TxidB1T2 = "effd9ef509383d536b1c8af5bf434c8efbf521a4f2befd4022bbd68694b4ac75"
TxidB2T1 = "7c3be24063f268aaa1ed81b64776798f56088757641a34fb156c4f51ed2e9d25"
TxidB2T2 = "3d90d15ed026dc45e19ffb52875ed18fa9e8012ad123d7f7212176e2b0ebdb71"
TxidB2T3 = "05e2e48aeabdd9b75def7b48d756ba304713c2aba7b522bf9dbc893fc4231b07"
TxidB2T4 = "fdd824a780cbb718eeb766eb05d83fdefc793a27082cd5e67f856d69798cf7db"
Xpub = "upub5E1xjDmZ7Hhej6LPpS8duATdKXnRYui7bDYj6ehfFGzWDZtmCmQkZhc3Zb7kgRLtHWd16QFxyP86JKL3ShZEBFX88aciJ3xyocuyhZZ8g6q"
Addr1 = "mfcWp7DB6NuaZsExybTTXpVgWz559Np4Ti" // 76a914010d39800f86122416e28f485029acf77507169288ac
Addr2 = "mtGXQvBowMkBpnhLckhxhbwYK44Gs9eEtz" // 76a9148bdf0aa3c567aa5975c2e61321b8bebbe7293df688ac
Addr3 = "mv9uLThosiEnGRbVPS7Vhyw6VssbVRsiAw" // 76a914a08eae93007f22668ab5e4a9c83c8cd1c325e3e088ac
Addr4 = "2MzmAKayJmja784jyHvRUW1bXPget1csRRG" // a91452724c5178682f70e0ba31c6ec0633755a3b41d987, xpub m/49'/1'/33'/0/0
Addr5 = "2NEVv9LJmAnY99W1pFoc5UJjVdypBqdnvu1" // a914e921fc4912a315078f370d959f2c4f7b6d2a683c87
Addr6 = "mzB8cYrfRwFRFAGTDzV8LkUQy5BQicxGhX" // 76a914ccaaaf374e1b06cb83118453d102587b4273d09588ac
Addr7 = "mtR97eM2HPWVM6c8FGLGcukgaHHQv7THoL" // 76a9148d802c045445df49613f6a70ddd2e48526f3701f88ac
Addr8 = "2N6utyMZfPNUb1Bk8oz7p2JqJrXkq83gegu" // a91495e9fbe306449c991d314afe3c3567d5bf78efd287, xpub m/49'/1'/33'/1/3
Addr9 = "mmJx9Y8ayz9h14yd9fgCW1bUKoEpkBAquP" // 76a9143f8ba3fda3ba7b69f5818086e12223c6dd25e3c888ac
AddrA = "mzVznVsCHkVHX9UN8WPFASWUUHtxnNn4Jj" // 76a914d03c0d863d189b23b061a95ad32940b65837609f88ac
)
var (
SatZero = big.NewInt(0)
SatB1T1A1 = big.NewInt(100000000)
SatB1T1A2 = big.NewInt(12345)
SatB1T2A3 = big.NewInt(1234567890123)
SatB1T2A4 = big.NewInt(1)
SatB1T2A5 = big.NewInt(9876)
SatB2T1A6 = big.NewInt(317283951061)
SatB2T1A7 = big.NewInt(917283951061)
SatB2T2A8 = big.NewInt(118641975500)
SatB2T2A9 = big.NewInt(198641975500)
SatB2T3A5 = big.NewInt(9000)
SatB2T4AA = big.NewInt(1360030331)
)
func AddressToPubKeyHex(addr string, parser bchain.BlockChainParser) string {
if addr == "" {
return ""
}
b, err := parser.GetAddrDescFromAddress(addr)
if err != nil {
glog.Fatal(err)
}
return hex.EncodeToString(b)
}
func GetTestBitcoinTypeBlock1(parser bchain.BlockChainParser) *bchain.Block {
return &bchain.Block{
BlockHeader: bchain.BlockHeader{
Height: 225493,
Hash: "0000000076fbbed90fd75b0e18856aa35baa984e9c9d444cf746ad85e94e2997",
Size: 1234567,
Time: 1534858021,
Confirmations: 2,
},
Txs: []bchain.Tx{
{
Txid: TxidB1T1,
Vin: []bchain.Vin{},
Vout: []bchain.Vout{
{
N: 0,
ScriptPubKey: bchain.ScriptPubKey{
Hex: AddressToPubKeyHex(Addr1, parser),
},
ValueSat: *SatB1T1A1,
},
{
N: 1,
ScriptPubKey: bchain.ScriptPubKey{
Hex: AddressToPubKeyHex(Addr2, parser),
},
ValueSat: *SatB1T1A2,
},
},
Blocktime: 22549300000,
Time: 22549300000,
Confirmations: 2,
},
{
Txid: TxidB1T2,
Vout: []bchain.Vout{
{
N: 0,
ScriptPubKey: bchain.ScriptPubKey{
Hex: AddressToPubKeyHex(Addr3, parser),
},
ValueSat: *SatB1T2A3,
},
{
N: 1,
ScriptPubKey: bchain.ScriptPubKey{
Hex: AddressToPubKeyHex(Addr4, parser),
},
ValueSat: *SatB1T2A4,
},
{
N: 2,
ScriptPubKey: bchain.ScriptPubKey{
Hex: AddressToPubKeyHex(Addr5, parser),
},
ValueSat: *SatB1T2A5,
},
},
Blocktime: 22549300001,
Time: 22549300001,
Confirmations: 2,
},
},
}
}
func GetTestBitcoinTypeBlock2(parser bchain.BlockChainParser) *bchain.Block {
return &bchain.Block{
BlockHeader: bchain.BlockHeader{
Height: 225494,
Hash: "00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6",
Size: 2345678,
Time: 1534859123,
Confirmations: 1,
},
Txs: []bchain.Tx{
{
Txid: TxidB2T1,
Vin: []bchain.Vin{
// addr3
{
Txid: TxidB1T2,
Vout: 0,
},
// addr2
{
Txid: TxidB1T1,
Vout: 1,
},
},
Vout: []bchain.Vout{
{
N: 0,
ScriptPubKey: bchain.ScriptPubKey{
Hex: AddressToPubKeyHex(Addr6, parser),
},
ValueSat: *SatB2T1A6,
},
{
N: 1,
ScriptPubKey: bchain.ScriptPubKey{
Hex: AddressToPubKeyHex(Addr7, parser),
},
ValueSat: *SatB2T1A7,
},
},
Blocktime: 22549400000,
Time: 22549400000,
Confirmations: 1,
},
{
Txid: TxidB2T2,
Vin: []bchain.Vin{
// spending an output in the same block - addr6
{
Txid: TxidB2T1,
Vout: 0,
},
// spending an output in the previous block - addr4
{
Txid: TxidB1T2,
Vout: 1,
},
},
Vout: []bchain.Vout{
{
N: 0,
ScriptPubKey: bchain.ScriptPubKey{
Hex: AddressToPubKeyHex(Addr8, parser),
},
ValueSat: *SatB2T2A8,
},
{
N: 1,
ScriptPubKey: bchain.ScriptPubKey{
Hex: AddressToPubKeyHex(Addr9, parser),
},
ValueSat: *SatB2T2A9,
},
},
Blocktime: 22549400001,
Time: 22549400001,
Confirmations: 1,
},
// transaction from the same address in the previous block
{
Txid: TxidB2T3,
Vin: []bchain.Vin{
// addr5
{
Txid: TxidB1T2,
Vout: 2,
},
},
Vout: []bchain.Vout{
{
N: 0,
ScriptPubKey: bchain.ScriptPubKey{
Hex: AddressToPubKeyHex(Addr5, parser),
},
ValueSat: *SatB2T3A5,
},
},
Blocktime: 22549400002,
Time: 22549400002,
Confirmations: 1,
},
// mining transaction
{
Txid: TxidB2T4,
Vin: []bchain.Vin{
{
Coinbase: "03bf1e1504aede765b726567696f6e312f50726f6a65637420425443506f6f6c2f01000001bf7e000000000000",
},
},
Vout: []bchain.Vout{
{
N: 0,
ScriptPubKey: bchain.ScriptPubKey{
Hex: AddressToPubKeyHex(AddrA, parser),
},
ValueSat: *SatB2T4AA,
},
{
N: 1,
ScriptPubKey: bchain.ScriptPubKey{},
ValueSat: *SatZero,
},
},
Blocktime: 22549400003,
Time: 22549400003,
Confirmations: 1,
},
},
}
}