Skip to content

Commit 4e78e49

Browse files
committed
fix sat and msat conversion
1 parent 2f11875 commit 4e78e49

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

mutiny-core/src/node.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,6 +1596,7 @@ impl<S: MutinyStorage> Node<S> {
15961596
.into_iter()
15971597
.map(|b| b.claimable_amount_satoshis())
15981598
.sum::<u64>()
1599+
* 1000
15991600
< send_msats
16001601
{
16011602
// Channels exist but not enough capacity
@@ -1669,7 +1670,8 @@ impl<S: MutinyStorage> Node<S> {
16691670
.get_claimable_balances(&[])
16701671
.into_iter()
16711672
.map(|b| b.claimable_amount_satoshis())
1672-
.sum();
1673+
.sum::<u64>()
1674+
* 1000;
16731675
log_debug!(
16741676
self.logger,
16751677
"current channel details: {:?}",
@@ -1821,6 +1823,7 @@ impl<S: MutinyStorage> Node<S> {
18211823
.into_iter()
18221824
.map(|b| b.claimable_amount_satoshis())
18231825
.sum::<u64>()
1826+
* 1000
18241827
< amt_msats
18251828
{
18261829
// Channels exist but not enough capacity
@@ -1921,7 +1924,8 @@ impl<S: MutinyStorage> Node<S> {
19211924
.get_claimable_balances(&[])
19221925
.into_iter()
19231926
.map(|b| b.claimable_amount_satoshis())
1924-
.sum();
1927+
.sum::<u64>()
1928+
* 1000;
19251929
Err(map_sending_failure(
19261930
error,
19271931
amt_msats,

mutiny-core/src/nodemanager.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,7 @@ impl<S: MutinyStorage> NodeManager<S> {
964964
};
965965

966966
let nodes = self.nodes.read().await;
967-
let lightning_msats: u64 = nodes
967+
let lightning_sats: u64 = nodes
968968
.iter()
969969
.flat_map(|(_, n)| {
970970
n.chain_monitor
@@ -999,7 +999,7 @@ impl<S: MutinyStorage> NodeManager<S> {
999999
Ok(NodeBalance {
10001000
confirmed: (onchain.confirmed + onchain.trusted_pending).to_sat(),
10011001
unconfirmed: (onchain.untrusted_pending + onchain.immature).to_sat(),
1002-
lightning: lightning_msats / 1_000,
1002+
lightning: lightning_sats,
10031003
force_close,
10041004
})
10051005
}

0 commit comments

Comments
 (0)