-
Notifications
You must be signed in to change notification settings - Fork 3
fix: keep pending transfer in total #1058
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
piotr-iohk
wants to merge
4
commits into
master
Choose a base branch
from
fix/808-pending-transfer-balance
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
4 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| { | ||
| "formatVersion": 1, | ||
| "database": { | ||
| "version": 7, | ||
| "identityHash": "2b1cda225c170b5f1bbfbf76e5fa4cf5", | ||
| "entities": [ | ||
| { | ||
| "tableName": "config", | ||
| "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`walletIndex` INTEGER NOT NULL, PRIMARY KEY(`walletIndex`))", | ||
| "fields": [ | ||
| { | ||
| "fieldPath": "walletIndex", | ||
| "columnName": "walletIndex", | ||
| "affinity": "INTEGER", | ||
| "notNull": true | ||
| } | ||
| ], | ||
| "primaryKey": { | ||
| "autoGenerate": false, | ||
| "columnNames": [ | ||
| "walletIndex" | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| "tableName": "transfers", | ||
| "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `type` TEXT NOT NULL, `amountSats` INTEGER NOT NULL, `channelId` TEXT, `fundingTxId` TEXT, `lspOrderId` TEXT, `isSettled` INTEGER NOT NULL, `createdAt` INTEGER NOT NULL, `settledAt` INTEGER, `claimableAtHeight` INTEGER, `txTotalSats` INTEGER, `preTransferOnchainSats` INTEGER, PRIMARY KEY(`id`))", | ||
| "fields": [ | ||
| { | ||
| "fieldPath": "id", | ||
| "columnName": "id", | ||
| "affinity": "TEXT", | ||
| "notNull": true | ||
| }, | ||
| { | ||
| "fieldPath": "type", | ||
| "columnName": "type", | ||
| "affinity": "TEXT", | ||
| "notNull": true | ||
| }, | ||
| { | ||
| "fieldPath": "amountSats", | ||
| "columnName": "amountSats", | ||
| "affinity": "INTEGER", | ||
| "notNull": true | ||
| }, | ||
| { | ||
| "fieldPath": "channelId", | ||
| "columnName": "channelId", | ||
| "affinity": "TEXT" | ||
| }, | ||
| { | ||
| "fieldPath": "fundingTxId", | ||
| "columnName": "fundingTxId", | ||
| "affinity": "TEXT" | ||
| }, | ||
| { | ||
| "fieldPath": "lspOrderId", | ||
| "columnName": "lspOrderId", | ||
| "affinity": "TEXT" | ||
| }, | ||
| { | ||
| "fieldPath": "isSettled", | ||
| "columnName": "isSettled", | ||
| "affinity": "INTEGER", | ||
| "notNull": true | ||
| }, | ||
| { | ||
| "fieldPath": "createdAt", | ||
| "columnName": "createdAt", | ||
| "affinity": "INTEGER", | ||
| "notNull": true | ||
| }, | ||
| { | ||
| "fieldPath": "settledAt", | ||
| "columnName": "settledAt", | ||
| "affinity": "INTEGER" | ||
| }, | ||
| { | ||
| "fieldPath": "claimableAtHeight", | ||
| "columnName": "claimableAtHeight", | ||
| "affinity": "INTEGER" | ||
| }, | ||
| { | ||
| "fieldPath": "txTotalSats", | ||
| "columnName": "txTotalSats", | ||
| "affinity": "INTEGER" | ||
| }, | ||
| { | ||
| "fieldPath": "preTransferOnchainSats", | ||
| "columnName": "preTransferOnchainSats", | ||
| "affinity": "INTEGER" | ||
| } | ||
| ], | ||
| "primaryKey": { | ||
| "autoGenerate": false, | ||
| "columnNames": [ | ||
| "id" | ||
| ] | ||
| } | ||
| } | ||
| ], | ||
| "setupQueries": [ | ||
| "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", | ||
| "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '2b1cda225c170b5f1bbfbf76e5fa4cf5')" | ||
| ] | ||
| } | ||
| } |
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
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.
When users open an external/manual channel,
ExternalNodeViewModelrecords aMANUAL_SETUPtransfer with a funding tx but nolspOrderId, so the new on-chain correction inDeriveBalanceStateUseCasenever applies to it. With this addedbalanceInTransferToSpendingterm, if LDK still reports the pre-open on-chain balance while the channel is pending, the home total becomes stale savings plus the pending channel amount until the wallet sync catches up.Useful? React with 👍 / 👎.
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.
Valid observation, intentionally out of scope: manual opens go through LDK's connectOpenChannel, which funds and broadcasts from LDK's own wallet in one step, so the stale-balance window is at most one sync cycle. iOS's equivalent correction also filters on lspOrderId and skips manual opens — this is parity. Tracked in #1059: the planned hardening (funding-txid presence check instead of the totals heuristic) applies uniformly to LSP and manual transfers and covers this case.