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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
crate::ix!();

//-------------------------------------------[.cpp/bitcoin/src/chainparams.h]
//-------------------------------------------[.cpp/bitcoin/src/chainparams.cpp]

/**
  | Holds various statistics on transactions
  | within a chain. Used to estimate verification
  | progress during chain sync.
  | 
  | See also: CChainParams::TxData,
  | 
  | GuessVerificationProgress.
  |
  */
#[derive(Default)]
pub struct ChainTxData {

    /**
      | UNIX timestamp of last known number
      | of transactions
      |
      */
    n_time:     i64,

    /**
      | total number of transactions between
      | genesis and that timestamp
      |
      */
    n_tx_count: i64,

    /**
      | estimated number of transactions per
      | second after that timestamp
      |
      */
    d_tx_rate:  f64,
}

/**
  | ChainParams defines various tweakable
  | parameters of a given instance of the
  | Bitcoin system.
  |
  */
#[derive(Default)]
pub struct ChainParams {
    consensus:                  ChainConsensusParams,
    pch_message_start:          MessageHeaderMessageStartChars,
    n_default_port:             u16,
    n_prune_after_height:       u64,
    assumed_blockchain_size:    u64,
    assumed_chain_state_size:   u64,
    seeds:                      Vec<String>,
    base_58prefixes:            [Vec<u8>; chain_params::Base58Type::MAX_BASE58_TYPES as usize],
    bech32_hrp:                 String,
    str_networkid:              String,
    genesis:                    Block,
    fixed_seeds:                Vec<u8>,
    default_consistency_checks: bool,
    require_standard:           bool,
    is_test_chain:              bool,
    is_mockable_chain:          bool,
    checkpoint_data:            CheckpointData,
    assumeutxo_data:            MapAssumeUtxo,
    chain_tx_data:              ChainTxData,
}

pub mod chain_params {

    #[repr(usize)]
    pub enum Base58Type {
        PUBKEY_ADDRESS,
        SCRIPT_ADDRESS,
        SECRET_KEY,
        EXT_PUBLIC_KEY,
        EXT_SECRET_KEY,
        MAX_BASE58_TYPES
    }
}

impl ChainParams {

    pub fn get_consensus(&self) -> Arc<ChainConsensusParams> {
        
        todo!();
        /*
            return consensus;
        */
    }
    
    pub fn message_start(&self) -> &MessageHeaderMessageStartChars {
        
        todo!();
        /*
            return pchMessageStart;
        */
    }
    
    pub fn get_default_port(&self) -> u16 {
        
        todo!();
        /*
            return nDefaultPort;
        */
    }
    
    pub fn get_default_port_with_network(&self, net: Network) -> u16 {
        
        todo!();
        /*
            return net == NET_I2P ? I2P_SAM31_PORT : GetDefaultPort();
        */
    }
    
    pub fn get_default_port_from_addr(&self, addr: &String) -> u16 {
        
        todo!();
        /*
            CNetAddr a;
            return a.SetSpecial(addr) ? GetDefaultPort(a.GetNetwork()) : GetDefaultPort();
        */
    }
    
    pub fn genesis_block(&self) -> &Block {
        
        todo!();
        /*
            return genesis;
        */
    }

    /**
      | Default value for -checkmempool and
      | -checkblockindex argument
      |
      */
    pub fn default_consistency_checks(&self) -> bool {
        
        todo!();
        /*
            return fDefaultConsistencyChecks;
        */
    }

    /**
      | Policy: Filter transactions that do
      | not match well-defined patterns
      |
      */
    pub fn require_standard(&self) -> bool {
        
        todo!();
        /*
            return fRequireStandard;
        */
    }

    /**
      | If this chain is exclusively used for
      | testing
      |
      */
    pub fn is_test_chain(&self) -> bool {
        
        todo!();
        /*
            return m_is_test_chain;
        */
    }

    /**
      | If this chain allows time to be mocked
      |
      */
    pub fn is_mockable_chain(&self) -> bool {
        
        todo!();
        /*
            return m_is_mockable_chain;
        */
    }
    
    pub fn prune_after_height(&self) -> u64 {
        
        todo!();
        /*
            return nPruneAfterHeight;
        */
    }

    /**
      | Minimum free space (in GB) needed for
      | data directory
      |
      */
    pub fn assumed_blockchain_size(&self) -> u64 {
        
        todo!();
        /*
            return m_assumed_blockchain_size;
        */
    }

    /**
      | Minimum free space (in GB) needed for
      | data directory when pruned; Does not
      | include prune target
      |
      */
    pub fn assumed_chain_state_size(&self) -> u64 {
        
        todo!();
        /*
            return m_assumed_chain_state_size;
        */
    }

    /**
      | Whether it is possible to mine blocks
      | on demand (no retargeting)
      |
      */
    pub fn mine_blocks_on_demand(&self) -> bool {
        
        todo!();
        /*
            return consensus.fPowNoRetargeting;
        */
    }

    /**
      | Return the network string
      |
      */
    pub fn network_id_string(&self) -> String {
        
        todo!();
        /*
            return strNetworkID;
        */
    }

    /**
      | Return the list of hostnames to look
      | up for DNS seeds
      |
      */
    pub fn dns_seeds(&self) -> &Vec<String> {
        
        todo!();
        /*
            return vSeeds;
        */
    }
    
    pub fn base_58prefix(&self, ty: chain_params::Base58Type) -> &Vec<u8> {
        
        todo!();
        /*
            return base58Prefixes[type];
        */
    }
    
    pub fn bech32hrp(&self) -> &String {
        
        todo!();
        /*
            return bech32_hrp;
        */
    }
    
    pub fn fixed_seeds(&self) -> &Vec<u8> {
        
        todo!();
        /*
            return vFixedSeeds;
        */
    }
    
    pub fn checkpoints(&self) -> &CheckpointData {
        
        todo!();
        /*
            return checkpointData;
        */
    }

    /**
      | Get allowed assumeutxo configuration.
      | @see ChainstateManager
      |
      */
    pub fn assumeutxo(&self) -> &MapAssumeUtxo {
        
        todo!();
        /*
            return m_assumeutxo_data;
        */
    }
    
    pub fn tx_data(&self) -> &ChainTxData {
        
        todo!();
        /*
            return chainTxData;
        */
    }
}