[bug] Now save device after scan_blocks

This commit is contained in:
Sosthene 2025-08-27 17:27:59 +02:00
parent c422881cd1
commit acb9739a80

View File

@ -993,7 +993,20 @@ export default class Services {
// This is existing device, we need to catch up if last_scan is lagging behind chain_tip
if (device.sp_wallet.last_scan < this.currentBlockHeight) {
// We need to catch up
try {
await this.sdkClient.scan_blocks(this.currentBlockHeight, BLINDBITURL);
} catch (e) {
console.error(`Failed to scan blocks: ${e}`);
return;
}
// If everything went well, we can update our storage
try {
const device = this.dumpDeviceFromMemory();
await this.saveDeviceInDatabase(device);
} catch (e) {
console.error(`Failed to save updated device: ${e}`);
}
} else {
// Up to date, just returns
return;