@@ -809,7 +809,7 @@ rpc::upd_price::upd_price()
809809 ckey_( nullptr ),
810810 gkey_( nullptr ),
811811 akey_( nullptr ),
812- cmd_( e_cmd_batch_upd_price )
812+ cmd_( e_cmd_upd_price )
813813{
814814}
815815
@@ -851,7 +851,7 @@ void rpc::upd_price::set_price( int64_t px,
851851 price_ = px;
852852 conf_ = conf;
853853 st_ = st;
854- cmd_ = is_agg?e_cmd_agg_price:e_cmd_batch_upd_price ;
854+ cmd_ = is_agg?e_cmd_agg_price:e_cmd_upd_price ;
855855}
856856
857857void rpc::upd_price::set_slot ( const uint64_t pub_slot )
@@ -918,30 +918,18 @@ bool rpc::upd_price::build_tx(
918918 tx.add ( *first.bhash_ ); // recent block hash
919919
920920 // instructions section
921- tx.add_len ( 1 );
922-
923- // Create the cmd_batch_upd_price instruction
924- tx.add ( (uint8_t )( n + 2 ) ); // program_id index
925-
926- // All the accounts this instruction accesses
927- tx.add_len ( 2 + n ); // number of accounts: publish; clock and the symbol accounts
928- tx.add ( (uint8_t )0 ); // index of publish account
921+ tx.add_len ( n ); // n instruction(s)
929922 for ( unsigned i = 0 ; i < n; ++i ) {
923+ tx.add ( (uint8_t )( n + 2 ) ); // program_id index
924+ tx.add_len < 3 >(); // 3 accounts: publish, symbol, sysvar
925+ tx.add ( (uint8_t )0 ); // index of publish account
930926 tx.add ( (uint8_t )( i + 1 ) ); // index of symbol account
931- }
932- tx.add ( (uint8_t )( n + 1 ) ); // index of sysvar account
933-
934- // Instruction parameter section
935- tx.add_len ( sizeof ( cmd_batch_upd_price_header ) + ( n * sizeof ( cmd_upd_price ) ) );
927+ tx.add ( (uint8_t )( n + 1 ) ); // index of sysvar account
936928
937- // Add the header
938- tx.add ( (uint32_t )PC_VERSION );
939- tx.add ( (int32_t )( e_cmd_batch_upd_price ) );
940- tx.add ( (uint64_t )( n ) );
941-
942- // Add each instruction
943- for ( unsigned i = 0 ; i < n; ++i ) {
944929 auto const & upd = *upds[ i ];
930+
931+ // instruction parameter section
932+ tx.add_len <sizeof (cmd_upd_price)>();
945933 tx.add ( (uint32_t )PC_VERSION );
946934 tx.add ( (int32_t )( upd.cmd_ ) );
947935 tx.add ( (int32_t )( upd.st_ ) );
0 commit comments