-
Notifications
You must be signed in to change notification settings - Fork 56
Sam/remove tx metadata files #689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
samholmes
wants to merge
5
commits into
master
Choose a base branch
from
sam/remove-tx-metadata-files
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a85179c
Use syncRepo from upgraded edge-sync-client
samholmes 538efb8
Remove empty transaction metadata files
samholmes 4fcae48
fixup! Remove empty transaction metadata files
samholmes 8cf655f
fixup! Remove empty transaction metadata files
samholmes a927c0f
fixup! Remove empty transaction metadata files
samholmes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,14 +6,30 @@ import { EdgeIo } from '../../types/types' | |
| import { decrypt, decryptText, encrypt } from '../../util/crypto/crypto' | ||
| import { utf8 } from '../../util/encoding' | ||
|
|
||
| /** | ||
| * Creates an encrypted disklet that wraps another disklet. | ||
| * Optionally accepts a deletedDisklet for sync-aware deletions. | ||
| * When deletedDisklet is provided, delete operations will mark files | ||
| * for deletion by writing an empty file to the deleted/ directory, | ||
| * which will be processed during the next sync. | ||
| */ | ||
| export function encryptDisklet( | ||
| io: EdgeIo, | ||
| dataKey: Uint8Array, | ||
| disklet: Disklet | ||
| disklet: Disklet, | ||
| /** Provide when this disklet is synchronized with edge-sync-client's syncRepo */ | ||
| deletedDisklet?: Disklet | ||
|
Comment on lines
+20
to
+21
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This deletion logic needs to live in the edge-sync-client, as part of the wrapped disklet. The edge-sync-client needs abstract all the sync stuff (adds / changes / deletions / etc.) behind the simple Disklet API, managing the deletions folder internally. |
||
| ): Disklet { | ||
| const out = { | ||
| delete(path: string): Promise<unknown> { | ||
| return disklet.delete(path) | ||
| async delete(path: string): Promise<unknown> { | ||
| // If we have a deletedDisklet, mark the file for deletion | ||
| // by writing an empty file to the deleted/ directory. | ||
| // The sync process will handle the actual deletion. | ||
| if (deletedDisklet != null) { | ||
| await deletedDisklet.setText(path, '') | ||
| } | ||
| // Also delete locally for immediate effect: | ||
| return await disklet.delete(path) | ||
| }, | ||
|
|
||
| async getData(path: string): Promise<Uint8Array> { | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing
feeRateUsedcheck inisEmptyTxFilefunctionMedium Severity
The
isEmptyTxFilefunction checks many fields (savedAction,swap,payees,deviceDescription,secret,feeRateRequested) but does not checkfeeRateUsed. If a transaction file contains onlyfeeRateUseddata (and no user metadata), it will be incorrectly identified as "empty" and deleted. ThefeeRateUsedvalue is used as a fallback incombineTxWithFilewhen the engine doesn't provide it, so deleting such files causes data loss for synced transactions.