Skip to content

Commit bae4881

Browse files
committed
Properly handle negative balanaces in the Electrum RPC
Refs bitcoindevkit/rust-electrum-client#45
1 parent c484efa commit bae4881

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/electrum/server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,8 @@ impl Connection {
286286
let (chain_stats, mempool_stats) = self.query.stats(&script_hash[..]);
287287

288288
Ok(json!({
289-
"confirmed": chain_stats.funded_txo_sum - chain_stats.spent_txo_sum,
290-
"unconfirmed": mempool_stats.funded_txo_sum - mempool_stats.spent_txo_sum,
289+
"confirmed": chain_stats.funded_txo_sum as i64 - chain_stats.spent_txo_sum as i64,
290+
"unconfirmed": mempool_stats.funded_txo_sum as i64 - mempool_stats.spent_txo_sum as i64,
291291
}))
292292
}
293293

0 commit comments

Comments
 (0)