Skip to content

Commit 4438d95

Browse files
committed
removed last_chainlock_hash field, only updated and persisted
1 parent 04f432d commit 4438d95

File tree

5 files changed

+0
-21
lines changed

5 files changed

+0
-21
lines changed

dash-spv-ffi/src/types.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,17 +182,13 @@ impl From<DetailedSyncProgress> for FFIDetailedSyncProgress {
182182
#[repr(C)]
183183
pub struct FFIChainState {
184184
pub last_chainlock_height: u32,
185-
pub last_chainlock_hash: FFIString,
186185
pub current_filter_tip: u32,
187186
}
188187

189188
impl From<ChainState> for FFIChainState {
190189
fn from(state: ChainState) -> Self {
191190
FFIChainState {
192191
last_chainlock_height: state.last_chainlock_height.unwrap_or(0),
193-
last_chainlock_hash: FFIString::new(
194-
&state.last_chainlock_hash.map(|h| h.to_string()).unwrap_or_default(),
195-
),
196192
current_filter_tip: 0, // FilterHeader not directly convertible to u32
197193
}
198194
}

dash-spv-ffi/tests/unit/test_type_conversions.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,20 +164,13 @@ mod tests {
164164
fn test_chain_state_none_values() {
165165
let state = dash_spv::ChainState {
166166
last_chainlock_height: None,
167-
last_chainlock_hash: None,
168167
sync_base_height: 0,
169168
};
170169

171170
let ffi_state = FFIChainState::from(state);
172171

173172
assert_eq!(ffi_state.last_chainlock_height, 0);
174173
assert_eq!(ffi_state.current_filter_tip, 0);
175-
176-
unsafe {
177-
let hash_str = FFIString::from_ptr(ffi_state.last_chainlock_hash.ptr).unwrap();
178-
assert_eq!(hash_str, "");
179-
dash_spv_ffi_string_destroy(ffi_state.last_chainlock_hash);
180-
}
181174
}
182175

183176
#[test]

dash-spv/src/client/chainlock.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ impl<W: WalletInterface, N: NetworkManager, S: StorageManager> DashSpvClient<W,
6565

6666
// Update our confirmed chain tip
6767
state.last_chainlock_height = Some(chainlock.block_height);
68-
state.last_chainlock_hash = Some(chainlock.block_hash);
6968

7069
tracing::info!(
7170
"🔒 Updated confirmed chain tip to ChainLock at height {} ({})",

dash-spv/src/storage/state.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ impl DiskStorageManager {
1919
// Store other state as JSON
2020
let state_data = serde_json::json!({
2121
"last_chainlock_height": state.last_chainlock_height,
22-
"last_chainlock_hash": state.last_chainlock_hash,
2322
"sync_base_height": state.sync_base_height,
2423
});
2524

@@ -47,10 +46,6 @@ impl DiskStorageManager {
4746
.get("last_chainlock_height")
4847
.and_then(|v| v.as_u64())
4948
.map(|h| h as u32),
50-
last_chainlock_hash: value
51-
.get("last_chainlock_hash")
52-
.and_then(|v| v.as_str())
53-
.and_then(|s| s.parse().ok()),
5449
sync_base_height: value
5550
.get("sync_base_height")
5651
.and_then(|v| v.as_u64())

dash-spv/src/types.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,6 @@ pub struct ChainState {
246246
/// Last ChainLock height.
247247
pub last_chainlock_height: Option<u32>,
248248

249-
/// Last ChainLock hash.
250-
pub last_chainlock_hash: Option<BlockHash>,
251-
252249
/// Base height when syncing from a checkpoint (0 if syncing from genesis).
253250
pub sync_base_height: u32,
254251
}
@@ -272,7 +269,6 @@ impl std::fmt::Debug for ChainState {
272269
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
273270
f.debug_struct("ChainState")
274271
.field("last_chainlock_height", &self.last_chainlock_height)
275-
.field("last_chainlock_hash", &self.last_chainlock_hash)
276272
.field("sync_base_height", &self.sync_base_height)
277273
.finish()
278274
}

0 commit comments

Comments
 (0)