Skip to content

Commit

Permalink
feat: allow rollback to specific height
Browse files Browse the repository at this point in the history
  • Loading branch information
thepiwo committed Jul 18, 2023
1 parent 6f570b3 commit 670c11e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ let snapshotHeight = -1;

export const createSnapshot = async (aeSdk) => {
snapshotHeight = await aeSdk.getHeight();
await awaitKeyBlocks(aeSdk, 1);
};

export const rollbackSnapshot = async (aeSdk) => {
export const rollbackHeight = async (aeSdk, height) => {
const currentBlockHeight = await aeSdk.getHeight();
if (currentBlockHeight > snapshotHeight) {
await get(`http://localhost:3001/rollback?height=${snapshotHeight}`);
await awaitKeyBlocks(aeSdk, 1);
if (currentBlockHeight > height) {
await get(`http://localhost:3001/rollback?height=${height}`);
}
};

export const rollbackSnapshot = async (aeSdk) => rollbackHeight(aeSdk, snapshotHeight);

0 comments on commit 670c11e

Please sign in to comment.