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
crate::ix!();
/**
| Legacy class to deserialize pre-pertxout
| database entries without reindex.
|
*/
pub struct LegacyCoins {
/**
| whether transaction is a coinbase
|
*/
coin_base: bool,
/**
| unspent transaction outputs; spent
| outputs are .IsNull(); spent outputs
| at the end of the array are dropped
|
*/
vout: Vec<TxOut>,
/**
| at which height this transaction was
| included in the active block chain
|
*/
n_height: i32,
}
impl Default for LegacyCoins {
/**
| empty constructor
|
*/
fn default() -> Self {
todo!();
/*
: coin_base(false),
: vout(0),
: n_height(0),
*/
}
}
impl LegacyCoins {
pub fn unserialize<Stream>(&mut self, s: &mut Stream) {
todo!();
/*
unsigned int nCode = 0;
// version
unsigned int nVersionDummy;
::Unserialize(s, VARINT(nVersionDummy));
// header code
::Unserialize(s, VARINT(nCode));
fCoinBase = nCode & 1;
std::vector<bool> vAvail(2, false);
vAvail[0] = (nCode & 2) != 0;
vAvail[1] = (nCode & 4) != 0;
unsigned int nMaskCode = (nCode / 8) + ((nCode & 6) != 0 ? 0 : 1);
// spentness bitmask
while (nMaskCode > 0) {
unsigned char chAvail = 0;
::Unserialize(s, chAvail);
for (unsigned int p = 0; p < 8; p++) {
bool f = (chAvail & (1 << p)) != 0;
vAvail.push_back(f);
}
if (chAvail != 0)
nMaskCode--;
}
// txouts themself
vout.assign(vAvail.size(), CTxOut());
for (unsigned int i = 0; i < vAvail.size(); i++) {
if (vAvail[i])
::Unserialize(s, Using<TxOutCompression>(vout[i]));
}
// coinbase height
::Unserialize(s, VARINT_MODE(nHeight, VarIntMode::NONNEGATIVE_SIGNED));
*/
}
}