Store address table lookups in blockstore and bigtable (#22402)
This commit is contained in:
@@ -71,6 +71,24 @@ impl VersionedMessage {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn total_account_keys_len(&self) -> usize {
|
||||
match self {
|
||||
Self::Legacy(message) => message.account_keys.len(),
|
||||
Self::V0(message) => message.account_keys.len().saturating_add(
|
||||
message
|
||||
.address_table_lookups
|
||||
.iter()
|
||||
.map(|lookup| {
|
||||
lookup
|
||||
.writable_indexes
|
||||
.len()
|
||||
.saturating_add(lookup.readonly_indexes.len())
|
||||
})
|
||||
.sum(),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn recent_blockhash(&self) -> &Hash {
|
||||
match self {
|
||||
Self::Legacy(message) => &message.recent_blockhash,
|
||||
@@ -85,6 +103,13 @@ impl VersionedMessage {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn instructions(&self) -> &[CompiledInstruction] {
|
||||
match self {
|
||||
Self::Legacy(message) => &message.instructions,
|
||||
Self::V0(message) => &message.instructions,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn serialize(&self) -> Vec<u8> {
|
||||
bincode::serialize(self).unwrap()
|
||||
}
|
||||
|
Reference in New Issue
Block a user