@@ -303,7 +303,7 @@ Test( oracle, add_publisher ) {
303303
304304 // Now give the price account enough lamports to be rent exempt
305305 acc [1 ].lamports = & PRICE_ACCOUNT_LAMPORTS ;
306-
306+
307307 cr_assert ( SUCCESS == dispatch ( & prm , acc ) );
308308 cr_assert ( sptr -> num_ == 1 );
309309 cr_assert ( pc_pub_key_equal ( & idata .pub_ , & sptr -> comp_ [0 ].pub_ ) );
@@ -348,7 +348,7 @@ Test(oracle, pc_size ) {
348348}
349349
350350Test ( oracle , upd_test ) {
351-
351+
352352 // Initialize the test account
353353 SolPubkey p_id = {.x = { 0xff , }};
354354 SolPubkey pkey = {.x = { 1 , }};
@@ -416,7 +416,7 @@ Test( oracle, upd_price ) {
416416 .cmd_ = e_cmd_upd_price ,
417417 .status_ = PC_STATUS_TRADING ,
418418 .price_ = 42L ,
419- .conf_ = 9L ,
419+ .conf_ = 2L ,
420420 .pub_slot_ = 1
421421 };
422422 SolPubkey p_id = {.x = { 0xff , }};
@@ -474,7 +474,7 @@ Test( oracle, upd_price ) {
474474 };
475475 cr_assert ( SUCCESS == dispatch ( & prm , acc ) );
476476 cr_assert ( sptr -> comp_ [0 ].latest_ .price_ == 42L );
477- cr_assert ( sptr -> comp_ [0 ].latest_ .conf_ == 9L );
477+ cr_assert ( sptr -> comp_ [0 ].latest_ .conf_ == 2L );
478478 cr_assert ( sptr -> comp_ [0 ].latest_ .pub_slot_ == 1 );
479479 cr_assert ( sptr -> agg_ .pub_slot_ == 1 );
480480 cr_assert ( sptr -> valid_slot_ == 0 );
@@ -519,6 +519,22 @@ Test( oracle, upd_price ) {
519519 // try to publish back-in-time
520520 idata .pub_slot_ = 1 ;
521521 cr_assert ( ERROR_INVALID_ARGUMENT == dispatch ( & prm , acc ) );
522+
523+
524+ // Publishing a wide CI results in a status of unknown.
525+
526+ // check that someone doesn't accidentally break the test.
527+ cr_assert (sptr -> comp_ [0 ].latest_ .status_ == PC_STATUS_TRADING );
528+ idata .pub_slot_ = 5 ;
529+ cvar .slot_ = 6 ;
530+ idata .price_ = 50 ;
531+ idata .conf_ = 6 ;
532+ cr_assert ( SUCCESS == dispatch ( & prm , acc ) );
533+ cr_assert ( sptr -> comp_ [0 ].latest_ .price_ == 50L );
534+ cr_assert ( sptr -> comp_ [0 ].latest_ .conf_ == 6L );
535+ cr_assert ( sptr -> comp_ [0 ].latest_ .status_ == PC_STATUS_UNKNOWN );
536+ cr_assert ( sptr -> comp_ [0 ].latest_ .pub_slot_ == 5 );
537+ cr_assert ( sptr -> agg_ .pub_slot_ == 5 );
522538}
523539
524540Test ( oracle , upd_price_no_fail_on_error ) {
@@ -544,7 +560,7 @@ Test( oracle, upd_price_no_fail_on_error ) {
544560 sptr -> ptype_ = PC_PTYPE_PRICE ;
545561 sptr -> type_ = PC_ACCTYPE_PRICE ;
546562 sptr -> num_ = 1 ;
547-
563+
548564 SolAccountInfo acc [] = {{
549565 .key = & pkey ,
550566 .lamports = & pqty ,
@@ -592,7 +608,7 @@ Test( oracle, upd_price_no_fail_on_error ) {
592608 cr_assert ( sptr -> comp_ [0 ].latest_ .conf_ == 0L );
593609 cr_assert ( sptr -> comp_ [0 ].latest_ .pub_slot_ == 0 );
594610 cr_assert ( sptr -> agg_ .pub_slot_ == 0 );
595- cr_assert ( sptr -> valid_slot_ == 0 );
611+ cr_assert ( sptr -> valid_slot_ == 0 );
596612
597613 // Now permission the publish account for the price account.
598614 pc_pub_key_assign ( & sptr -> comp_ [0 ].pub_ , (pc_pub_key_t * )& pkey );
@@ -605,7 +621,7 @@ Test( oracle, upd_price_no_fail_on_error ) {
605621 cr_assert ( sptr -> agg_ .pub_slot_ == 1 );
606622 cr_assert ( sptr -> valid_slot_ == 0 );
607623
608- // Invalid updates, such as publishing an update for the current slot,
624+ // Invalid updates, such as publishing an update for the current slot,
609625 // should still fail silently and have no effect.
610626 idata .price_ = 55L ;
611627 idata .conf_ = 22L ;
0 commit comments