Make space for a new Transaction::new

This commit is contained in:
Greg Fitzgerald
2019-03-26 17:14:28 -06:00
parent d497b99abb
commit 8c69c40834
9 changed files with 26 additions and 21 deletions

View File

@@ -196,7 +196,7 @@ mod tests {
alice_client.transfer(1, &mallory_pubkey).unwrap();
let instruction =
BudgetInstruction::new_apply_signature(&mallory_pubkey, &budget_pubkey, &bob_pubkey);
let mut transaction = Transaction::new(vec![instruction]);
let mut transaction = Transaction::new_unsigned_instructions(vec![instruction]);
// Attack! Part 2: Point the instruction to the expected, but unsigned, key.
transaction.account_keys.push(alice_pubkey);
@@ -243,7 +243,7 @@ mod tests {
&bob_pubkey,
dt,
);
let mut transaction = Transaction::new(vec![instruction]);
let mut transaction = Transaction::new_unsigned_instructions(vec![instruction]);
// Attack! Part 2: Point the instruction to the expected, but unsigned, key.
transaction.account_keys.push(alice_pubkey);

View File

@@ -131,7 +131,7 @@ mod tests {
let instruction = ConfigInstruction::new_store(&from_pubkey, &config_pubkey, &my_config);
// Replace instruction data with a vector that's too large
let mut transaction = Transaction::new(vec![instruction]);
let mut transaction = Transaction::new_unsigned_instructions(vec![instruction]);
transaction.instructions[0].data = vec![0; 123];
config_client.process_transaction(transaction).unwrap_err();
}
@@ -153,7 +153,8 @@ mod tests {
ConfigInstruction::new_store(&from_pubkey, &config_pubkey, &my_config);
// Don't sign the transaction with `config_client`
let mut transaction = Transaction::new(vec![move_instruction, store_instruction]);
let mut transaction =
Transaction::new_unsigned_instructions(vec![move_instruction, store_instruction]);
transaction.sign_unchecked(&[&system_keypair], bank.last_blockhash());
let system_client = BankClient::new(&bank, system_keypair);
system_client.process_transaction(transaction).unwrap_err();

View File

@@ -21,7 +21,7 @@ impl ExchangeTransaction {
let space = mem::size_of::<ExchangeState>() as u64;
let create_ix = SystemInstruction::new_program_account(owner_id, new, 1, space, &id());
let request_ix = ExchangeInstruction::new_account_request(owner_id, new);
let mut tx = Transaction::new(vec![create_ix, request_ix]);
let mut tx = Transaction::new_unsigned_instructions(vec![create_ix, request_ix]);
tx.fee = fee;
tx.sign(&[owner], recent_blockhash);
tx
@@ -39,7 +39,7 @@ impl ExchangeTransaction {
let owner_id = &owner.pubkey();
let request_ix =
ExchangeInstruction::new_transfer_request(owner_id, to, from, token, tokens);
let mut tx = Transaction::new(vec![request_ix]);
let mut tx = Transaction::new_unsigned_instructions(vec![request_ix]);
tx.fee = fee;
tx.sign(&[owner], recent_blockhash);
tx
@@ -71,7 +71,7 @@ impl ExchangeTransaction {
src_account,
dst_account,
);
let mut tx = Transaction::new(vec![create_ix, request_ix]);
let mut tx = Transaction::new_unsigned_instructions(vec![create_ix, request_ix]);
tx.fee = fee;
tx.sign(&[owner], recent_blockhash);
tx
@@ -86,7 +86,7 @@ impl ExchangeTransaction {
) -> Transaction {
let owner_id = &owner.pubkey();
let request_ix = ExchangeInstruction::new_trade_cancellation(owner_id, trade, account);
let mut tx = Transaction::new(vec![request_ix]);
let mut tx = Transaction::new_unsigned_instructions(vec![request_ix]);
tx.fee = fee;
tx.sign(&[owner], recent_blockhash);
tx
@@ -115,7 +115,7 @@ impl ExchangeTransaction {
from_trade_account,
profit_account,
);
let mut tx = Transaction::new(vec![create_ix, request_ix]);
let mut tx = Transaction::new_unsigned_instructions(vec![create_ix, request_ix]);
tx.fee = fee;
tx.sign(&[owner], recent_blockhash);
tx