-
Notifications
You must be signed in to change notification settings - Fork 3.5k
QML send change to lightning #10723
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
accumulator
wants to merge
6
commits into
spesmilo:master
Choose a base branch
from
accumulator:qml_send_change_to_lightning
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
QML send change to lightning #10723
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d91f490
qml: refactor ConfirmTxDialog; don't use accept signal to confirm pay…
accumulator 6bbb20f
qml: qeconfig add property for send-change-to-lightning
accumulator 5bb718d
qml: add send-to-lightning in ConfirmTxDialog
accumulator 2224250
qml: add change-to-swap support to QETxFinalizer
accumulator cdfcf88
qml: make finalizer options a flag, allowing to enable/disable certai…
accumulator 708dc41
qml: add busy property on QETxFinalizer for guarding re-entry while b…
accumulator 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
Some comments aren't visible on the classic Files Changed page.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,10 +112,12 @@ Item { | |
| message: invoice.message | ||
| }) | ||
| var canComplete = !Daemon.currentWallet.isWatchOnly && Daemon.currentWallet.canSignWithoutCosigner | ||
| dialog.accepted.connect(function() { | ||
| dialog.confirmed.connect(function() { | ||
| if (invoice.canSave) | ||
| if (!invoice.saveInvoice()) | ||
| if (!invoice.saveInvoice()) { | ||
| dialog.close() | ||
| return | ||
| } | ||
| if (!canComplete) { | ||
| if (Daemon.currentWallet.isWatchOnly) { | ||
| dialog.finalizer.saveOrShow() | ||
|
|
@@ -148,7 +150,7 @@ Item { | |
| ? qsTr('Sweep...') | ||
| : qsTr('Sweep') | ||
| }) | ||
| finalizerDialog.accepted.connect(function() { | ||
| finalizerDialog.confirmed.connect(function() { | ||
| if (Daemon.currentWallet.isWatchOnly) { | ||
| var confirmdialog = app.messageDialog.createObject(mainView, { | ||
| title: qsTr('Confirm Sweep'), | ||
|
|
@@ -164,6 +166,7 @@ Item { | |
| } | ||
| console.log("Sending sweep transaction") | ||
| finalizerDialog.finalizer.send() | ||
| finalizerDialog.close() | ||
| }) | ||
| finalizerDialog.open() | ||
| }) | ||
|
|
@@ -672,6 +675,8 @@ Item { | |
| id: _confirmPaymentDialog | ||
| title: qsTr('Confirm Payment') | ||
| finalizer: TxFinalizer { | ||
| id: _txfinalizer | ||
| property var _swapwaitdialog | ||
| wallet: Daemon.currentWallet | ||
| canRbf: true | ||
| onFinished: (signed, saved, complete) => { | ||
|
|
@@ -693,7 +698,7 @@ Item { | |
| } | ||
| showExport(getSerializedTx(), msg) | ||
| } | ||
| _confirmPaymentDialog.destroy() | ||
| _confirmPaymentDialog.close() | ||
| } | ||
| onSignError: (message) => { | ||
| var dialog = app.messageDialog.createObject(mainView, { | ||
|
|
@@ -703,12 +708,43 @@ Item { | |
| }) | ||
| dialog.open() | ||
| } | ||
| onSwapError: (message) => { | ||
| if (_swapwaitdialog) | ||
| _swapwaitdialog.close() | ||
| var dialog = app.messageDialog.createObject(mainView, { | ||
| title: qsTr('Error'), | ||
| text: [qsTr('Could not swap change'), message].join('\n\n'), | ||
| iconSource: '../../../icons/warning.png' | ||
| }) | ||
| dialog.open() | ||
| } | ||
| onSwapStart: { | ||
| _swapwaitdialog = app.messageDialog.createObject(mainView, { | ||
| title: qsTr('Please wait...'), | ||
| text: [qsTr('waiting for lightning invoice'), ''].join('\n\n'), | ||
| iconSource: Qt.resolvedUrl('../../icons/info.png'), | ||
| buttonText: qsTr('Cancel'), | ||
| buttonIcon: Qt.resolvedUrl('../../icons/closebutton.png') | ||
| }) | ||
| _swapwaitdialog.accepted.connect(function() { | ||
| cancelSwap() | ||
| }) | ||
|
Comment on lines
+731
to
+733
Member
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. Should clicking outside the dialog/back maybe also cancel the swap? _swapwaitdialog.rejected.connect(function() {
cancelSwap()
})Alternatively we could also disallow closing the dialog by clicking outside so the user must either wait or click cancel. |
||
| _swapwaitdialog.open() | ||
| } | ||
| onSwapFunded: { | ||
| if (_swapwaitdialog) | ||
| _swapwaitdialog.close() | ||
| } | ||
| onAuthRequired: (method, authMessage) => { | ||
| app.handleAuthRequired(_txfinalizer, method, authMessage) | ||
| } | ||
| } | ||
|
|
||
| // TODO: lingering confirmPaymentDialogs can raise exceptions in | ||
| // the child finalizer when currentWallet disappears, but we need | ||
| // it long enough for the finalizer to finish.. | ||
| // onClosed: destroy() | ||
| // NOTE: destroy-on-close was previously disabled due to the 'accept' signal implicitly | ||
| // closing the dialog, while the finalizer could still trigger a callback. | ||
| // ConfirmTxDialog now instead emits a custom 'confirmed' signal when user ok's, but | ||
| // keep in mind this requires explicit closing of the dialog afterwards | ||
| onClosed: destroy() | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -725,6 +761,8 @@ Item { | |
| canRbf: true | ||
| privateKeys: _confirmSweepDialog.privateKeys | ||
| } | ||
|
|
||
| onClosed: destroy() | ||
| } | ||
| } | ||
|
|
||
|
|
||
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.
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.
Might be easier to understand? It might not be clear to the user why they have to wait for a lightning invoice if they aren't aware of the swap technicalities.