Ensure initialization data source emitter address and chain ids are the same length (#337)
This commit is contained in:
parent
44559109f0
commit
9d4a6b88c4
|
@ -98,4 +98,8 @@ module pyth::error {
|
|||
public fun invalid_attestation_magic_value(): u64 {
|
||||
error::invalid_argument(24)
|
||||
}
|
||||
|
||||
public fun data_source_emitter_address_and_chain_ids_different_lengths(): u64 {
|
||||
error::invalid_argument(25)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,6 +74,10 @@ module pyth::pyth {
|
|||
fun parse_data_sources(
|
||||
emitter_chain_ids: vector<u64>,
|
||||
emitter_addresses: vector<vector<u8>>): vector<DataSource> {
|
||||
|
||||
assert!(vector::length(&emitter_chain_ids) == vector::length(&emitter_addresses),
|
||||
error::data_source_emitter_address_and_chain_ids_different_lengths());
|
||||
|
||||
let sources = vector::empty();
|
||||
let i = 0;
|
||||
while (i < vector::length(&emitter_chain_ids)) {
|
||||
|
|
Loading…
Reference in New Issue