Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions program/c/src/oracle/oracle.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const uint64_t EXTRA_PUBLISHER_SPACE = 3072ULL;
#define PC_STATUS_TRADING 1
#define PC_STATUS_HALTED 2
#define PC_STATUS_AUCTION 3
#define PC_STATUS_IGNORED 4

// account types
#define PC_ACCTYPE_MAPPING 1
Expand Down
4 changes: 2 additions & 2 deletions program/rust/src/processor/upd_price.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use {
},
c_oracle_header::{
MAX_CI_DIVISOR,
PC_STATUS_UNKNOWN,
PC_STATUS_IGNORED,
},
deserialize::{
load,
Expand Down Expand Up @@ -151,7 +151,7 @@ pub fn upd_price(
}

if cmd_args.confidence > try_convert::<_, u64>(threshold_conf)? {
status = PC_STATUS_UNKNOWN
status = PC_STATUS_IGNORED
}

{
Expand Down
5 changes: 3 additions & 2 deletions program/rust/src/tests/test_upd_price.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use {
PythAccount,
},
c_oracle_header::{
PC_STATUS_IGNORED,
PC_STATUS_TRADING,
PC_STATUS_UNKNOWN,
PC_VERSION,
Expand Down Expand Up @@ -243,7 +244,7 @@ fn test_upd_price() {
assert_eq!(price_data.comp_[0].latest_.price_, 50);
assert_eq!(price_data.comp_[0].latest_.conf_, 20);
assert_eq!(price_data.comp_[0].latest_.pub_slot_, 5);
assert_eq!(price_data.comp_[0].latest_.status_, PC_STATUS_UNKNOWN);
assert_eq!(price_data.comp_[0].latest_.status_, PC_STATUS_IGNORED);
assert_eq!(price_data.valid_slot_, 5);
assert_eq!(price_data.agg_.pub_slot_, 6);
assert_eq!(price_data.agg_.price_, 81);
Expand All @@ -270,7 +271,7 @@ fn test_upd_price() {
assert_eq!(price_data.comp_[0].latest_.price_, 50);
assert_eq!(price_data.comp_[0].latest_.conf_, 20);
assert_eq!(price_data.comp_[0].latest_.pub_slot_, 6);
assert_eq!(price_data.comp_[0].latest_.status_, PC_STATUS_UNKNOWN);
assert_eq!(price_data.comp_[0].latest_.status_, PC_STATUS_IGNORED);
assert_eq!(price_data.valid_slot_, 6);
assert_eq!(price_data.agg_.pub_slot_, 7);
assert_eq!(price_data.agg_.price_, 81);
Expand Down
9 changes: 6 additions & 3 deletions program/rust/src/tests/test_upd_sma.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use crate::accounts::PythAccount;
use crate::{
accounts::PythAccount,
c_oracle_header::PC_STATUS_IGNORED,
};
// use crate::processor::process_instruction;
use {
crate::{
Expand Down Expand Up @@ -309,7 +312,7 @@ fn test_upd_sma() {
assert_eq!(price_data.price_data.comp_[0].latest_.pub_slot_, 5);
assert_eq!(
price_data.price_data.comp_[0].latest_.status_,
PC_STATUS_UNKNOWN
PC_STATUS_IGNORED
);
assert_eq!(price_data.price_data.valid_slot_, 5);
assert_eq!(price_data.price_data.agg_.pub_slot_, 6);
Expand Down Expand Up @@ -349,7 +352,7 @@ fn test_upd_sma() {
assert_eq!(price_data.price_data.comp_[0].latest_.pub_slot_, 6);
assert_eq!(
price_data.price_data.comp_[0].latest_.status_,
PC_STATUS_UNKNOWN
PC_STATUS_IGNORED
);
assert_eq!(price_data.price_data.valid_slot_, 6);
assert_eq!(price_data.price_data.agg_.pub_slot_, 7);
Expand Down