@@ -59,46 +59,6 @@ static bool valid_writable_account( SolParameters *prm,
5959 is_rent_exempt ( * ka -> lamports , ka -> data_len );
6060}
6161
62- static uint64_t add_mapping ( SolParameters * prm , SolAccountInfo * ka )
63- {
64- // Account (1) is the tail or last mapping account in the chain
65- // Account (2) is the new mapping account and will become the new tail
66- // Verify that these are signed, writable accounts with correct ownership
67- // and size
68- if ( prm -> ka_num != 3 ||
69- !valid_funding_account ( & ka [0 ] ) ||
70- !valid_signable_account ( prm , & ka [1 ], sizeof ( pc_map_table_t ) ) ||
71- !valid_signable_account ( prm , & ka [2 ], sizeof ( pc_map_table_t ) ) ) {
72- return ERROR_INVALID_ARGUMENT ;
73- }
74- // Verify that last mapping account in chain is initialized, full
75- // and not pointing to a another account in the chain
76- // Also verify that the new account is uninitialized
77- cmd_hdr_t * hdr = (cmd_hdr_t * )prm -> data ;
78- pc_map_table_t * pptr = (pc_map_table_t * )ka [1 ].data ;
79- pc_map_table_t * nptr = (pc_map_table_t * )ka [2 ].data ;
80- if ( pptr -> magic_ != PC_MAGIC ||
81- pptr -> ver_ != hdr -> ver_ ||
82- pptr -> type_ != PC_ACCTYPE_MAPPING ||
83- nptr -> magic_ != 0 ||
84- pptr -> num_ < PC_MAP_TABLE_SIZE ||
85- nptr -> num_ != 0 ||
86- !pc_pub_key_is_zero ( & pptr -> next_ ) ) {
87- return ERROR_INVALID_ARGUMENT ;
88- }
89- // Initialize new account and set version number
90- sol_memset ( nptr , 0 , sizeof ( pc_map_table_t ) );
91- nptr -> magic_ = PC_MAGIC ;
92- nptr -> ver_ = hdr -> ver_ ;
93- nptr -> type_ = PC_ACCTYPE_MAPPING ;
94- nptr -> size_ = sizeof ( pc_map_table_t ) - sizeof ( nptr -> prod_ );
95-
96- // Set last mapping account to point to this mapping account
97- pc_pub_key_t * nkey = (pc_pub_key_t * )ka [2 ].key ;
98- pc_pub_key_assign ( & pptr -> next_ , nkey );
99- return SUCCESS ;
100- }
101-
10262static uint64_t add_product ( SolParameters * prm , SolAccountInfo * ka )
10363{
10464 // Account (1) is the mapping account that we're going to add to and
@@ -513,7 +473,7 @@ static uint64_t dispatch( SolParameters *prm, SolAccountInfo *ka )
513473 case e_cmd_upd_price_no_fail_on_error : return upd_price_no_fail_on_error ( prm , ka );
514474 // init_mapping is overridden in Rust, but still implemented here to make the C unit tests pass.
515475 case e_cmd_init_mapping : return ERROR_INVALID_ARGUMENT ;
516- case e_cmd_add_mapping : return add_mapping ( prm , ka ) ;
476+ case e_cmd_add_mapping : return ERROR_INVALID_ARGUMENT ;
517477 case e_cmd_add_product : return add_product ( prm , ka );
518478 case e_cmd_upd_product : return upd_product ( prm , ka );
519479 case e_cmd_add_price : return add_price ( prm , ka );
0 commit comments