Skip to content

Commit e08dbd2

Browse files
committed
go
1 parent f3deb0f commit e08dbd2

File tree

3 files changed

+99
-38
lines changed

3 files changed

+99
-38
lines changed

Cargo.lock

Lines changed: 86 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

runtime/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ num-traits = { version = "0.2" }
3535
num_cpus = "1.13.1"
3636
once_cell = "1.12.0"
3737
ouroboros = "0.15.0"
38-
pyth-oracle = { path = "/code/pyth-network/pyth-client/program/rust", features = ["library"] }
38+
pyth-oracle = { git = "https://github.com/pyth-network/pyth-client.git" ,branch="feat/publisher-caps" , features = ["library"] }
3939
pythnet-sdk = { git = "https://github.com/pyth-network/pyth-crosschain", version = "1.13.6", rev = "e670f57f89b05398ca352e4accb1e32724a8e1b4" }
4040
rand = "0.7.0"
4141
rayon = "1.5.3"

runtime/src/bank/pyth_accumulator.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ use {
1212
pubkey::Pubkey,
1313
},
1414
std::{
15-
env::{self, VarError},
16-
str::FromStr,
15+
borrow::Borrow, env::{self, VarError}, str::FromStr
1716
},
1817
};
1918

@@ -405,5 +404,16 @@ pub fn update_v2(bank: &Bank) -> std::result::Result<(), AccumulatorUpdateErrorV
405404
}
406405
}
407406

407+
let accounts = bank
408+
.get_program_accounts(&ORACLE_PUBKEY, &ScanConfig::new(true))
409+
.map_err(AccumulatorUpdateErrorV1::GetProgramAccounts)?;
410+
411+
let account_datas = accounts
412+
.iter()
413+
.map(|(_, account)| account.data().borrow())
414+
.collect::<Vec<_>>();
415+
416+
let message = pyth_oracle::validator::compute_publisher_caps(account_datas, bank.clock().unix_timestamp);
417+
408418
update_v1(bank, &v2_messages, any_v1_aggregations)
409419
}

0 commit comments

Comments
 (0)