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

Commit 7b742e0

Browse files
committed
fix order of fn def, test nit
1 parent f002faf commit 7b742e0

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

src/system_program.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,11 @@ mod test {
217217
#[test]
218218
fn test_load_call() {
219219
// first load the program
220-
let program_id = Pubkey::default(); // same program id for both
221220
let loaded_programs = RwLock::new(HashMap::new());
222221
{
223222
let from = Keypair::new();
224223
let mut accounts = vec![Account::default()];
224+
let program_id = Pubkey::default(); // same program id for both
225225
let tx = Transaction::system_load(
226226
&from,
227227
Hash::default(),
@@ -234,6 +234,7 @@ mod test {
234234
}
235235
// then call the program
236236
{
237+
let program_id = Pubkey::default(); // same program id for both
237238
let keys = vec![Pubkey::default(), Pubkey::default()];
238239
let mut accounts = vec![Account::default(), Account::default()];
239240
accounts[0].tokens = 100;

src/transaction.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -195,24 +195,6 @@ impl Transaction {
195195
fee,
196196
)
197197
}
198-
/// Create and sign new SystemProgram::Load transaction
199-
pub fn system_load(
200-
from_keypair: &Keypair,
201-
last_id: Hash,
202-
fee: i64,
203-
program_id: Pubkey,
204-
name: String,
205-
) -> Self {
206-
let load = SystemProgram::Load { program_id, name };
207-
Transaction::new_with_userdata(
208-
from_keypair,
209-
&[],
210-
SystemProgram::id(),
211-
serialize(&load).unwrap(),
212-
last_id,
213-
fee,
214-
)
215-
}
216198
/// Create and sign new SystemProgram::CreateAccount transaction
217199
pub fn system_assign(
218200
from_keypair: &Keypair,
@@ -252,6 +234,24 @@ impl Transaction {
252234
fee,
253235
)
254236
}
237+
/// Create and sign new SystemProgram::Load transaction
238+
pub fn system_load(
239+
from_keypair: &Keypair,
240+
last_id: Hash,
241+
fee: i64,
242+
program_id: Pubkey,
243+
name: String,
244+
) -> Self {
245+
let load = SystemProgram::Load { program_id, name };
246+
Transaction::new_with_userdata(
247+
from_keypair,
248+
&[],
249+
SystemProgram::id(),
250+
serialize(&load).unwrap(),
251+
last_id,
252+
fee,
253+
)
254+
}
255255
/// Create and sign new SystemProgram::Move transaction
256256
pub fn new(from_keypair: &Keypair, to: Pubkey, tokens: i64, last_id: Hash) -> Self {
257257
Transaction::system_move(from_keypair, to, tokens, last_id, 0)

0 commit comments

Comments
 (0)