Skip to content

Commit a3d1136

Browse files
committed
fix: Correct confirmations for UTXOs in wallet FFI
1 parent 7316f44 commit a3d1136

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

key-wallet-ffi/src/utxo.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use std::ffi::CString;
44
use std::os::raw::c_char;
55
use std::ptr;
6-
6+
use key_wallet::wallet::managed_wallet_info::wallet_info_interface::WalletInfoInterface;
77
use crate::error::{FFIError, FFIErrorCode};
88
use crate::managed_wallet::FFIManagedWalletInfo;
99

@@ -119,9 +119,9 @@ pub unsafe extern "C" fn managed_wallet_get_utxos(
119119
// Get script bytes
120120
let script_bytes = utxo.txout.script_pubkey.as_bytes().to_vec();
121121

122-
// Calculate confirmations (0 if unconfirmed)
123-
let confirmations = if utxo.is_confirmed {
124-
1
122+
let current_height = managed_info.inner().synced_height();
123+
let confirmations = if utxo.is_confirmed && utxo.height > 0 {
124+
current_height - utxo.height + 1
125125
} else {
126126
0
127127
};

0 commit comments

Comments
 (0)