Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Permit paying oneself (bp #10337) #10342

Merged
merged 1 commit into from
May 31, 2020
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
5 changes: 0 additions & 5 deletions cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1530,11 +1530,6 @@ fn process_transfer(
) -> ProcessResult {
let from = config.signers[from];

check_unique_pubkeys(
(&from.pubkey(), "cli keypair".to_string()),
(to, "to".to_string()),
)?;

let (recent_blockhash, fee_calculator) =
blockhash_query.get_blockhash_and_fee_calculator(rpc_client)?;

Expand Down
32 changes: 0 additions & 32 deletions runtime/src/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1367,38 +1367,6 @@ mod tests {
}
}

#[test]
fn test_load_account_pay_to_self() {
let mut accounts: Vec<(Pubkey, Account)> = Vec::new();
let mut error_counters = ErrorCounters::default();

let keypair = Keypair::new();
let pubkey = keypair.pubkey();

let account = Account::new(10, 1, &Pubkey::default());
accounts.push((pubkey, account));

let instructions = vec![CompiledInstruction::new(0, &(), vec![0, 1])];
// Simulate pay-to-self transaction, which loads the same account twice
let tx = Transaction::new_with_compiled_instructions(
&[&keypair],
&[pubkey],
Hash::default(),
vec![native_loader::id()],
instructions,
);
let loaded_accounts = load_accounts(tx, &accounts, &mut error_counters);

assert_eq!(loaded_accounts.len(), 1);
assert_eq!(
loaded_accounts[0],
(
Err(TransactionError::InvalidAccountForFee),
Some(HashAgeKind::Extant)
)
);
}

#[test]
fn test_load_by_program_slot() {
let accounts = Accounts::new(Vec::new());
Expand Down
6 changes: 1 addition & 5 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4820,13 +4820,9 @@ mod tests {
let _res = bank.process_transaction(&tx);

assert_eq!(bank.get_balance(&key1.pubkey()), 1);

// TODO: Why do we convert errors to Oks?
//res[0].clone().unwrap_err();

bank.get_signature_status(&tx.signatures[0])
.unwrap()
.unwrap_err();
.unwrap();
}

fn new_from_parent(parent: &Arc<Bank>) -> Bank {
Expand Down
Loading