@@ -105,6 +105,34 @@ metrics_write( fd_snapin_tile_t * ctx ) {
105
105
FD_MGAUGE_SET ( SNAPIN , STATE , (ulong )ctx -> state );
106
106
}
107
107
108
+ static void
109
+ calculate_lthash ( fd_snapin_tile_t * ctx ) {
110
+ fd_funk_all_iter_t iter [1 ];
111
+ for ( fd_funk_all_iter_new ( ctx -> funk , iter );
112
+ !fd_funk_all_iter_done ( iter );
113
+ fd_funk_all_iter_next ( iter ) ) {
114
+ fd_funk_rec_t const * rec = fd_funk_all_iter_ele_const ( iter );
115
+ if ( !fd_funk_key_is_acc ( rec -> pair .key ) || /* not a solana record */
116
+ (rec -> flags & FD_FUNK_REC_FLAG_ERASE ) || /* this is a tombstone */
117
+ (rec -> pair .xid -> ul [0 ] | rec -> pair .xid -> ul [1 ]) != 0 /* not root xid */ ) {
118
+ continue ;
119
+ }
120
+
121
+ fd_account_meta_t const * meta = fd_funk_val ( rec , fd_funk_wksp (ctx -> funk ) );
122
+ fd_lthash_value_t new_account_lthash [1 ];
123
+ fd_hashes_account_lthash ( fd_type_pun_const (rec -> pair .key -> uc ),
124
+ meta ,
125
+ fd_account_meta_get_data_const ( meta ),
126
+ new_account_lthash );
127
+ fd_lthash_add ( & ctx -> lthash_info .full .lthash , new_account_lthash );
128
+ }
129
+ if ( FD_UNLIKELY ( memcmp ( ctx -> lthash_info .full .lthash .bytes , ctx -> lthash_info .full .manifest_lthash .bytes , sizeof (fd_lthash_value_t ) ) ) ) {
130
+ FD_LOG_ERR (( "calculated accounts lthash %s does not match accounts lthash %s in snapshot manifest" ,
131
+ FD_LTHASH_ENC_32_ALLOCA ( & ctx -> lthash_info .full .lthash ),
132
+ FD_LTHASH_ENC_32_ALLOCA ( & ctx -> lthash_info .full .manifest_lthash ) ));
133
+ }
134
+ }
135
+
108
136
static void
109
137
manifest_cb ( void * _ctx ,
110
138
ulong manifest_sz ) {
@@ -138,19 +166,19 @@ is_duplicate_account( fd_snapin_tile_t * ctx,
138
166
/* TODO: Reaching here means the existing value is a duplicate
139
167
account. We need to hash the existing account and subtract that
140
168
hash from the running lthash. */
141
- fd_lthash_value_t old_account_lthash [1 ];
142
- fd_lthash_value_t * lthash = ctx -> full ? & ctx -> lthash_info .full .lthash : & ctx -> lthash_info .incremental .lthash ;
143
- fd_hashes_account_lthash ( (fd_pubkey_t * )account_pubkey ,
144
- rec_meta ,
145
- fd_account_meta_get_data_const ( rec_meta ),
146
- old_account_lthash );
147
- FD_LOG_WARNING (("subtracting old account hash %s for pubkey %s from lthash %s" ,
148
- FD_LTHASH_ENC_32_ALLOCA ( old_account_lthash ),
149
- FD_BASE58_ENC_32_ALLOCA ( (fd_pubkey_t * )account_pubkey ),
150
- FD_LTHASH_ENC_32_ALLOCA ( lthash )));
151
- fd_lthash_sub ( lthash , old_account_lthash );
152
- FD_LOG_WARNING (("resulting lthash %s" ,
153
- FD_LTHASH_ENC_32_ALLOCA ( lthash )));
169
+ // fd_lthash_value_t old_account_lthash[1];
170
+ // fd_lthash_value_t * lthash = ctx->full ? &ctx->lthash_info.full.lthash : &ctx->lthash_info.incremental.lthash;
171
+ // fd_hashes_account_lthash( (fd_pubkey_t*)account_pubkey,
172
+ // rec_meta,
173
+ // fd_account_meta_get_data_const( rec_meta ),
174
+ // old_account_lthash );
175
+ // FD_LOG_WARNING(("subtracting old account hash %s for pubkey %s from lthash %s",
176
+ // FD_LTHASH_ENC_32_ALLOCA( old_account_lthash ),
177
+ // FD_BASE58_ENC_32_ALLOCA( (fd_pubkey_t*)account_pubkey ),
178
+ // FD_LTHASH_ENC_32_ALLOCA( lthash )));
179
+ // fd_lthash_sub( lthash, old_account_lthash );
180
+ // FD_LOG_WARNING(("resulting lthash %s",
181
+ // FD_LTHASH_ENC_32_ALLOCA( lthash )));
154
182
}
155
183
156
184
return 0 ;
@@ -186,19 +214,19 @@ account_cb( void * _ctx,
186
214
ctx -> metrics .accounts_inserted ++ ;
187
215
fd_txn_account_mutable_fini ( rec , ctx -> funk , ctx -> funk_txn , & prepare );
188
216
189
- fd_lthash_value_t new_account_lthash [1 ];
190
- fd_lthash_value_t * lthash = ctx -> full ? & ctx -> lthash_info .full .lthash : & ctx -> lthash_info .incremental .lthash ;
191
- fd_hashes_account_lthash ( (fd_pubkey_t * )hdr -> meta .pubkey ,
192
- fd_txn_account_get_meta ( rec ),
193
- fd_txn_account_get_data ( rec ),
194
- new_account_lthash );
195
- FD_LOG_WARNING (("adding new account hash %s for pubkey %s from lthash %s" ,
196
- FD_LTHASH_ENC_32_ALLOCA ( new_account_lthash ),
197
- FD_BASE58_ENC_32_ALLOCA ( (fd_pubkey_t * )hdr -> meta .pubkey ),
198
- FD_LTHASH_ENC_32_ALLOCA ( lthash )));
199
- fd_lthash_add ( lthash , new_account_lthash );
200
- FD_LOG_WARNING (("resulting lthash %s" ,
201
- FD_LTHASH_ENC_32_ALLOCA ( lthash )));
217
+ // fd_lthash_value_t new_account_lthash[1];
218
+ // fd_lthash_value_t * lthash = ctx->full ? &ctx->lthash_info.full.lthash : &ctx->lthash_info.incremental.lthash;
219
+ // fd_hashes_account_lthash( (fd_pubkey_t*)hdr->meta.pubkey,
220
+ // fd_txn_account_get_meta( rec ),
221
+ // fd_txn_account_get_data( rec ),
222
+ // new_account_lthash );
223
+ // FD_LOG_WARNING(("adding new account hash %s for pubkey %s from lthash %s",
224
+ // FD_LTHASH_ENC_32_ALLOCA( new_account_lthash ),
225
+ // FD_BASE58_ENC_32_ALLOCA( (fd_pubkey_t*)hdr->meta.pubkey ),
226
+ // FD_LTHASH_ENC_32_ALLOCA( lthash )));
227
+ // fd_lthash_add( lthash, new_account_lthash );
228
+ // FD_LOG_WARNING(("resulting lthash %s",
229
+ // FD_LTHASH_ENC_32_ALLOCA( lthash )));
202
230
203
231
}
204
232
@@ -292,13 +320,14 @@ handle_control_frag( fd_snapin_tile_t * ctx,
292
320
break ;
293
321
}
294
322
295
- if ( FD_UNLIKELY ( memcmp ( ctx -> lthash_info .full .lthash .bytes , ctx -> lthash_info .full .manifest_lthash .bytes , sizeof (fd_lthash_value_t ) ) ) ) {
296
- FD_LOG_WARNING (( "calculated accounts lthash %s does not match accounts lthash %s in snapshot manifest" ,
297
- FD_LTHASH_ENC_32_ALLOCA ( & ctx -> lthash_info .full .lthash ),
298
- FD_LTHASH_ENC_32_ALLOCA ( & ctx -> lthash_info .full .manifest_lthash ) ));
299
- transition_malformed ( ctx , stem );
300
- break ;
301
- }
323
+ // if( FD_UNLIKELY( memcmp( ctx->lthash_info.full.lthash.bytes, ctx->lthash_info.full.manifest_lthash.bytes, sizeof(fd_lthash_value_t) ) ) ) {
324
+ // FD_LOG_WARNING(( "calculated accounts lthash %s does not match accounts lthash %s in snapshot manifest",
325
+ // FD_LTHASH_ENC_32_ALLOCA( &ctx->lthash_info.full.lthash ),
326
+ // FD_LTHASH_ENC_32_ALLOCA( &ctx->lthash_info.full.manifest_lthash ) ));
327
+ // transition_malformed( ctx, stem );
328
+ // break;
329
+ // }
330
+ calculate_lthash ( ctx );
302
331
303
332
fd_snapshot_parser_reset ( ctx -> ssparse , fd_chunk_to_laddr ( ctx -> manifest_out .wksp , ctx -> manifest_out .chunk ), ctx -> manifest_out .mtu );
304
333
@@ -314,14 +343,15 @@ handle_control_frag( fd_snapin_tile_t * ctx,
314
343
break ;
315
344
}
316
345
317
- if ( FD_UNLIKELY ( memcmp ( ctx -> lthash_info .full .lthash .bytes , ctx -> lthash_info .full .manifest_lthash .bytes , sizeof (fd_lthash_value_t ) ) ||
318
- memcmp ( ctx -> lthash_info .incremental .lthash .bytes , ctx -> lthash_info .incremental .manifest_lthash .bytes , sizeof (fd_lthash_value_t ) ) ) ) {
319
- FD_LOG_WARNING (( "calculated accounts lthash %s does not match accounts lthash %s in snapshot manifest" ,
320
- FD_LTHASH_ENC_32_ALLOCA ( & ctx -> lthash_info .full .lthash ),
321
- FD_LTHASH_ENC_32_ALLOCA ( & ctx -> lthash_info .full .manifest_lthash ) ));
322
- transition_malformed ( ctx , stem );
323
- break ;
324
- }
346
+ // if( FD_UNLIKELY( memcmp( ctx->lthash_info.full.lthash.bytes, ctx->lthash_info.full.manifest_lthash.bytes, sizeof(fd_lthash_value_t) ) ||
347
+ // memcmp( ctx->lthash_info.incremental.lthash.bytes, ctx->lthash_info.incremental.manifest_lthash.bytes, sizeof(fd_lthash_value_t) ) ) ) {
348
+ // FD_LOG_WARNING(( "calculated accounts lthash %s does not match accounts lthash %s in snapshot manifest",
349
+ // FD_LTHASH_ENC_32_ALLOCA( &ctx->lthash_info.full.lthash ),
350
+ // FD_LTHASH_ENC_32_ALLOCA( &ctx->lthash_info.full.manifest_lthash ) ));
351
+ // transition_malformed( ctx, stem );
352
+ // break;
353
+ // }
354
+ calculate_lthash ( ctx );
325
355
326
356
if ( FD_LIKELY ( ctx -> funk_txn ) ) fd_funk_txn_publish_into_parent ( ctx -> funk , ctx -> funk_txn , 0 );
327
357
fd_stem_publish ( stem , 0UL , fd_ssmsg_sig ( FD_SSMSG_DONE , 0UL ), 0UL , 0UL , 0UL , 0UL , 0UL );
0 commit comments