parent
6365c4c061
commit
f079a78c5e
|
@ -236,7 +236,7 @@ fn generate_txs(
|
|||
.par_iter()
|
||||
.map(|(id, keypair)| {
|
||||
(
|
||||
system_transaction::create_user_account(id, &keypair.pubkey(), 1, *blockhash, 0),
|
||||
system_transaction::create_user_account(id, &keypair.pubkey(), 1, *blockhash),
|
||||
timestamp(),
|
||||
)
|
||||
})
|
||||
|
|
|
@ -641,7 +641,7 @@ mod tests {
|
|||
let key = Keypair::new();
|
||||
let to = Pubkey::new_rand();
|
||||
let blockhash = Hash::default();
|
||||
let tx = system_transaction::create_user_account(&key, &to, 50, blockhash, 0);
|
||||
let tx = system_transaction::create_user_account(&key, &to, 50, blockhash);
|
||||
|
||||
let signature = rpc_client.send_transaction(&tx);
|
||||
assert_eq!(signature.unwrap(), SIGNATURE.to_string());
|
||||
|
@ -690,7 +690,7 @@ mod tests {
|
|||
let key = Keypair::new();
|
||||
let to = Pubkey::new_rand();
|
||||
let blockhash = Hash::default();
|
||||
let mut tx = system_transaction::create_user_account(&key, &to, 50, blockhash, 0);
|
||||
let mut tx = system_transaction::create_user_account(&key, &to, 50, blockhash);
|
||||
|
||||
let result = rpc_client.send_and_confirm_transaction(&mut tx, &[&key]);
|
||||
result.unwrap();
|
||||
|
@ -713,8 +713,8 @@ mod tests {
|
|||
let blockhash: Hash = "HUu3LwEzGRsUkuJS121jzkPJW39Kq62pXCTmTa1F9jDL"
|
||||
.parse()
|
||||
.unwrap();
|
||||
let prev_tx = system_transaction::create_user_account(&key, &to, 50, blockhash, 0);
|
||||
let mut tx = system_transaction::create_user_account(&key, &to, 50, blockhash, 0);
|
||||
let prev_tx = system_transaction::create_user_account(&key, &to, 50, blockhash);
|
||||
let mut tx = system_transaction::create_user_account(&key, &to, 50, blockhash);
|
||||
|
||||
rpc_client.resign_transaction(&mut tx, &[&key]).unwrap();
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ fn bench_banking_stage_multi_accounts(bencher: &mut Bencher) {
|
|||
let (vote_sender, vote_receiver) = channel();
|
||||
let bank = Arc::new(Bank::new(&genesis_block));
|
||||
let to_pubkey = Pubkey::new_rand();
|
||||
let dummy = system_transaction::transfer(&mint_keypair, &to_pubkey, 1, genesis_block.hash(), 0);
|
||||
let dummy = system_transaction::transfer(&mint_keypair, &to_pubkey, 1, genesis_block.hash());
|
||||
trace!("txs: {}", txes);
|
||||
let transactions: Vec<_> = (0..txes)
|
||||
.into_par_iter()
|
||||
|
@ -123,7 +123,6 @@ fn bench_banking_stage_multi_accounts(bencher: &mut Bencher) {
|
|||
&tx.message.account_keys[0],
|
||||
mint_total / txes as u64,
|
||||
genesis_block.hash(),
|
||||
0,
|
||||
);
|
||||
let x = bank.process_transaction(&fund);
|
||||
x.unwrap();
|
||||
|
@ -209,7 +208,7 @@ fn bench_banking_stage_multi_programs(bencher: &mut Bencher) {
|
|||
let (vote_sender, vote_receiver) = channel();
|
||||
let bank = Arc::new(Bank::new(&genesis_block));
|
||||
let to_pubkey = Pubkey::new_rand();
|
||||
let dummy = system_transaction::transfer(&mint_keypair, &to_pubkey, 1, genesis_block.hash(), 0);
|
||||
let dummy = system_transaction::transfer(&mint_keypair, &to_pubkey, 1, genesis_block.hash());
|
||||
let transactions: Vec<_> = (0..txes)
|
||||
.into_par_iter()
|
||||
.map(|_| {
|
||||
|
@ -246,7 +245,6 @@ fn bench_banking_stage_multi_programs(bencher: &mut Bencher) {
|
|||
&tx.message.account_keys[0],
|
||||
mint_total / txes as u64,
|
||||
genesis_block.hash(),
|
||||
0,
|
||||
);
|
||||
bank.process_transaction(&fund).unwrap();
|
||||
});
|
||||
|
|
|
@ -13,7 +13,7 @@ fn bench_block_to_blobs_to_block(bencher: &mut Bencher) {
|
|||
let zero = Hash::default();
|
||||
let one = hash(&zero.as_ref());
|
||||
let keypair = Keypair::new();
|
||||
let tx0 = system_transaction::transfer(&keypair, &keypair.pubkey(), 1, one, 0);
|
||||
let tx0 = system_transaction::transfer(&keypair, &keypair.pubkey(), 1, one);
|
||||
let transactions = vec![tx0; 10];
|
||||
let entries = next_entries(&zero, 1, transactions);
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ fn bench_sigverify_stage(bencher: &mut Bencher) {
|
|||
&to_keypair.pubkey(),
|
||||
amount,
|
||||
Hash::default(),
|
||||
0,
|
||||
);
|
||||
tx
|
||||
})
|
||||
|
|
|
@ -947,23 +947,21 @@ mod tests {
|
|||
&keypair.pubkey(),
|
||||
2,
|
||||
start_hash,
|
||||
0,
|
||||
);
|
||||
bank.process_transaction(&fund_tx).unwrap();
|
||||
|
||||
// good tx
|
||||
let to = Pubkey::new_rand();
|
||||
let tx = system_transaction::create_user_account(&mint_keypair, &to, 1, start_hash, 0);
|
||||
let tx = system_transaction::create_user_account(&mint_keypair, &to, 1, start_hash);
|
||||
|
||||
// good tx, but no verify
|
||||
let to2 = Pubkey::new_rand();
|
||||
let tx_no_ver =
|
||||
system_transaction::create_user_account(&keypair, &to2, 2, start_hash, 0);
|
||||
let tx_no_ver = system_transaction::create_user_account(&keypair, &to2, 2, start_hash);
|
||||
|
||||
// bad tx, AccountNotFound
|
||||
let keypair = Keypair::new();
|
||||
let to3 = Pubkey::new_rand();
|
||||
let tx_anf = system_transaction::create_user_account(&keypair, &to3, 1, start_hash, 0);
|
||||
let tx_anf = system_transaction::create_user_account(&keypair, &to3, 1, start_hash);
|
||||
|
||||
// send 'em over
|
||||
let packets = to_packets(&[tx_no_ver, tx_anf, tx]);
|
||||
|
@ -1038,7 +1036,6 @@ mod tests {
|
|||
&alice.pubkey(),
|
||||
2,
|
||||
genesis_block.hash(),
|
||||
0,
|
||||
);
|
||||
|
||||
let packets = to_packets(&[tx]);
|
||||
|
@ -1054,7 +1051,6 @@ mod tests {
|
|||
&mint_keypair.pubkey(),
|
||||
1,
|
||||
genesis_block.hash(),
|
||||
0,
|
||||
);
|
||||
let packets = to_packets(&[tx]);
|
||||
let packets = packets
|
||||
|
@ -1151,8 +1147,8 @@ mod tests {
|
|||
let pubkey2 = Pubkey::new_rand();
|
||||
|
||||
let transactions = vec![
|
||||
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_block.hash(), 0),
|
||||
system_transaction::transfer(&keypair2, &pubkey2, 1, genesis_block.hash(), 0),
|
||||
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_block.hash()),
|
||||
system_transaction::transfer(&keypair2, &pubkey2, 1, genesis_block.hash()),
|
||||
];
|
||||
|
||||
let mut results = vec![Ok(()), Ok(())];
|
||||
|
@ -1211,21 +1207,18 @@ mod tests {
|
|||
&pubkey,
|
||||
1,
|
||||
genesis_block.hash(),
|
||||
0,
|
||||
)),
|
||||
Some(system_transaction::transfer(
|
||||
&mint_keypair,
|
||||
&pubkey,
|
||||
1,
|
||||
genesis_block.hash(),
|
||||
0,
|
||||
)),
|
||||
Some(system_transaction::transfer(
|
||||
&mint_keypair,
|
||||
&pubkey,
|
||||
1,
|
||||
genesis_block.hash(),
|
||||
0,
|
||||
)),
|
||||
None,
|
||||
None,
|
||||
|
@ -1234,7 +1227,6 @@ mod tests {
|
|||
&pubkey,
|
||||
1,
|
||||
genesis_block.hash(),
|
||||
0,
|
||||
)),
|
||||
None,
|
||||
Some(system_transaction::transfer(
|
||||
|
@ -1242,7 +1234,6 @@ mod tests {
|
|||
&pubkey,
|
||||
1,
|
||||
genesis_block.hash(),
|
||||
0,
|
||||
)),
|
||||
None,
|
||||
Some(system_transaction::transfer(
|
||||
|
@ -1250,19 +1241,18 @@ mod tests {
|
|||
&pubkey,
|
||||
1,
|
||||
genesis_block.hash(),
|
||||
0,
|
||||
)),
|
||||
None,
|
||||
None,
|
||||
];
|
||||
|
||||
let filtered_transactions = vec![
|
||||
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_block.hash(), 0),
|
||||
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_block.hash(), 0),
|
||||
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_block.hash(), 0),
|
||||
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_block.hash(), 0),
|
||||
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_block.hash(), 0),
|
||||
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_block.hash(), 0),
|
||||
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_block.hash()),
|
||||
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_block.hash()),
|
||||
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_block.hash()),
|
||||
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_block.hash()),
|
||||
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_block.hash()),
|
||||
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_block.hash()),
|
||||
];
|
||||
|
||||
assert_eq!(
|
||||
|
@ -1288,12 +1278,12 @@ mod tests {
|
|||
let pubkey = Pubkey::new_rand();
|
||||
|
||||
let transactions = vec![
|
||||
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_block.hash(), 0),
|
||||
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_block.hash(), 0),
|
||||
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_block.hash(), 0),
|
||||
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_block.hash(), 0),
|
||||
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_block.hash(), 0),
|
||||
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_block.hash(), 0),
|
||||
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_block.hash()),
|
||||
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_block.hash()),
|
||||
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_block.hash()),
|
||||
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_block.hash()),
|
||||
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_block.hash()),
|
||||
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_block.hash()),
|
||||
];
|
||||
|
||||
assert_eq!(
|
||||
|
@ -1406,7 +1396,6 @@ mod tests {
|
|||
&pubkey,
|
||||
1,
|
||||
genesis_block.hash(),
|
||||
0,
|
||||
)];
|
||||
|
||||
let working_bank = WorkingBank {
|
||||
|
@ -1462,7 +1451,6 @@ mod tests {
|
|||
&pubkey,
|
||||
2,
|
||||
genesis_block.hash(),
|
||||
0,
|
||||
)];
|
||||
|
||||
assert_matches!(
|
||||
|
@ -1490,8 +1478,8 @@ mod tests {
|
|||
let pubkey1 = Pubkey::new_rand();
|
||||
|
||||
let transactions = vec![
|
||||
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_block.hash(), 0),
|
||||
system_transaction::transfer(&mint_keypair, &pubkey1, 1, genesis_block.hash(), 0),
|
||||
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_block.hash()),
|
||||
system_transaction::transfer(&mint_keypair, &pubkey1, 1, genesis_block.hash()),
|
||||
];
|
||||
|
||||
let working_bank = WorkingBank {
|
||||
|
|
|
@ -183,10 +183,8 @@ mod test {
|
|||
|
||||
let keypair0 = Keypair::new();
|
||||
let keypair1 = Keypair::new();
|
||||
let tx0 =
|
||||
system_transaction::transfer(&keypair0, &keypair1.pubkey(), 1, Hash::default(), 0);
|
||||
let tx1 =
|
||||
system_transaction::transfer(&keypair1, &keypair0.pubkey(), 2, Hash::default(), 0);
|
||||
let tx0 = system_transaction::transfer(&keypair0, &keypair1.pubkey(), 1, Hash::default());
|
||||
let tx1 = system_transaction::transfer(&keypair1, &keypair0.pubkey(), 2, Hash::default());
|
||||
let serialized_tx0 = serialize(&tx0).unwrap();
|
||||
let serialized_tx1 = serialize(&tx1).unwrap();
|
||||
let entry = Entry::new(&Hash::default(), 1, vec![tx0, tx1]);
|
||||
|
|
|
@ -146,7 +146,6 @@ mod test {
|
|||
&keypair.pubkey(),
|
||||
1,
|
||||
Hash::default(),
|
||||
0,
|
||||
);
|
||||
let entry = Entry::new(&mut blockhash, 1, vec![tx]);
|
||||
blockhash = entry.hash;
|
||||
|
|
|
@ -576,7 +576,6 @@ mod tests {
|
|||
&keypair.pubkey(),
|
||||
1,
|
||||
slot_entries.last().unwrap().hash,
|
||||
0,
|
||||
);
|
||||
|
||||
// First, ensure the TX is rejected because of the unregistered last ID
|
||||
|
@ -611,7 +610,6 @@ mod tests {
|
|||
&keypair.pubkey(),
|
||||
1,
|
||||
blockhash,
|
||||
0,
|
||||
);
|
||||
let entry = Entry::new(&last_entry_hash, 1, vec![tx]);
|
||||
last_entry_hash = entry.hash;
|
||||
|
@ -625,7 +623,6 @@ mod tests {
|
|||
&keypair2.pubkey(),
|
||||
42,
|
||||
blockhash,
|
||||
0,
|
||||
);
|
||||
let entry = Entry::new(&last_entry_hash, 1, vec![tx]);
|
||||
last_entry_hash = entry.hash;
|
||||
|
@ -712,7 +709,6 @@ mod tests {
|
|||
&keypair1.pubkey(),
|
||||
2,
|
||||
bank.last_blockhash(),
|
||||
0,
|
||||
);
|
||||
let entry_1 = next_entry(&blockhash, 1, vec![tx]);
|
||||
let tx = system_transaction::create_user_account(
|
||||
|
@ -720,7 +716,6 @@ mod tests {
|
|||
&keypair2.pubkey(),
|
||||
2,
|
||||
bank.last_blockhash(),
|
||||
0,
|
||||
);
|
||||
let entry_2 = next_entry(&entry_1.hash, 1, vec![tx]);
|
||||
assert_eq!(process_entries(&bank, &[entry_1, entry_2]), Ok(()));
|
||||
|
@ -750,7 +745,6 @@ mod tests {
|
|||
&mint_keypair.pubkey(),
|
||||
1,
|
||||
bank.last_blockhash(),
|
||||
0,
|
||||
)],
|
||||
);
|
||||
|
||||
|
@ -763,14 +757,12 @@ mod tests {
|
|||
&keypair3.pubkey(),
|
||||
2,
|
||||
bank.last_blockhash(),
|
||||
0,
|
||||
), // should be fine
|
||||
system_transaction::create_user_account(
|
||||
&keypair1,
|
||||
&mint_keypair.pubkey(),
|
||||
2,
|
||||
bank.last_blockhash(),
|
||||
0,
|
||||
), // will collide
|
||||
],
|
||||
);
|
||||
|
@ -809,14 +801,12 @@ mod tests {
|
|||
&mint_keypair.pubkey(),
|
||||
1,
|
||||
bank.last_blockhash(),
|
||||
0,
|
||||
),
|
||||
system_transaction::transfer(
|
||||
&keypair4,
|
||||
&keypair4.pubkey(),
|
||||
1,
|
||||
Hash::default(), // Should cause a transaction failure with BlockhashNotFound
|
||||
0,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
@ -830,14 +820,12 @@ mod tests {
|
|||
&keypair3.pubkey(),
|
||||
2,
|
||||
bank.last_blockhash(),
|
||||
0,
|
||||
), // should be fine
|
||||
system_transaction::create_user_account(
|
||||
&keypair1,
|
||||
&mint_keypair.pubkey(),
|
||||
2,
|
||||
bank.last_blockhash(),
|
||||
0,
|
||||
), // will collide
|
||||
],
|
||||
);
|
||||
|
@ -882,7 +870,6 @@ mod tests {
|
|||
&keypair1.pubkey(),
|
||||
1,
|
||||
bank.last_blockhash(),
|
||||
0,
|
||||
);
|
||||
assert_eq!(bank.process_transaction(&tx), Ok(()));
|
||||
let tx = system_transaction::create_user_account(
|
||||
|
@ -890,7 +877,6 @@ mod tests {
|
|||
&keypair2.pubkey(),
|
||||
1,
|
||||
bank.last_blockhash(),
|
||||
0,
|
||||
);
|
||||
assert_eq!(bank.process_transaction(&tx), Ok(()));
|
||||
|
||||
|
@ -901,7 +887,6 @@ mod tests {
|
|||
&keypair3.pubkey(),
|
||||
1,
|
||||
bank.last_blockhash(),
|
||||
0,
|
||||
);
|
||||
let entry_1 = next_entry(&blockhash, 1, vec![tx]);
|
||||
let tx = system_transaction::create_user_account(
|
||||
|
@ -909,7 +894,6 @@ mod tests {
|
|||
&keypair4.pubkey(),
|
||||
1,
|
||||
bank.last_blockhash(),
|
||||
0,
|
||||
);
|
||||
let entry_2 = next_entry(&entry_1.hash, 1, vec![tx]);
|
||||
assert_eq!(process_entries(&bank, &[entry_1, entry_2]), Ok(()));
|
||||
|
@ -933,7 +917,6 @@ mod tests {
|
|||
&keypair1.pubkey(),
|
||||
1,
|
||||
bank.last_blockhash(),
|
||||
0,
|
||||
);
|
||||
assert_eq!(bank.process_transaction(&tx), Ok(()));
|
||||
let tx = system_transaction::create_user_account(
|
||||
|
@ -941,7 +924,6 @@ mod tests {
|
|||
&keypair2.pubkey(),
|
||||
1,
|
||||
bank.last_blockhash(),
|
||||
0,
|
||||
);
|
||||
assert_eq!(bank.process_transaction(&tx), Ok(()));
|
||||
|
||||
|
@ -952,7 +934,7 @@ mod tests {
|
|||
|
||||
// ensure bank can process 2 entries that do not have a common account and tick is registered
|
||||
let tx =
|
||||
system_transaction::create_user_account(&keypair2, &keypair3.pubkey(), 1, blockhash, 0);
|
||||
system_transaction::create_user_account(&keypair2, &keypair3.pubkey(), 1, blockhash);
|
||||
let entry_1 = next_entry(&blockhash, 1, vec![tx]);
|
||||
let tick = next_entry(&entry_1.hash, 1, vec![]);
|
||||
let tx = system_transaction::create_user_account(
|
||||
|
@ -960,7 +942,6 @@ mod tests {
|
|||
&keypair4.pubkey(),
|
||||
1,
|
||||
bank.last_blockhash(),
|
||||
0,
|
||||
);
|
||||
let entry_2 = next_entry(&tick.hash, 1, vec![tx]);
|
||||
assert_eq!(
|
||||
|
@ -976,7 +957,6 @@ mod tests {
|
|||
&keypair3.pubkey(),
|
||||
1,
|
||||
bank.last_blockhash(),
|
||||
0,
|
||||
);
|
||||
let entry_3 = next_entry(&entry_2.hash, 1, vec![tx]);
|
||||
assert_eq!(
|
||||
|
@ -1007,13 +987,8 @@ mod tests {
|
|||
);
|
||||
|
||||
// Make sure other errors don't update the signature cache
|
||||
let tx = system_transaction::create_user_account(
|
||||
&mint_keypair,
|
||||
&pubkey,
|
||||
1000,
|
||||
Hash::default(),
|
||||
0,
|
||||
);
|
||||
let tx =
|
||||
system_transaction::create_user_account(&mint_keypair, &pubkey, 1000, Hash::default());
|
||||
let signature = tx.signatures[0];
|
||||
|
||||
// Should fail with blockhash not found
|
||||
|
@ -1040,14 +1015,12 @@ mod tests {
|
|||
&keypair1.pubkey(),
|
||||
1,
|
||||
bank.last_blockhash(),
|
||||
0,
|
||||
);
|
||||
let fail_tx = system_transaction::create_user_account(
|
||||
&mint_keypair,
|
||||
&keypair2.pubkey(),
|
||||
2,
|
||||
bank.last_blockhash(),
|
||||
0,
|
||||
);
|
||||
|
||||
let entry_1_to_mint = next_entry(
|
||||
|
@ -1099,7 +1072,6 @@ mod tests {
|
|||
&keypairs[i + NUM_TRANSFERS].pubkey(),
|
||||
1,
|
||||
bank.last_blockhash(),
|
||||
0,
|
||||
)],
|
||||
)
|
||||
})
|
||||
|
@ -1117,7 +1089,6 @@ mod tests {
|
|||
&keypairs[i].pubkey(),
|
||||
1,
|
||||
bank.last_blockhash(),
|
||||
0,
|
||||
)],
|
||||
)
|
||||
})
|
||||
|
|
|
@ -122,7 +122,6 @@ mod tests {
|
|||
&keypair.pubkey(),
|
||||
1,
|
||||
one,
|
||||
0,
|
||||
)],
|
||||
)
|
||||
})
|
||||
|
|
|
@ -41,13 +41,8 @@ pub fn spend_and_verify_all_nodes(
|
|||
.expect("balance in source");
|
||||
assert!(bal > 0);
|
||||
let (blockhash, _fee_calculator) = client.get_recent_blockhash().unwrap();
|
||||
let mut transaction = system_transaction::transfer(
|
||||
&funding_keypair,
|
||||
&random_keypair.pubkey(),
|
||||
1,
|
||||
blockhash,
|
||||
0,
|
||||
);
|
||||
let mut transaction =
|
||||
system_transaction::transfer(&funding_keypair, &random_keypair.pubkey(), 1, blockhash);
|
||||
let confs = VOTE_THRESHOLD_DEPTH + 1;
|
||||
let sig = client
|
||||
.retry_transfer_until_confirmed(&funding_keypair, &mut transaction, 5, confs)
|
||||
|
@ -68,13 +63,8 @@ pub fn send_many_transactions(node: &ContactInfo, funding_keypair: &Keypair, num
|
|||
.expect("balance in source");
|
||||
assert!(bal > 0);
|
||||
let (blockhash, _fee_calculator) = client.get_recent_blockhash().unwrap();
|
||||
let mut transaction = system_transaction::transfer(
|
||||
&funding_keypair,
|
||||
&random_keypair.pubkey(),
|
||||
1,
|
||||
blockhash,
|
||||
0,
|
||||
);
|
||||
let mut transaction =
|
||||
system_transaction::transfer(&funding_keypair, &random_keypair.pubkey(), 1, blockhash);
|
||||
client
|
||||
.retry_transfer(&funding_keypair, &mut transaction, 5)
|
||||
.unwrap();
|
||||
|
@ -190,7 +180,6 @@ pub fn kill_entry_and_spend_and_verify_rest(
|
|||
&random_keypair.pubkey(),
|
||||
1,
|
||||
blockhash,
|
||||
0,
|
||||
);
|
||||
|
||||
let confs = VOTE_THRESHOLD_DEPTH + 1;
|
||||
|
|
|
@ -482,8 +482,8 @@ mod tests {
|
|||
|
||||
// First, verify entries
|
||||
let keypair = Keypair::new();
|
||||
let tx0 = system_transaction::create_user_account(&keypair, &keypair.pubkey(), 0, zero, 0);
|
||||
let tx1 = system_transaction::create_user_account(&keypair, &keypair.pubkey(), 1, zero, 0);
|
||||
let tx0 = system_transaction::create_user_account(&keypair, &keypair.pubkey(), 0, zero);
|
||||
let tx1 = system_transaction::create_user_account(&keypair, &keypair.pubkey(), 1, zero);
|
||||
let mut e0 = Entry::new(&zero, 0, vec![tx0.clone(), tx1.clone()]);
|
||||
assert!(e0.verify(&zero));
|
||||
|
||||
|
@ -533,7 +533,7 @@ mod tests {
|
|||
fn test_next_entry_panic() {
|
||||
let zero = Hash::default();
|
||||
let keypair = Keypair::new();
|
||||
let tx = system_transaction::create_user_account(&keypair, &keypair.pubkey(), 0, zero, 0);
|
||||
let tx = system_transaction::create_user_account(&keypair, &keypair.pubkey(), 0, zero);
|
||||
next_entry(&zero, 0, vec![tx]);
|
||||
}
|
||||
|
||||
|
@ -541,7 +541,7 @@ mod tests {
|
|||
fn test_serialized_to_blob_size() {
|
||||
let zero = Hash::default();
|
||||
let keypair = Keypair::new();
|
||||
let tx = system_transaction::create_user_account(&keypair, &keypair.pubkey(), 0, zero, 0);
|
||||
let tx = system_transaction::create_user_account(&keypair, &keypair.pubkey(), 0, zero);
|
||||
let entry = next_entry(&zero, 1, vec![tx.clone()]);
|
||||
assert_eq!(
|
||||
Entry::serialized_to_blob_size(&[tx]),
|
||||
|
|
|
@ -361,7 +361,6 @@ impl LocalCluster {
|
|||
dest_pubkey,
|
||||
lamports,
|
||||
blockhash,
|
||||
0,
|
||||
);
|
||||
info!(
|
||||
"executing transfer of {} from {} to {}",
|
||||
|
|
|
@ -676,7 +676,7 @@ mod tests {
|
|||
fn test_to_packets() {
|
||||
let keypair = Keypair::new();
|
||||
let hash = Hash::new(&[1; 32]);
|
||||
let tx = system_transaction::create_user_account(&keypair, &keypair.pubkey(), 1, hash, 0);
|
||||
let tx = system_transaction::create_user_account(&keypair, &keypair.pubkey(), 1, hash);
|
||||
let rv = to_packets(&vec![tx.clone(); 1]);
|
||||
assert_eq!(rv.len(), 1);
|
||||
assert_eq!(rv[0].packets.len(), 1);
|
||||
|
|
|
@ -422,7 +422,6 @@ impl Replicator {
|
|||
1,
|
||||
1024 * 4, // TODO the account space needs to be well defined somewhere
|
||||
&solana_storage_api::id(),
|
||||
0,
|
||||
);
|
||||
let signature = client.async_send_transaction(tx)?;
|
||||
client
|
||||
|
|
|
@ -499,10 +499,10 @@ mod tests {
|
|||
let exit = Arc::new(AtomicBool::new(false));
|
||||
|
||||
let blockhash = bank.confirmed_last_blockhash();
|
||||
let tx = system_transaction::transfer(&alice, pubkey, 20, blockhash, 0);
|
||||
let tx = system_transaction::transfer(&alice, pubkey, 20, blockhash);
|
||||
bank.process_transaction(&tx).expect("process transaction");
|
||||
|
||||
let tx = system_transaction::transfer(&alice, &alice.pubkey(), 20, blockhash, 0);
|
||||
let tx = system_transaction::transfer(&alice, &alice.pubkey(), 20, blockhash);
|
||||
let _ = bank.process_transaction(&tx);
|
||||
|
||||
let request_processor = Arc::new(RwLock::new(JsonRpcRequestProcessor::new(
|
||||
|
@ -542,7 +542,7 @@ mod tests {
|
|||
);
|
||||
thread::spawn(move || {
|
||||
let blockhash = bank.confirmed_last_blockhash();
|
||||
let tx = system_transaction::transfer(&alice, &bob_pubkey, 20, blockhash, 0);
|
||||
let tx = system_transaction::transfer(&alice, &bob_pubkey, 20, blockhash);
|
||||
bank.process_transaction(&tx).expect("process transaction");
|
||||
})
|
||||
.join()
|
||||
|
@ -650,7 +650,7 @@ mod tests {
|
|||
fn test_rpc_confirm_tx() {
|
||||
let bob_pubkey = Pubkey::new_rand();
|
||||
let (io, meta, blockhash, alice, _leader_id) = start_rpc_handler_with_tx(&bob_pubkey);
|
||||
let tx = system_transaction::transfer(&alice, &bob_pubkey, 20, blockhash, 0);
|
||||
let tx = system_transaction::transfer(&alice, &bob_pubkey, 20, blockhash);
|
||||
|
||||
let req = format!(
|
||||
r#"{{"jsonrpc":"2.0","id":1,"method":"confirmTransaction","params":["{}"]}}"#,
|
||||
|
@ -669,7 +669,7 @@ mod tests {
|
|||
fn test_rpc_get_signature_status() {
|
||||
let bob_pubkey = Pubkey::new_rand();
|
||||
let (io, meta, blockhash, alice, _leader_id) = start_rpc_handler_with_tx(&bob_pubkey);
|
||||
let tx = system_transaction::transfer(&alice, &bob_pubkey, 20, blockhash, 0);
|
||||
let tx = system_transaction::transfer(&alice, &bob_pubkey, 20, blockhash);
|
||||
|
||||
let req = format!(
|
||||
r#"{{"jsonrpc":"2.0","id":1,"method":"getSignatureStatus","params":["{}"]}}"#,
|
||||
|
@ -689,7 +689,7 @@ mod tests {
|
|||
assert_eq!(expected, result);
|
||||
|
||||
// Test getSignatureStatus request on unprocessed tx
|
||||
let tx = system_transaction::transfer(&alice, &bob_pubkey, 10, blockhash, 0);
|
||||
let tx = system_transaction::transfer(&alice, &bob_pubkey, 10, blockhash);
|
||||
let req = format!(
|
||||
r#"{{"jsonrpc":"2.0","id":1,"method":"getSignatureStatus","params":["{}"]}}"#,
|
||||
tx.signatures[0]
|
||||
|
@ -708,7 +708,7 @@ mod tests {
|
|||
assert_eq!(expected, result);
|
||||
|
||||
// Test getSignatureStatus request on a TransactionError
|
||||
let tx = system_transaction::transfer(&alice, &alice.pubkey(), 20, blockhash, 0);
|
||||
let tx = system_transaction::transfer(&alice, &alice.pubkey(), 20, blockhash);
|
||||
let req = format!(
|
||||
r#"{{"jsonrpc":"2.0","id":1,"method":"getSignatureStatus","params":["{}"]}}"#,
|
||||
tx.signatures[0]
|
||||
|
@ -825,8 +825,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_rpc_verify_signature() {
|
||||
let tx =
|
||||
system_transaction::transfer(&Keypair::new(), &Pubkey::new_rand(), 20, hash(&[0]), 0);
|
||||
let tx = system_transaction::transfer(&Keypair::new(), &Pubkey::new_rand(), 20, hash(&[0]));
|
||||
assert_eq!(
|
||||
verify_signature(&tx.signatures[0].to_string()).unwrap(),
|
||||
tx.signatures[0]
|
||||
|
|
|
@ -298,7 +298,7 @@ mod tests {
|
|||
let rpc = RpcSolPubSubImpl::default();
|
||||
|
||||
// Test signature subscriptions
|
||||
let tx = system_transaction::transfer(&alice, &bob_pubkey, 20, blockhash, 0);
|
||||
let tx = system_transaction::transfer(&alice, &bob_pubkey, 20, blockhash);
|
||||
|
||||
let session = create_session();
|
||||
let (subscriber, _id_receiver, mut receiver) =
|
||||
|
@ -333,7 +333,7 @@ mod tests {
|
|||
let rpc = RpcSolPubSubImpl::default();
|
||||
io.extend_with(rpc.to_delegate());
|
||||
|
||||
let tx = system_transaction::transfer(&alice, &bob_pubkey, 20, blockhash, 0);
|
||||
let tx = system_transaction::transfer(&alice, &bob_pubkey, 20, blockhash);
|
||||
let req = format!(
|
||||
r#"{{"jsonrpc":"2.0","id":1,"method":"signatureSubscribe","params":["{}"]}}"#,
|
||||
tx.signatures[0].to_string()
|
||||
|
@ -395,7 +395,6 @@ mod tests {
|
|||
&contract_funds.pubkey(),
|
||||
51,
|
||||
blockhash,
|
||||
0,
|
||||
);
|
||||
process_transaction_and_notify(&bank_forks, &tx, &rpc.subscriptions).unwrap();
|
||||
|
||||
|
@ -439,8 +438,7 @@ mod tests {
|
|||
assert_eq!(serde_json::to_string(&expected).unwrap(), response);
|
||||
}
|
||||
|
||||
let tx =
|
||||
system_transaction::create_user_account(&alice, &witness.pubkey(), 1, blockhash, 0);
|
||||
let tx = system_transaction::create_user_account(&alice, &witness.pubkey(), 1, blockhash);
|
||||
process_transaction_and_notify(&bank_forks, &tx, &rpc.subscriptions).unwrap();
|
||||
sleep(Duration::from_millis(200));
|
||||
let ix = budget_instruction::apply_signature(
|
||||
|
@ -514,7 +512,7 @@ mod tests {
|
|||
let (subscriber, _id_receiver, mut receiver) = Subscriber::new_test("accountNotification");
|
||||
rpc.account_subscribe(session, subscriber, bob.pubkey().to_string(), Some(2));
|
||||
|
||||
let tx = system_transaction::transfer(&alice, &bob.pubkey(), 100, blockhash, 0);
|
||||
let tx = system_transaction::transfer(&alice, &bob.pubkey(), 100, blockhash);
|
||||
bank_forks
|
||||
.write()
|
||||
.unwrap()
|
||||
|
@ -539,7 +537,7 @@ mod tests {
|
|||
let (subscriber, _id_receiver, mut receiver) = Subscriber::new_test("accountNotification");
|
||||
rpc.account_subscribe(session, subscriber, bob.pubkey().to_string(), Some(2));
|
||||
|
||||
let tx = system_transaction::transfer(&alice, &bob.pubkey(), 100, blockhash, 0);
|
||||
let tx = system_transaction::transfer(&alice, &bob.pubkey(), 100, blockhash);
|
||||
bank_forks
|
||||
.write()
|
||||
.unwrap()
|
||||
|
|
|
@ -320,7 +320,6 @@ mod tests {
|
|||
1,
|
||||
16,
|
||||
&solana_budget_api::id(),
|
||||
0,
|
||||
);
|
||||
bank_forks
|
||||
.write()
|
||||
|
@ -372,7 +371,6 @@ mod tests {
|
|||
1,
|
||||
16,
|
||||
&solana_budget_api::id(),
|
||||
0,
|
||||
);
|
||||
bank_forks
|
||||
.write()
|
||||
|
@ -416,7 +414,7 @@ mod tests {
|
|||
let blockhash = bank.last_blockhash();
|
||||
let bank_forks = Arc::new(RwLock::new(BankForks::new(0, bank)));
|
||||
let alice = Keypair::new();
|
||||
let tx = system_transaction::transfer(&mint_keypair, &alice.pubkey(), 20, blockhash, 0);
|
||||
let tx = system_transaction::transfer(&mint_keypair, &alice.pubkey(), 20, blockhash);
|
||||
let signature = tx.signatures[0];
|
||||
bank_forks
|
||||
.write()
|
||||
|
|
|
@ -10,7 +10,7 @@ pub fn test_tx() -> Transaction {
|
|||
let keypair1 = Keypair::new();
|
||||
let pubkey1 = keypair1.pubkey();
|
||||
let zero = Hash::default();
|
||||
system_transaction::create_user_account(&keypair1, &pubkey1, 42, zero, 0)
|
||||
system_transaction::create_user_account(&keypair1, &pubkey1, 42, zero)
|
||||
}
|
||||
|
||||
pub fn test_multisig_tx() -> Transaction {
|
||||
|
|
|
@ -38,7 +38,7 @@ fn test_rpc_send_tx() {
|
|||
let blockhash: Hash = json["result"][0].as_str().unwrap().parse().unwrap();
|
||||
|
||||
info!("blockhash: {:?}", blockhash);
|
||||
let tx = system_transaction::transfer(&alice, &bob_pubkey, 20, blockhash, 0);
|
||||
let tx = system_transaction::transfer(&alice, &bob_pubkey, 20, blockhash);
|
||||
let serial_tx = serialize(&tx).unwrap();
|
||||
|
||||
let client = reqwest::Client::new();
|
||||
|
|
|
@ -154,7 +154,6 @@ fn test_replay() {
|
|||
&bob_keypair.pubkey(),
|
||||
transfer_amount,
|
||||
blockhash,
|
||||
0,
|
||||
);
|
||||
let entry_tick1 = next_entry_mut(&mut cur_hash, i + 1, vec![]);
|
||||
let entry1 = next_entry_mut(&mut cur_hash, i + num_transfers, vec![tx0]);
|
||||
|
|
|
@ -18,6 +18,6 @@ pub fn request_airdrop_transaction(
|
|||
let key = Keypair::new();
|
||||
let to = Pubkey::new_rand();
|
||||
let blockhash = Hash::default();
|
||||
let tx = system_transaction::create_user_account(&key, &to, lamports, blockhash, 0);
|
||||
let tx = system_transaction::create_user_account(&key, &to, lamports, blockhash);
|
||||
Ok(tx)
|
||||
}
|
||||
|
|
|
@ -762,7 +762,7 @@ impl Bank {
|
|||
/// `n` lamports where `blockhash` is the last Entry ID observed by the client.
|
||||
pub fn transfer(&self, n: u64, keypair: &Keypair, to: &Pubkey) -> Result<Signature> {
|
||||
let blockhash = self.last_blockhash();
|
||||
let tx = system_transaction::create_user_account(keypair, to, n, blockhash, 0);
|
||||
let tx = system_transaction::create_user_account(keypair, to, n, blockhash);
|
||||
let signature = tx.signatures[0];
|
||||
self.process_transaction(&tx).map(|_| signature)
|
||||
}
|
||||
|
@ -1032,8 +1032,8 @@ mod tests {
|
|||
let bank = Bank::new(&genesis_block);
|
||||
assert_eq!(bank.last_blockhash(), genesis_block.hash());
|
||||
|
||||
let t1 = system_transaction::transfer(&mint_keypair, &key1, 1, genesis_block.hash(), 0);
|
||||
let t2 = system_transaction::transfer(&mint_keypair, &key2, 1, genesis_block.hash(), 0);
|
||||
let t1 = system_transaction::transfer(&mint_keypair, &key1, 1, genesis_block.hash());
|
||||
let t2 = system_transaction::transfer(&mint_keypair, &key2, 1, genesis_block.hash());
|
||||
let res = bank.process_transactions(&vec![t1.clone(), t2.clone()]);
|
||||
assert_eq!(res.len(), 2);
|
||||
assert_eq!(res[0], Ok(()));
|
||||
|
@ -1106,7 +1106,6 @@ mod tests {
|
|||
&dest.pubkey(),
|
||||
2,
|
||||
genesis_block.hash(),
|
||||
0,
|
||||
);
|
||||
let signature = tx.signatures[0];
|
||||
assert!(!bank.has_signature(&signature));
|
||||
|
@ -1222,7 +1221,7 @@ mod tests {
|
|||
let key2 = Keypair::new();
|
||||
|
||||
let tx =
|
||||
system_transaction::transfer(&mint_keypair, &key1.pubkey(), 2, genesis_block.hash(), 0);
|
||||
system_transaction::transfer(&mint_keypair, &key1.pubkey(), 2, genesis_block.hash());
|
||||
let initial_balance = bank.get_balance(&leader);
|
||||
assert_eq!(bank.process_transaction(&tx), Ok(()));
|
||||
assert_eq!(bank.get_balance(&leader), initial_balance + 3);
|
||||
|
@ -1230,7 +1229,7 @@ mod tests {
|
|||
assert_eq!(bank.get_balance(&mint_keypair.pubkey()), 100 - 5);
|
||||
|
||||
bank.fee_calculator.lamports_per_signature = 1;
|
||||
let tx = system_transaction::transfer(&key1, &key2.pubkey(), 1, genesis_block.hash(), 0);
|
||||
let tx = system_transaction::transfer(&key1, &key2.pubkey(), 1, genesis_block.hash());
|
||||
|
||||
assert_eq!(bank.process_transaction(&tx), Ok(()));
|
||||
assert_eq!(bank.get_balance(&leader), initial_balance + 4);
|
||||
|
@ -1240,7 +1239,7 @@ mod tests {
|
|||
|
||||
// verify that an InstructionError collects fees, too
|
||||
let mut tx =
|
||||
system_transaction::transfer(&mint_keypair, &key2.pubkey(), 1, genesis_block.hash(), 0);
|
||||
system_transaction::transfer(&mint_keypair, &key2.pubkey(), 1, genesis_block.hash());
|
||||
// send a bogus instruction to system_program, cause an instruction error
|
||||
tx.message.instructions[0].data[0] = 40;
|
||||
|
||||
|
@ -1260,9 +1259,9 @@ mod tests {
|
|||
|
||||
let key = Keypair::new();
|
||||
let tx1 =
|
||||
system_transaction::transfer(&mint_keypair, &key.pubkey(), 2, genesis_block.hash(), 0);
|
||||
system_transaction::transfer(&mint_keypair, &key.pubkey(), 2, genesis_block.hash());
|
||||
let tx2 =
|
||||
system_transaction::transfer(&mint_keypair, &key.pubkey(), 5, genesis_block.hash(), 0);
|
||||
system_transaction::transfer(&mint_keypair, &key.pubkey(), 5, genesis_block.hash());
|
||||
|
||||
let results = vec![
|
||||
Ok(()),
|
||||
|
@ -1290,14 +1289,12 @@ mod tests {
|
|||
&keypair.pubkey(),
|
||||
2,
|
||||
genesis_block.hash(),
|
||||
0,
|
||||
);
|
||||
let tx1 = system_transaction::create_user_account(
|
||||
&keypair,
|
||||
&mint_keypair.pubkey(),
|
||||
1,
|
||||
genesis_block.hash(),
|
||||
0,
|
||||
);
|
||||
let txs = vec![tx0, tx1];
|
||||
let results = bank.process_transactions(&txs);
|
||||
|
@ -1319,7 +1316,6 @@ mod tests {
|
|||
&alice.pubkey(),
|
||||
1,
|
||||
genesis_block.hash(),
|
||||
0,
|
||||
);
|
||||
let pay_alice = vec![tx1];
|
||||
|
||||
|
@ -1354,13 +1350,8 @@ mod tests {
|
|||
let keypair = Keypair::new();
|
||||
let bank = Bank::new(&genesis_block);
|
||||
|
||||
let tx = system_transaction::transfer(
|
||||
&mint_keypair,
|
||||
&keypair.pubkey(),
|
||||
1,
|
||||
genesis_block.hash(),
|
||||
0,
|
||||
);
|
||||
let tx =
|
||||
system_transaction::transfer(&mint_keypair, &keypair.pubkey(), 1, genesis_block.hash());
|
||||
|
||||
let mut tx_invalid_program_index = tx.clone();
|
||||
tx_invalid_program_index.message.instructions[0].program_ids_index = 42;
|
||||
|
@ -1385,7 +1376,7 @@ mod tests {
|
|||
|
||||
bank.transfer(1, &mint_keypair, &key1.pubkey()).unwrap();
|
||||
assert_eq!(bank.get_balance(&key1.pubkey()), 1);
|
||||
let tx = system_transaction::transfer(&key1, &key1.pubkey(), 1, genesis_block.hash(), 0);
|
||||
let tx = system_transaction::transfer(&key1, &key1.pubkey(), 1, genesis_block.hash());
|
||||
let res = bank.process_transactions(&vec![tx.clone()]);
|
||||
assert_eq!(res.len(), 1);
|
||||
assert_eq!(bank.get_balance(&key1.pubkey()), 1);
|
||||
|
@ -1420,7 +1411,7 @@ mod tests {
|
|||
let parent = Arc::new(Bank::new(&genesis_block));
|
||||
|
||||
let tx =
|
||||
system_transaction::transfer(&mint_keypair, &key1.pubkey(), 1, genesis_block.hash(), 0);
|
||||
system_transaction::transfer(&mint_keypair, &key1.pubkey(), 1, genesis_block.hash());
|
||||
assert_eq!(parent.process_transaction(&tx), Ok(()));
|
||||
let bank = new_from_parent(&parent);
|
||||
assert_eq!(
|
||||
|
@ -1438,10 +1429,10 @@ mod tests {
|
|||
let parent = Arc::new(Bank::new(&genesis_block));
|
||||
|
||||
let tx =
|
||||
system_transaction::transfer(&mint_keypair, &key1.pubkey(), 1, genesis_block.hash(), 0);
|
||||
system_transaction::transfer(&mint_keypair, &key1.pubkey(), 1, genesis_block.hash());
|
||||
assert_eq!(parent.process_transaction(&tx), Ok(()));
|
||||
let bank = new_from_parent(&parent);
|
||||
let tx = system_transaction::transfer(&key1, &key2.pubkey(), 1, genesis_block.hash(), 0);
|
||||
let tx = system_transaction::transfer(&key1, &key2.pubkey(), 1, genesis_block.hash());
|
||||
assert_eq!(bank.process_transaction(&tx), Ok(()));
|
||||
assert_eq!(parent.get_signature_status(&tx.signatures[0]), None);
|
||||
}
|
||||
|
@ -1499,7 +1490,7 @@ mod tests {
|
|||
let parent = Arc::new(Bank::new(&genesis_block));
|
||||
|
||||
let tx_transfer_mint_to_1 =
|
||||
system_transaction::transfer(&mint_keypair, &key1.pubkey(), 1, genesis_block.hash(), 0);
|
||||
system_transaction::transfer(&mint_keypair, &key1.pubkey(), 1, genesis_block.hash());
|
||||
trace!("parent process tx ");
|
||||
assert_eq!(parent.process_transaction(&tx_transfer_mint_to_1), Ok(()));
|
||||
trace!("done parent process tx ");
|
||||
|
@ -1519,7 +1510,7 @@ mod tests {
|
|||
|
||||
assert_eq!(bank.transaction_count(), parent.transaction_count());
|
||||
let tx_transfer_1_to_2 =
|
||||
system_transaction::transfer(&key1, &key2.pubkey(), 1, genesis_block.hash(), 0);
|
||||
system_transaction::transfer(&key1, &key2.pubkey(), 1, genesis_block.hash());
|
||||
assert_eq!(bank.process_transaction(&tx_transfer_1_to_2), Ok(()));
|
||||
assert_eq!(bank.transaction_count(), 2);
|
||||
assert_eq!(parent.transaction_count(), 1);
|
||||
|
@ -1727,7 +1718,7 @@ mod tests {
|
|||
let bank = Arc::new(Bank::new(&genesis_block));
|
||||
let key1 = Keypair::new();
|
||||
let tx_transfer_mint_to_1 =
|
||||
system_transaction::transfer(&mint_keypair, &key1.pubkey(), 1, genesis_block.hash(), 0);
|
||||
system_transaction::transfer(&mint_keypair, &key1.pubkey(), 1, genesis_block.hash());
|
||||
assert_eq!(bank.process_transaction(&tx_transfer_mint_to_1), Ok(()));
|
||||
assert_eq!(bank.is_delta.load(Ordering::Relaxed), true);
|
||||
}
|
||||
|
@ -1741,7 +1732,7 @@ mod tests {
|
|||
|
||||
// Set is_delta to true
|
||||
let tx_transfer_mint_to_1 =
|
||||
system_transaction::transfer(&mint_keypair, &key1.pubkey(), 1, genesis_block.hash(), 0);
|
||||
system_transaction::transfer(&mint_keypair, &key1.pubkey(), 1, genesis_block.hash());
|
||||
assert_eq!(bank.process_transaction(&tx_transfer_mint_to_1), Ok(()));
|
||||
assert_eq!(bank.is_votable(), false);
|
||||
|
||||
|
@ -1770,7 +1761,6 @@ mod tests {
|
|||
&Keypair::new().pubkey(),
|
||||
1,
|
||||
genesis_block.hash(),
|
||||
0
|
||||
)),
|
||||
Ok(())
|
||||
);
|
||||
|
@ -1868,7 +1858,6 @@ mod tests {
|
|||
&keypair2.pubkey(),
|
||||
1,
|
||||
bank.last_blockhash(),
|
||||
0,
|
||||
);
|
||||
|
||||
// Should fail with TransactionError::AccountNotFound, which means
|
||||
|
|
|
@ -117,8 +117,8 @@ mod tests {
|
|||
let pubkey2 = Pubkey::new_rand();
|
||||
|
||||
let txs = vec![
|
||||
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_block.hash(), 0),
|
||||
system_transaction::transfer(&keypair2, &pubkey2, 1, genesis_block.hash(), 0),
|
||||
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_block.hash()),
|
||||
system_transaction::transfer(&keypair2, &pubkey2, 1, genesis_block.hash()),
|
||||
];
|
||||
|
||||
(bank, txs)
|
||||
|
|
|
@ -15,7 +15,6 @@ pub fn create_account(
|
|||
lamports: u64,
|
||||
space: u64,
|
||||
program_id: &Pubkey,
|
||||
_fee: u64,
|
||||
) -> Transaction {
|
||||
let from_pubkey = from_keypair.pubkey();
|
||||
let create_instruction =
|
||||
|
@ -30,27 +29,13 @@ pub fn create_user_account(
|
|||
to: &Pubkey,
|
||||
lamports: u64,
|
||||
recent_blockhash: Hash,
|
||||
fee: u64,
|
||||
) -> Transaction {
|
||||
let program_id = system_program::id();
|
||||
create_account(
|
||||
from_keypair,
|
||||
to,
|
||||
recent_blockhash,
|
||||
lamports,
|
||||
0,
|
||||
&program_id,
|
||||
fee,
|
||||
)
|
||||
create_account(from_keypair, to, recent_blockhash, lamports, 0, &program_id)
|
||||
}
|
||||
|
||||
/// Create and sign new system_instruction::Assign transaction
|
||||
pub fn assign(
|
||||
from_keypair: &Keypair,
|
||||
recent_blockhash: Hash,
|
||||
program_id: &Pubkey,
|
||||
_fee: u64,
|
||||
) -> Transaction {
|
||||
pub fn assign(from_keypair: &Keypair, recent_blockhash: Hash, program_id: &Pubkey) -> Transaction {
|
||||
let from_pubkey = from_keypair.pubkey();
|
||||
let assign_instruction = system_instruction::assign(&from_pubkey, program_id);
|
||||
let instructions = vec![assign_instruction];
|
||||
|
@ -63,7 +48,6 @@ pub fn transfer(
|
|||
to: &Pubkey,
|
||||
lamports: u64,
|
||||
recent_blockhash: Hash,
|
||||
_fee: u64,
|
||||
) -> Transaction {
|
||||
let from_pubkey = from_keypair.pubkey();
|
||||
let transfer_instruction = system_instruction::transfer(&from_pubkey, to, lamports);
|
||||
|
|
|
@ -543,7 +543,6 @@ fn process_deploy(
|
|||
1,
|
||||
program_data.len() as u64,
|
||||
&bpf_loader::id(),
|
||||
0,
|
||||
);
|
||||
trace!("Creating program account");
|
||||
let result = rpc_client.send_and_confirm_transaction(&mut tx, &[&config.keypair]);
|
||||
|
@ -598,7 +597,7 @@ fn process_pay(
|
|||
let (blockhash, _fee_calculator) = rpc_client.get_recent_blockhash()?;
|
||||
|
||||
if timestamp == None && *witnesses == None {
|
||||
let mut tx = system_transaction::transfer(&config.keypair, to, lamports, blockhash, 0);
|
||||
let mut tx = system_transaction::transfer(&config.keypair, to, lamports, blockhash);
|
||||
let result = rpc_client.send_and_confirm_transaction(&mut tx, &[&config.keypair]);
|
||||
let signature_str = log_instruction_custom_error::<SystemError>(result)?;
|
||||
Ok(signature_str.to_string())
|
||||
|
|
Loading…
Reference in New Issue