@@ -51,8 +51,7 @@ fn main() {
51
51
52
52
// iget and print each Product in Mapping directory
53
53
let mut i = 0 ;
54
- for prod_akey in & map_acct. products {
55
- let prod_pkey = Pubkey :: new ( & prod_akey. val ) ;
54
+ for prod_pkey in & map_acct. products {
56
55
let prod_data = clnt. get_account_data ( & prod_pkey) . unwrap ( ) ;
57
56
let prod_acct = load_product_account ( & prod_data) . unwrap ( ) ;
58
57
@@ -65,8 +64,8 @@ fn main() {
65
64
}
66
65
67
66
// print all Prices that correspond to this Product
68
- if prod_acct. px_acc . is_valid ( ) {
69
- let mut px_pkey = Pubkey :: new ( & prod_acct. px_acc . val ) ;
67
+ if prod_acct. px_acc != Pubkey :: default ( ) {
68
+ let mut px_pkey = prod_acct. px_acc ;
70
69
loop {
71
70
let price_data = clnt. get_account_data ( & px_pkey) . unwrap ( ) ;
72
71
let price_account = load_price_account ( & price_data) . unwrap ( ) ;
@@ -120,8 +119,8 @@ fn main() {
120
119
}
121
120
122
121
// go to next price account in list
123
- if price_account. next . is_valid ( ) {
124
- px_pkey = Pubkey :: new ( & price_account. next . val ) ;
122
+ if price_account. next != Pubkey :: default ( ) {
123
+ px_pkey = price_account. next ;
125
124
} else {
126
125
break ;
127
126
}
@@ -135,9 +134,9 @@ fn main() {
135
134
}
136
135
137
136
// go to next Mapping account in list
138
- if ! map_acct. next . is_valid ( ) {
137
+ if map_acct. next == Pubkey :: default ( ) {
139
138
break ;
140
139
}
141
- akey = Pubkey :: new ( & map_acct. next . val ) ;
140
+ akey = map_acct. next ;
142
141
}
143
142
}
0 commit comments