Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions launcher/src/backend/SSHService.js
Original file line number Diff line number Diff line change
Expand Up @@ -676,14 +676,8 @@ export class SSHService {
try {
if (err) throw err;
const readStream = fs.createReadStream(localPath);
// Handle read stream end
readStream.on("end", () => {
fs.unlinkSync(localPath);
});

// Handle read stream errors
readStream.on("error", (error) => {
fs.unlinkSync(localPath);
stream.end();
reject(new Error("Failed to read local file: " + error.message));
});
Expand Down
24 changes: 23 additions & 1 deletion launcher/src/components/UI/staking-page/StakingScreen.vue
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,26 @@ const exportExitMessage = async () => {
.filter((item) => item.validatorID === stakingStore.selectedServiceToFilter?.config?.serviceID)
.map((item) => item.key);

// if there are more than 50 keys, split them into chunks of 50
const chunkSize = 50;
if (pubkeys.length > chunkSize) {
let allResults = [];
for (let i = 0; i < pubkeys.length; i += chunkSize) {
const chunk = pubkeys.slice(i, i + chunkSize);
const results = await Promise.all(
chunk.map(async (key) => {
return ControlService.getExitValidatorMessage({
pubkey: key,
serviceID: stakingStore.selectedServiceToFilter.config?.serviceID,
});
})
);
allResults = allResults.concat(results);
}
saveExitMessage(allResults, "multiple");
return;
}

const results = await Promise.all(
pubkeys.map(async (key) => {
return ControlService.getExitValidatorMessage({
Expand All @@ -625,7 +645,9 @@ const saveExitMessage = (data, type) => {
const unwrap = (entry) => (entry && entry.data ? entry.data : entry);

const content =
type === "single" ? JSON.stringify(unwrap(data), null, 2) : data.map((entry) => JSON.stringify(unwrap(entry), null, 2)).join("\n\n");
type === "single"
? JSON.stringify(unwrap(data), null, 2)
: "[" + data.map((entry) => JSON.stringify(unwrap(entry), null, 2)).join(",\n") + "]";

const fileName = type === "single" ? "single_exit_message.txt" : "multiple_exit_messages.txt";
const blob = new Blob([content], { type: "application/json;charset=utf-8" });
Expand Down
Loading