Skip to content

Commit a8fa5f7

Browse files
committed
fmt
1 parent 2c8c533 commit a8fa5f7

File tree

3 files changed

+32
-27
lines changed

3 files changed

+32
-27
lines changed

src/common/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ pub struct SpendRewardResult {
931931
}
932932

933933
pub struct SpendBundle {
934-
pub spends: Vec<CoinSpend>
934+
pub spends: Vec<CoinSpend>,
935935
}
936936

937937
pub fn usize_from_atom(a: &[u8]) -> Option<usize> {

src/outside.rs

+28-24
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ use crate::channel_handler::types::{
1313
use crate::channel_handler::ChannelHandler;
1414
#[cfg(test)]
1515
use crate::common::constants::CREATE_COIN;
16-
use crate::common::standard_coin::{private_to_public_key, puzzle_hash_for_pk};
1716
#[cfg(test)]
1817
use crate::common::standard_coin::standard_solution_partial;
18+
use crate::common::standard_coin::{private_to_public_key, puzzle_hash_for_pk};
1919
use crate::common::types::{
2020
Aggsig, Amount, CoinID, CoinString, Error, GameID, IntoErr, PublicKey, PuzzleHash, Spend,
2121
SpendBundle, Timeout,
@@ -316,17 +316,19 @@ where
316316
) -> Result<(), Error> {
317317
let ch = peer.channel_handler()?;
318318
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+
};
325324

326325
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()?;
330332
let spend = standard_solution_partial(
331333
self.env.allocator,
332334
&ch.channel_private_key(),
@@ -336,20 +338,22 @@ where
336338
&self.env.agg_sig_me_additional_data,
337339
false,
338340
)?;
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+
)
353357
}
354358
}
355359

src/tests/outside.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,8 @@ fn test_peer_smoke() {
194194
Amount::new(200),
195195
&mut pipe_sender,
196196
&mut peers[who],
197-
who
198-
).expect("should send");
197+
who,
198+
)
199+
.expect("should send");
199200
}
200201
}

0 commit comments

Comments
 (0)