@@ -13,9 +13,9 @@ use crate::channel_handler::types::{
13
13
use crate :: channel_handler:: ChannelHandler ;
14
14
#[ cfg( test) ]
15
15
use crate :: common:: constants:: CREATE_COIN ;
16
- use crate :: common:: standard_coin:: { private_to_public_key, puzzle_hash_for_pk} ;
17
16
#[ cfg( test) ]
18
17
use crate :: common:: standard_coin:: standard_solution_partial;
18
+ use crate :: common:: standard_coin:: { private_to_public_key, puzzle_hash_for_pk} ;
19
19
use crate :: common:: types:: {
20
20
Aggsig , Amount , CoinID , CoinString , Error , GameID , IntoErr , PublicKey , PuzzleHash , Spend ,
21
21
SpendBundle , Timeout ,
@@ -316,17 +316,19 @@ where
316
316
) -> Result < ( ) , Error > {
317
317
let ch = peer. channel_handler ( ) ?;
318
318
let channel_coin = ch. state_channel_coin ( ) ;
319
- let channel_coin_amt =
320
- if let Some ( ( _, _, amt) ) = channel_coin. coin_string ( ) . to_parts ( ) {
321
- amt
322
- } else {
323
- return Err ( Error :: StrErr ( "no channel coin" . to_string ( ) ) ) ;
324
- } ;
319
+ let channel_coin_amt = if let Some ( ( _, _, amt) ) = channel_coin. coin_string ( ) . to_parts ( ) {
320
+ amt
321
+ } else {
322
+ return Err ( Error :: StrErr ( "no channel coin" . to_string ( ) ) ) ;
323
+ } ;
325
324
326
325
let public_key = private_to_public_key ( & ch. channel_private_key ( ) ) ;
327
- let conditions_clvm = [
328
- ( CREATE_COIN , ( channel_handler_puzzle_hash. clone ( ) , ( channel_coin_amt, ( ) ) ) )
329
- ] . to_clvm ( self . env . allocator ) . into_gen ( ) ?;
326
+ let conditions_clvm = [ (
327
+ CREATE_COIN ,
328
+ ( channel_handler_puzzle_hash. clone ( ) , ( channel_coin_amt, ( ) ) ) ,
329
+ ) ]
330
+ . to_clvm ( self . env . allocator )
331
+ . into_gen ( ) ?;
330
332
let spend = standard_solution_partial (
331
333
self . env . allocator ,
332
334
& ch. channel_private_key ( ) ,
@@ -336,20 +338,22 @@ where
336
338
& self . env . agg_sig_me_additional_data ,
337
339
false ,
338
340
) ?;
339
- let spend_solution_program = Program :: from_nodeptr (
340
- & mut self . env . allocator , spend. solution . clone ( )
341
- ) ?;
342
-
343
- peer. channel_offer ( self , SpendBundle {
344
- spends : vec ! [ CoinSpend {
345
- coin: parent. clone( ) ,
346
- bundle: Spend {
347
- puzzle: self . env. standard_puzzle. clone( ) ,
348
- solution: spend_solution_program,
349
- signature: spend. signature. clone( )
350
- }
351
- } ]
352
- } )
341
+ let spend_solution_program =
342
+ Program :: from_nodeptr ( & mut self . env . allocator , spend. solution . clone ( ) ) ?;
343
+
344
+ peer. channel_offer (
345
+ self ,
346
+ SpendBundle {
347
+ spends : vec ! [ CoinSpend {
348
+ coin: parent. clone( ) ,
349
+ bundle: Spend {
350
+ puzzle: self . env. standard_puzzle. clone( ) ,
351
+ solution: spend_solution_program,
352
+ signature: spend. signature. clone( ) ,
353
+ } ,
354
+ } ] ,
355
+ } ,
356
+ )
353
357
}
354
358
}
355
359
0 commit comments