@@ -515,7 +515,7 @@ impl ChannelHandler {
515
515
self . create_conditions_and_signature_of_channel_coin ( env, state_number_for_spend) ?;
516
516
517
517
let new_game_coins_on_chain: Vec < ( PuzzleHash , Amount ) > = self
518
- . get_new_game_coins_on_chain ( env, None , None , None )
518
+ . get_new_game_coins_on_chain ( env, None , & [ ] , None )
519
519
. iter ( )
520
520
. filter_map ( |ngc| ngc. coin_string_up . as_ref ( ) . and_then ( |c| c. to_parts ( ) ) )
521
521
. map ( |( _, puzzle_hash, amount) | ( puzzle_hash, amount) )
@@ -1141,48 +1141,46 @@ impl ChannelHandler {
1141
1141
} ,
1142
1142
false ,
1143
1143
) )
1144
- } else {
1145
- if state_number == self . unroll_state_number {
1146
- // Timeout
1147
- let ( curried_unroll_puzzle, unroll_puzzle_solution) = self
1148
- . make_unroll_puzzle_solution (
1149
- env,
1150
- self . default_conditions_for_unroll_coin_spend . to_nodeptr ( ) ,
1151
- ) ?;
1152
-
1153
- Ok ( (
1154
- TransactionBundle {
1155
- puzzle : Puzzle :: from_nodeptr ( curried_unroll_puzzle) ,
1156
- solution : unroll_puzzle_solution,
1157
- signature : Aggsig :: default ( ) ,
1158
- } ,
1159
- true ,
1160
- ) )
1161
- } else if state_number == self . current_state_number {
1162
- // Different timeout, construct the conditions based on the current
1163
- // state. (different because we're not using the conditions we
1164
- // have cached).
1165
- let ( conditions, _) = self . create_conditions_and_signature_of_channel_coin (
1144
+ } else if state_number == self . unroll_state_number {
1145
+ // Timeout
1146
+ let ( curried_unroll_puzzle, unroll_puzzle_solution) = self
1147
+ . make_unroll_puzzle_solution (
1166
1148
env,
1167
- self . current_state_number ,
1149
+ self . default_conditions_for_unroll_coin_spend . to_nodeptr ( ) ,
1168
1150
) ?;
1169
- let ( curried_unroll_puzzle, unroll_puzzle_solution) =
1170
- self . make_unroll_puzzle_solution ( env, conditions) ?;
1171
-
1172
- Ok ( (
1173
- TransactionBundle {
1174
- puzzle : Puzzle :: from_nodeptr ( curried_unroll_puzzle) ,
1175
- solution : unroll_puzzle_solution,
1176
- signature : Aggsig :: default ( ) ,
1177
- } ,
1178
- true ,
1179
- ) )
1180
- } else {
1181
- return Err ( Error :: StrErr ( format ! (
1182
- "Unhandled relationship between state numbers {state_number} {}" ,
1183
- self . unroll_state_number
1184
- ) ) ) ;
1185
- }
1151
+
1152
+ Ok ( (
1153
+ TransactionBundle {
1154
+ puzzle : Puzzle :: from_nodeptr ( curried_unroll_puzzle) ,
1155
+ solution : unroll_puzzle_solution,
1156
+ signature : Aggsig :: default ( ) ,
1157
+ } ,
1158
+ true ,
1159
+ ) )
1160
+ } else if state_number == self . current_state_number {
1161
+ // Different timeout, construct the conditions based on the current
1162
+ // state. (different because we're not using the conditions we
1163
+ // have cached).
1164
+ let ( conditions, _) = self . create_conditions_and_signature_of_channel_coin (
1165
+ env,
1166
+ self . current_state_number ,
1167
+ ) ?;
1168
+ let ( curried_unroll_puzzle, unroll_puzzle_solution) =
1169
+ self . make_unroll_puzzle_solution ( env, conditions) ?;
1170
+
1171
+ Ok ( (
1172
+ TransactionBundle {
1173
+ puzzle : Puzzle :: from_nodeptr ( curried_unroll_puzzle) ,
1174
+ solution : unroll_puzzle_solution,
1175
+ signature : Aggsig :: default ( ) ,
1176
+ } ,
1177
+ true ,
1178
+ ) )
1179
+ } else {
1180
+ Err ( Error :: StrErr ( format ! (
1181
+ "Unhandled relationship between state numbers {state_number} {}" ,
1182
+ self . unroll_state_number
1183
+ ) ) )
1186
1184
}
1187
1185
}
1188
1186
@@ -1221,7 +1219,7 @@ impl ChannelHandler {
1221
1219
Some ( CachedPotatoRegenerateLastHop :: PotatoCreatedGame (
1222
1220
ids,
1223
1221
our_contrib,
1224
- their_contrib ,
1222
+ _their_contrib ,
1225
1223
) ) => {
1226
1224
// Add amount contributed to vanilla balance
1227
1225
// Skip game when generating result.
@@ -1307,9 +1305,9 @@ impl ChannelHandler {
1307
1305
1308
1306
pub fn get_new_game_coins_on_chain < R : Rng > (
1309
1307
& self ,
1310
- env : & mut ChannelHandlerEnv < R > ,
1308
+ _env : & mut ChannelHandlerEnv < R > ,
1311
1309
unroll_coin : Option < & CoinID > ,
1312
- skip_game : Option < & GameID > ,
1310
+ skip_game : & [ GameID ] ,
1313
1311
skip_coin_id : Option < & GameID > ,
1314
1312
) -> Vec < OnChainGameCoin > {
1315
1313
// It's ok to not have a proper coin id here when we only want
@@ -1318,7 +1316,7 @@ impl ChannelHandler {
1318
1316
1319
1317
self . live_games
1320
1318
. iter ( )
1321
- . filter ( |game| skip_game != Some ( & game. game_id ) )
1319
+ . filter ( |game| !skip_game . contains ( & game. game_id ) )
1322
1320
. map ( |game| {
1323
1321
let coin = if skip_coin_id == Some ( & game. game_id ) {
1324
1322
None
@@ -1385,22 +1383,15 @@ impl ChannelHandler {
1385
1383
return Err ( Error :: StrErr ( "Unconvertible state number" . to_string ( ) ) ) ;
1386
1384
} ;
1387
1385
1388
- let our_parity = self . unroll_state_number & 1 ;
1389
- let their_parity = state_number & 1 ;
1390
-
1391
- let mut skip_game = None ;
1392
- let mut skip_coin_id = None ;
1393
- let mut contributed_adjustment = Amount :: default ( ) ;
1394
-
1395
1386
let disposition =
1396
1387
self . get_cached_disposition_for_spent_result ( env, unroll_coin, state_number) ?;
1397
1388
1398
1389
// return list of triples of game_id, coin_id, referee maker pulling from a list of pairs of (id, ref maker)
1399
1390
let new_game_coins_on_chain = self . get_new_game_coins_on_chain (
1400
1391
env,
1401
1392
Some ( & unroll_coin. to_coin_id ( ) ) ,
1402
- skip_game . as_ref ( ) ,
1403
- skip_coin_id. as_ref ( ) ,
1393
+ & disposition . as_ref ( ) . map ( |d| d . skip_game . clone ( ) ) . unwrap_or_default ( ) ,
1394
+ disposition . as_ref ( ) . and_then ( |d| d . skip_coin_id . as_ref ( ) ) ,
1404
1395
) ;
1405
1396
1406
1397
// coin with = parent is the unroll coin id and whose puzzle hash is ref and amount is my vanilla amount.
0 commit comments