@@ -10,29 +10,23 @@ import (
10
10
"io"
11
11
"math"
12
12
13
- "github.com/utreexo/utreexod/chaincfg/chainhash"
14
13
"github.com/utreexo/utreexod/wire"
15
14
)
16
15
17
- // proofStatsSize has 19 elements that are each 8 bytes big.
18
- const proofStatsSize int = 8 * 19
16
+ // proofStatsSize has 10 elements that are each 8 bytes big.
17
+ const proofStatsSize int = 8 * 10
19
18
20
19
// proofStats are the relevant proof statistics to check how big each proofs are.
21
20
type proofStats struct {
22
21
// The height of the chain for the below stats.
23
22
BlockHeight uint64
24
23
25
- // The overhead of the multi interval proof.
26
- MultiBlockProofOverheadSum float64
27
- MultiBlockProofCount uint64
28
-
29
24
// The overhead of the single interval proof.
30
25
BlockProofOverheadSum float64
31
26
BlockProofCount uint64
32
27
33
- // Total deletions vs the proven deletions by the multi-block proof.
34
- TotalDels uint64
35
- TotalProvenDels uint64
28
+ // Total deletions.
29
+ TotalDels uint64
36
30
37
31
// Size of all the leaf datas.
38
32
LdSize uint64
@@ -45,18 +39,6 @@ type proofStats struct {
45
39
// Size of all the proofs in the batchproofs.
46
40
ProofSize uint64
47
41
ProofCount uint64
48
-
49
- // Size of the multi-block targets.
50
- MbTgSize uint64
51
- MbTgCount uint64
52
-
53
- // Size of the multi-block proofs.
54
- MbProofSize uint64
55
- MbProofCount uint64
56
-
57
- // Size of the leafhashes for the multi-block proofs.
58
- MbHashSize uint64
59
- MbHashCount uint64
60
42
}
61
43
62
44
// UpdateTotalDelCount updates the deletion count in the proof stats.
@@ -86,40 +68,15 @@ func (ps *proofStats) UpdateUDStats(excludeAccProof bool, ud *wire.UData) {
86
68
ps .BlockProofOverheadSum += overhead
87
69
}
88
70
89
- // UpdateMultiUDStats updates the multi-block utreexo data statistics.
90
- func (ps * proofStats ) UpdateMultiUDStats (delCount int , multiUd * wire.UData ) {
91
- // Update target size.
92
- ps .MbTgSize += uint64 (wire .BatchProofSerializeTargetSize (& multiUd .AccProof ))
93
- ps .MbTgCount += uint64 (len (multiUd .AccProof .Targets ))
94
-
95
- // Update proof size.
96
- ps .MbProofSize += uint64 (wire .BatchProofSerializeAccProofSize (& multiUd .AccProof ))
97
- ps .MbProofCount += uint64 (len (multiUd .AccProof .Proof ))
98
-
99
- // Update multi-block proof overhead.
100
- overhead := calcProofOverhead (multiUd )
101
- ps .MultiBlockProofCount ++
102
- ps .MultiBlockProofOverheadSum += overhead
103
-
104
- // Update the multi-block proof hash size.
105
- ps .MbHashSize += uint64 (delCount * chainhash .HashSize )
106
- ps .MbHashCount += uint64 (delCount )
107
-
108
- // Update proven dels by the multi-block proofs.
109
- ps .TotalProvenDels += uint64 (delCount )
110
- }
111
-
112
71
// LogProofStats outputs a log of the proof statistics.
113
72
func (ps * proofStats ) LogProofStats () {
114
- log .Infof ("height %d: totalProvenPercentage %f, totalDels %d, totalProvenDels %d, ldSize %d, ldCount %d, tgSize %d, tgCount %d, proofSize %d, proofCount %d " +
115
- "mbTgSize %d, mbTgCount %d, mbProofSize %d, mbProofCount %d, mbHashSize %d, mbHashCount %d" ,
116
- ps .BlockHeight , float64 (ps .TotalProvenDels )/ float64 (ps .TotalDels ), ps .TotalDels , ps .TotalProvenDels , ps .LdSize , ps .LdCount , ps .TgSize , ps .TgCount ,
117
- ps .ProofSize , ps .ProofCount , ps .MbTgSize , ps .MbTgCount ,
118
- ps .MbProofSize , ps .MbProofCount , ps .MbHashSize , ps .MbHashCount )
119
-
120
- log .Infof ("height %d, average-blockoverhead %f, average-multiblockoverhead %f, blockoverhead-sum %f, blockcount %d, mboverhead-sum %f, mbCount %d" ,
121
- ps .BlockHeight , ps .BlockProofOverheadSum / float64 (ps .BlockProofCount ), ps .MultiBlockProofOverheadSum / float64 (ps .MultiBlockProofCount ),
122
- ps .BlockProofOverheadSum , ps .BlockProofCount , ps .MultiBlockProofOverheadSum , ps .MultiBlockProofCount )
73
+ log .Infof ("height %d: totalDels %d, ldSize %d, ldCount %d, tgSize %d, tgCount %d, proofSize %d, proofCount %d" ,
74
+ ps .BlockHeight , ps .TotalDels , ps .LdSize , ps .LdCount , ps .TgSize , ps .TgCount ,
75
+ ps .ProofSize , ps .ProofCount )
76
+
77
+ log .Infof ("height %d, average-blockoverhead %f, blockoverhead-sum %f, blockcount %d" ,
78
+ ps .BlockHeight , ps .BlockProofOverheadSum / float64 (ps .BlockProofCount ),
79
+ ps .BlockProofOverheadSum , ps .BlockProofCount )
123
80
}
124
81
125
82
// Serialize serializes the proof statistics into the writer.
@@ -133,18 +90,6 @@ func (ps *proofStats) Serialize(w io.Writer) error {
133
90
return err
134
91
}
135
92
136
- binary .BigEndian .PutUint64 (buf [:], math .Float64bits (ps .MultiBlockProofOverheadSum ))
137
- _ , err = w .Write (buf [:])
138
- if err != nil {
139
- return err
140
- }
141
-
142
- binary .BigEndian .PutUint64 (buf [:], ps .MultiBlockProofCount )
143
- _ , err = w .Write (buf [:])
144
- if err != nil {
145
- return err
146
- }
147
-
148
93
binary .BigEndian .PutUint64 (buf [:], math .Float64bits (ps .BlockProofOverheadSum ))
149
94
_ , err = w .Write (buf [:])
150
95
if err != nil {
@@ -163,12 +108,6 @@ func (ps *proofStats) Serialize(w io.Writer) error {
163
108
return err
164
109
}
165
110
166
- binary .BigEndian .PutUint64 (buf [:], ps .TotalProvenDels )
167
- _ , err = w .Write (buf [:])
168
- if err != nil {
169
- return err
170
- }
171
-
172
111
binary .BigEndian .PutUint64 (buf [:], ps .LdSize )
173
112
_ , err = w .Write (buf [:])
174
113
if err != nil {
@@ -205,42 +144,6 @@ func (ps *proofStats) Serialize(w io.Writer) error {
205
144
return err
206
145
}
207
146
208
- binary .BigEndian .PutUint64 (buf [:], ps .MbTgSize )
209
- _ , err = w .Write (buf [:])
210
- if err != nil {
211
- return err
212
- }
213
-
214
- binary .BigEndian .PutUint64 (buf [:], ps .MbTgCount )
215
- _ , err = w .Write (buf [:])
216
- if err != nil {
217
- return err
218
- }
219
-
220
- binary .BigEndian .PutUint64 (buf [:], ps .MbProofSize )
221
- _ , err = w .Write (buf [:])
222
- if err != nil {
223
- return err
224
- }
225
-
226
- binary .BigEndian .PutUint64 (buf [:], ps .MbProofCount )
227
- _ , err = w .Write (buf [:])
228
- if err != nil {
229
- return err
230
- }
231
-
232
- binary .BigEndian .PutUint64 (buf [:], ps .MbHashSize )
233
- _ , err = w .Write (buf [:])
234
- if err != nil {
235
- return err
236
- }
237
-
238
- binary .BigEndian .PutUint64 (buf [:], ps .MbHashCount )
239
- _ , err = w .Write (buf [:])
240
- if err != nil {
241
- return err
242
- }
243
-
244
147
return nil
245
148
}
246
149
@@ -255,19 +158,6 @@ func (ps *proofStats) Deserialize(r io.Reader) error {
255
158
}
256
159
ps .BlockHeight = binary .BigEndian .Uint64 (buf [:])
257
160
258
- _ , err = r .Read (buf [:])
259
- if err != nil {
260
- return err
261
- }
262
- res = binary .BigEndian .Uint64 (buf [:])
263
- ps .MultiBlockProofOverheadSum = math .Float64frombits (res )
264
-
265
- _ , err = r .Read (buf [:])
266
- if err != nil {
267
- return err
268
- }
269
- ps .MultiBlockProofCount = binary .BigEndian .Uint64 (buf [:])
270
-
271
161
_ , err = r .Read (buf [:])
272
162
if err != nil {
273
163
return err
@@ -287,12 +177,6 @@ func (ps *proofStats) Deserialize(r io.Reader) error {
287
177
}
288
178
ps .TotalDels = binary .BigEndian .Uint64 (buf [:])
289
179
290
- _ , err = r .Read (buf [:])
291
- if err != nil {
292
- return err
293
- }
294
- ps .TotalProvenDels = binary .BigEndian .Uint64 (buf [:])
295
-
296
180
_ , err = r .Read (buf [:])
297
181
if err != nil {
298
182
return err
@@ -329,42 +213,6 @@ func (ps *proofStats) Deserialize(r io.Reader) error {
329
213
}
330
214
ps .ProofCount = binary .BigEndian .Uint64 (buf [:])
331
215
332
- _ , err = r .Read (buf [:])
333
- if err != nil {
334
- return err
335
- }
336
- ps .MbTgSize = binary .BigEndian .Uint64 (buf [:])
337
-
338
- _ , err = r .Read (buf [:])
339
- if err != nil {
340
- return err
341
- }
342
- ps .MbTgCount = binary .BigEndian .Uint64 (buf [:])
343
-
344
- _ , err = r .Read (buf [:])
345
- if err != nil {
346
- return err
347
- }
348
- ps .MbProofSize = binary .BigEndian .Uint64 (buf [:])
349
-
350
- _ , err = r .Read (buf [:])
351
- if err != nil {
352
- return err
353
- }
354
- ps .MbProofCount = binary .BigEndian .Uint64 (buf [:])
355
-
356
- _ , err = r .Read (buf [:])
357
- if err != nil {
358
- return err
359
- }
360
- ps .MbHashSize = binary .BigEndian .Uint64 (buf [:])
361
-
362
- _ , err = r .Read (buf [:])
363
- if err != nil {
364
- return err
365
- }
366
- ps .MbHashCount = binary .BigEndian .Uint64 (buf [:])
367
-
368
216
return nil
369
217
}
370
218
0 commit comments