@@ -28,8 +28,7 @@ impl VirtualStateProcessor {
28
28
) -> Result < SignableTransaction , UtxoInquirerError > {
29
29
let retention_period_root_daa_score = self
30
30
. headers_store
31
- . get_compact_header_data ( retention_period_root_hash)
32
- . map ( |compact_header| compact_header. daa_score )
31
+ . get_daa_score ( retention_period_root_hash)
33
32
. map_err ( |_| UtxoInquirerError :: MissingCompactHeaderForBlockHash ( retention_period_root_hash) ) ?;
34
33
35
34
if accepting_block_daa_score < retention_period_root_daa_score {
@@ -94,11 +93,8 @@ impl VirtualStateProcessor {
94
93
. get_by_hash ( retention_period_root_hash)
95
94
. map_err ( |_| UtxoInquirerError :: MissingIndexForHash ( retention_period_root_hash) ) ?;
96
95
let ( tip_index, tip_hash) = sc_read. get_tip ( ) . map_err ( |_| UtxoInquirerError :: MissingTipData ) ?;
97
- let tip_daa_score = self
98
- . headers_store
99
- . get_compact_header_data ( tip_hash)
100
- . map ( |tip| tip. daa_score )
101
- . map_err ( |_| UtxoInquirerError :: MissingCompactHeaderForBlockHash ( tip_hash) ) ?;
96
+ let tip_daa_score =
97
+ self . headers_store . get_daa_score ( tip_hash) . map_err ( |_| UtxoInquirerError :: MissingCompactHeaderForBlockHash ( tip_hash) ) ?;
102
98
103
99
// For a chain segment it holds that len(segment) <= daa_score(segment end) - daa_score(segment start). This is true
104
100
// because each chain block increases the daa score by at least one. Hence we can lower bound our search by high index
@@ -117,14 +113,14 @@ impl VirtualStateProcessor {
117
113
UtxoInquirerError :: MissingHashAtIndex ( mid)
118
114
} ) ?;
119
115
120
- // 2. Get the compact header so we have access to the daa_score. Error if we cannot find the header
121
- let compact_header = self . headers_store . get_compact_header_data ( hash) . map_err ( |_| {
122
- trace ! ( "Did not find a compact header with hash {}" , hash) ;
116
+ // 2. Get the daa_score. Error if the header is not found
117
+ let daa_score = self . headers_store . get_daa_score ( hash) . map_err ( |_| {
118
+ trace ! ( "Did not find a header with hash {}" , hash) ;
123
119
UtxoInquirerError :: MissingCompactHeaderForBlockHash ( hash)
124
120
} ) ?;
125
121
126
122
// 3. Compare block daa score to our target
127
- match compact_header . daa_score . cmp ( & target_daa_score) {
123
+ match daa_score. cmp ( & target_daa_score) {
128
124
cmp:: Ordering :: Equal => {
129
125
// We found the chain block we need
130
126
break hash;
0 commit comments