@@ -34,7 +34,8 @@ pub struct Payload(#[serde(with = "crate::lotus_json::base64_standard")] pub Vec
3434
3535#[ derive( Default , PartialEq , Debug , Clone , Serialize , Deserialize ) ]
3636pub struct Index {
37- pub eth_mappings : ahash:: HashMap < String , Payload > ,
37+ pub eth_mappings : Option < ahash:: HashMap < String , Payload > > ,
38+ pub indices : Option < ahash:: HashMap < String , Payload > > ,
3839}
3940
4041#[ derive( Debug , Clone , Serialize , Deserialize ) ]
@@ -52,16 +53,20 @@ pub struct RpcTestSnapshot {
5253fn backfill_eth_mappings ( db : & MemoryDB , index : Option < Index > ) -> anyhow:: Result < ( ) > {
5354 if let Some ( index) = index {
5455 if let Some ( mut guard) = db. eth_mappings_db . try_write ( ) {
55- for ( k, v) in index. eth_mappings . iter ( ) {
56- if let Ok ( hash) = EthHash :: from_str ( k) {
57- guard. insert ( hash, v. 0 . clone ( ) ) ;
56+ if let Some ( eth_mappings) = index. eth_mappings {
57+ for ( k, v) in eth_mappings. iter ( ) {
58+ if let Ok ( hash) = EthHash :: from_str ( k) {
59+ guard. insert ( hash, v. 0 . clone ( ) ) ;
60+ }
5861 }
5962 }
6063 }
6164 if let Some ( mut guard) = db. indices_db . try_write ( ) {
62- for ( k, v) in index. eth_mappings . iter ( ) {
63- if let Ok ( cid) = Cid :: from_str ( k) {
64- guard. insert ( cid, v. 0 . clone ( ) ) ;
65+ if let Some ( indices) = index. indices {
66+ for ( k, v) in indices. iter ( ) {
67+ if let Ok ( cid) = Cid :: from_str ( k) {
68+ guard. insert ( cid, v. 0 . clone ( ) ) ;
69+ }
6570 }
6671 }
6772 }
0 commit comments