-
Notifications
You must be signed in to change notification settings - Fork 221
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
feat: add atomic swap refund transaction handling #3573
Merged
aviator-app
merged 1 commit into
tari-project:development
from
SWvheerden:sw_atomic__refund
Nov 17, 2021
Merged
feat: add atomic swap refund transaction handling #3573
aviator-app
merged 1 commit into
tari-project:development
from
SWvheerden:sw_atomic__refund
Nov 17, 2021
Conversation
This file contains 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
SWvheerden
force-pushed
the
sw_atomic__refund
branch
from
November 16, 2021 10:51
e10878e
to
bddefc7
Compare
philipr-za
reviewed
Nov 16, 2021
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.
Looks really good so far, just a few comments.
base_layer/wallet/src/output_manager_service/storage/sqlite_db/output_sql.rs
Outdated
Show resolved
Hide resolved
SWvheerden
force-pushed
the
sw_atomic__refund
branch
2 times, most recently
from
November 17, 2021 05:45
743e3f6
to
efb87a1
Compare
philipr-za
previously approved these changes
Nov 17, 2021
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.
Just some conflicts to sort.
SWvheerden
force-pushed
the
sw_atomic__refund
branch
2 times, most recently
from
November 17, 2021 12:48
55d0311
to
acee787
Compare
philipr-za
previously approved these changes
Nov 17, 2021
add tx priority add script context
SWvheerden
force-pushed
the
sw_atomic__refund
branch
from
November 17, 2021 13:52
acee787
to
da3d864
Compare
philipr-za
approved these changes
Nov 17, 2021
sdbondi
added a commit
to sdbondi/tari
that referenced
this pull request
Nov 18, 2021
* development: (32 commits) feat: add atomic swap refund transaction handling (tari-project#3573) feat: improve wallet connectivity status for console wallet (tari-project#3577) v0.21.1 feat: add error codes to LibWallet for CipherSeed errors (tari-project#3578) ci: split cucumber job into two (tari-project#3583) feat(wallet): import utxo’s as EncumberedToBeReceived rather than Unspent (tari-project#3575) docs: rfc 0250_Covenants (tari-project#3574) feat: get fee for transactions for stratum transcoder (tari-project#3571) test: make monerod stagenet usage resilient (tari-project#3572) feat: add atomic swap htlc sending and claiming (tari-project#3552) feat: implement prometheus metrics for base node (tari-project#3563) feat: implement multiple read single write for sqlite (tari-project#3568) feat: trigger time lock balance update when block received (tari-project#3567) test: reduce cucumber ci to critical only (tari-project#3566) test: fix cucumber console wallet startup (tari-project#3564) chore: add node id/public key to log mdc (tari-project#3559) fix: avoid implicit using of the time crate (tari-project#3562) feat: one-click installer - cli edition (tari-project#3534) ci: add workflow dispatch to libwallet build action (tari-project#3556) fix: stop leak of value of recovered output (tari-project#3558) ...
sdbondi
added a commit
to sdbondi/tari
that referenced
this pull request
Nov 23, 2021
* development: (46 commits) refactor: remove tari_common dependency from tari_comms (tari-project#3580) feat: language detection for mnemonic seed words (tari-project#3590) chore: minor clippy fixes (tari-project#3576) fix: be more permissive of responses for the incorrect request_id (tari-project#3588) feat: track ping failures and disconnect (tari-project#3597) chore: upgrade tokio deps tari-project#3581 (tari-project#3595) feat: standardize output hash for unblinded output, transaction output and transaction input (tari-project#3592) fix: allow bullet proof value only rewinding off one-sided transaction (tari-project#3587) refactor: update miningcore repository links (tari-project#3593) refactor: clean up unwraps in wallet_ffi (tari-project#3585) fix: update daily test start times and seed phrase (tari-project#3584) fix: allow bullet proof value only rewinding in atomic swaps (tari-project#3586) v0.21.2 feat: add atomic swap refund transaction handling (tari-project#3573) feat: improve wallet connectivity status for console wallet (tari-project#3577) v0.21.1 feat: add error codes to LibWallet for CipherSeed errors (tari-project#3578) ci: split cucumber job into two (tari-project#3583) feat(wallet): import utxo’s as EncumberedToBeReceived rather than Unspent (tari-project#3575) docs: rfc 0250_Covenants (tari-project#3574) ...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This Pr adds the following things:
Atomic swap refund transactions
Proper handling of the script context
Transaction spend priority
SQL query for filtering locked outputs
Fix broken get_balance tests
Motivation and Context
One of the features that are required for atomic swaps is to be able to process refunds. This PR now allows atomic swap refunds to be processed after the time lock of the HTLC has passed. This can happen in a manual way where the user manually asks the console-wallet via the CLI, or if the time lock has passed the wallet will automatically spend this UTXO first.
One of the missing features of TariScript is the
scriptContext
, which allows scripts to validate the blockchain state such as block height that is required in this case. This is now piped in anywhere where the script is validated if possible. If the state cannot be gathered, the state is filled in with default values which is how it operated up to now.This adds in a transaction spend priority that can allow UTXO to be given a priority to be spent. This is the case for high-risk UTXO such as HTLC which more than one party can claim. Manual claim for these transactions is still advised as they can be claimed as soon as possible, but this adds a second automated state where if you want to spend some UTXO at least pick the ones that you need to spend more urgently than the other ones.
The current
select_utxos
function uses a rust function to filter the maturity of the UTXOs to only select UTXOs it can spend. This PR completely swaps out the selection to be based completely on SQL queries which should be much faster.All current get_balance tests are broken in where the available and time-locked balance is asserted to be the same. This is not due to the function being broken but rather the test and the testing code. What happened is that tests use a tip_height of
u64::MAX
but this is too large as the database usesi64::MAX
. The problem comes whenu64::MAX
is cast asi64
as this is equal to-1
and when the queryFROM outputs WHERE status = ? AND maturity > ? AND script_lock_height > ?
is run, it select everything as the tip is now-1
. This ensures that the testing tip is selected asi64::MAX
to let the queries run correctly.How Has This Been Tested?
Added new tests.