From 2b08b0c4788fd4b7ec817e2592519d9a7faa4b95 Mon Sep 17 00:00:00 2001 From: Tyera Eulberg Date: Fri, 3 Sep 2021 00:43:25 -0600 Subject: [PATCH] Fix conflicts --- ledger/src/blockstore.rs | 14 ------- rpc/src/transaction_status_service.rs | 2 +- transaction-status/src/extract_memos.rs | 50 ++----------------------- 3 files changed, 4 insertions(+), 62 deletions(-) diff --git a/ledger/src/blockstore.rs b/ledger/src/blockstore.rs index 8b7ffac0f1a1cb..2a461e6216fc18 100644 --- a/ledger/src/blockstore.rs +++ b/ledger/src/blockstore.rs @@ -2151,8 +2151,6 @@ impl Blockstore { Ok(()) } -<<<<<<< HEAD -======= pub fn read_transaction_memos(&self, signature: Signature) -> Result> { self.transaction_memos_cf.get(signature) } @@ -2161,18 +2159,6 @@ impl Blockstore { self.transaction_memos_cf.put(*signature, &memos) } - fn check_lowest_cleanup_slot(&self, slot: Slot) -> Result> { - // lowest_cleanup_slot is the last slot that was not cleaned up by LedgerCleanupService - let lowest_cleanup_slot = self.lowest_cleanup_slot.read().unwrap(); - if *lowest_cleanup_slot > 0 && *lowest_cleanup_slot >= slot { - return Err(BlockstoreError::SlotCleanedUp); - } - // Make caller hold this lock properly; otherwise LedgerCleanupService can purge/compact - // needed slots here at any given moment - Ok(lowest_cleanup_slot) - } - ->>>>>>> 5fa3e5744 (Populate memo in blockstore signatures-for-address (#19515)) fn ensure_lowest_cleanup_slot(&self) -> (std::sync::RwLockReadGuard, Slot) { // Ensures consistent result by using lowest_cleanup_slot as the lower bound // for reading columns that do not employ strong read consistency with slot-based diff --git a/rpc/src/transaction_status_service.rs b/rpc/src/transaction_status_service.rs index 94f9bd5853223b..e79f4d1c6f07b2 100644 --- a/rpc/src/transaction_status_service.rs +++ b/rpc/src/transaction_status_service.rs @@ -145,7 +145,7 @@ impl TransactionStatusService { if let Some(memos) = extract_and_fmt_memos(transaction.message()) { blockstore - .write_transaction_memos(transaction.signature(), memos) + .write_transaction_memos(&transaction.signatures[0], memos) .expect("Expect database write to succeed: TransactionMemos"); } diff --git a/transaction-status/src/extract_memos.rs b/transaction-status/src/extract_memos.rs index cb6f7a94451b07..178ba055fcd5fa 100644 --- a/transaction-status/src/extract_memos.rs +++ b/transaction-status/src/extract_memos.rs @@ -1,9 +1,6 @@ use { crate::parse_instruction::parse_memo_data, - solana_sdk::{ - message::{Message, SanitizedMessage}, - pubkey::Pubkey, - }, + solana_sdk::{message::Message, pubkey::Pubkey}, }; // A helper function to convert spl_memo::v1::id() as spl_sdk::pubkey::Pubkey to @@ -54,30 +51,11 @@ impl ExtractMemos for Message { } } -impl ExtractMemos for SanitizedMessage { - fn extract_memos(&self) -> Vec { - let mut memos = vec![]; - if self - .account_keys_iter() - .any(|&pubkey| pubkey == spl_memo_id_v1() || pubkey == spl_memo_id_v3()) - { - for (program_id, instruction) in self.program_instructions_iter() { - maybe_push_parsed_memo(&mut memos, *program_id, &instruction.data); - } - } - memos - } -} - #[cfg(test)] mod test { use { super::*, - solana_sdk::{ - hash::Hash, - instruction::CompiledInstruction, - message::{v0, MappedAddresses, MappedMessage, MessageHeader}, - }, + solana_sdk::{hash::Hash, instruction::CompiledInstruction}, }; #[test] @@ -118,30 +96,8 @@ mod test { spl_memo_id_v3(), ], Hash::default(), - memo_instructions.clone(), + memo_instructions, ); assert_eq!(message.extract_memos(), expected_memos); - - let sanitized_message = SanitizedMessage::Legacy(message); - assert_eq!(sanitized_message.extract_memos(), expected_memos); - - let mapped_message = MappedMessage { - message: v0::Message { - header: MessageHeader { - num_required_signatures: 1, - num_readonly_signed_accounts: 0, - num_readonly_unsigned_accounts: 3, - }, - account_keys: vec![fee_payer], - instructions: memo_instructions, - ..v0::Message::default() - }, - mapped_addresses: MappedAddresses { - writable: vec![], - readonly: vec![spl_memo_id_v1(), another_program_id, spl_memo_id_v3()], - }, - }; - let sanitized_mapped_message = SanitizedMessage::V0(mapped_message); - assert_eq!(sanitized_mapped_message.extract_memos(), expected_memos); } }