-
Notifications
You must be signed in to change notification settings - Fork 54
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
fix: precondition for collaborative transactions #485
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
7eb7f4d
fix: min confs of preconditions for all utxos instead of single
theborakompanioni 85bdb34
fix: i18n phrases of collaborative transaction preconditions
theborakompanioni 4b478ff
fix: link to markdown docs instead of archived wiki page
theborakompanioni 4fb1152
Merge branch 'master' into preconditions
theborakompanioni ea9b372
Merge branch 'master' into preconditions
theborakompanioni 175bb4c
wip: add CoinjoinRequirements
theborakompanioni 5745813
wip: remove min utxo size check
theborakompanioni 83f369c
wip: use new scheduler preconditions in Jam component
theborakompanioni 08bea1d
wip: externalize CoinjoinPreconditionViolationAlert component
theborakompanioni cc7b5d8
fix: only report utxos without retries of no retry is left within jar
theborakompanioni 3f83aa0
dev: readd optional min value precondition check
theborakompanioni 999bf39
dev: use CoinjoinPreconditionViolationAlert on Send page
theborakompanioni b82a912
dev: remove min utxo size check (again)
theborakompanioni fef437e
feat(regtest): set taker_utxo_retries and maker_timeout_sec config va…
theborakompanioni 8a24605
test(preconditions): add test for CoinjoinRequirements
theborakompanioni e832cc7
chore: remove outdated component CoinjoinPreconditions
theborakompanioni d4ccab6
test: add test for multiple jar check in CoinjoinRequirements
theborakompanioni 0833389
ui: display retries info as warning intead of error
theborakompanioni c9fb002
fix: enable starting scheduler even if preconditions are not fulfilled
theborakompanioni 63de541
review: fix wording
theborakompanioni 08989ac
Merge branch 'master' into preconditions
theborakompanioni 0c5f4ad
Merge branch 'master' into preconditions
theborakompanioni 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 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 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,100 @@ | ||
import React, { forwardRef } from 'react' | ||
import * as rb from 'react-bootstrap' | ||
import { Trans, useTranslation } from 'react-i18next' | ||
import { useSettings } from '../context/SettingsContext' | ||
import { CoinjoinRequirementSummary } from '../hooks/CoinjoinRequirements' | ||
import { jarInitial } from './jars/Jar' | ||
import { shortenStringMiddle } from '../utils' | ||
import Sprite from './Sprite' | ||
import Balance from './Balance' | ||
|
||
interface CoinjoinPreconditionViolationAlertProps { | ||
summary: CoinjoinRequirementSummary | ||
i18nPrefix?: string | ||
} | ||
|
||
export const CoinjoinPreconditionViolationAlert = forwardRef( | ||
({ summary, i18nPrefix = '' }: CoinjoinPreconditionViolationAlertProps, ref: React.Ref<HTMLDivElement>) => { | ||
const { t } = useTranslation() | ||
const settings = useSettings() | ||
|
||
if (summary.isFulfilled) return <></> | ||
|
||
if (summary.numberOfMissingUtxos > 0) { | ||
return ( | ||
<rb.Alert variant="warning" ref={ref}> | ||
{t(`${i18nPrefix}hint_missing_utxos`, { | ||
minConfirmations: summary.options.minConfirmations, | ||
})} | ||
</rb.Alert> | ||
) | ||
} | ||
|
||
if (summary.numberOfMissingConfirmations > 0) { | ||
return ( | ||
<rb.Alert variant="warning" ref={ref}> | ||
{t(`${i18nPrefix}hint_missing_confirmations`, { | ||
minConfirmations: summary.options.minConfirmations, | ||
amountOfMissingConfirmations: summary.numberOfMissingConfirmations, | ||
})} | ||
</rb.Alert> | ||
) | ||
} | ||
|
||
const utxosViolatingRetriesLeft = summary.violations | ||
.map((it) => it.utxosViolatingRetriesLeft) | ||
.reduce((acc, utxos) => acc.concat(utxos), []) | ||
|
||
if (utxosViolatingRetriesLeft.length > 0) { | ||
return ( | ||
<rb.Alert variant="warning" ref={ref}> | ||
<> | ||
<Trans i18nKey={`${i18nPrefix}hint_missing_retries`}> | ||
You tried too many times. See | ||
<a | ||
href="https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/v0.9.7/docs/SOURCING-COMMITMENTS.md" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
the docs | ||
</a>{' '} | ||
for more info. | ||
</Trans> | ||
<br /> | ||
<br /> | ||
<Trans i18nKey={`${i18nPrefix}hint_missing_retries_detail`} count={utxosViolatingRetriesLeft.length}> | ||
Following utxos have been used unsuccessfully too many times: | ||
<ul className="mt-2 mb-0 ps-2"> | ||
{utxosViolatingRetriesLeft.map((utxo, index) => ( | ||
<li key={index} className="mb-2 slashed-zeroes small" style={{ display: 'inline-flex' }}> | ||
<span className="pe-1" style={{ display: 'inline-flex' }}> | ||
<Sprite symbol="jar-closed-fill-50" width="20" height="20" /> | ||
<span className="slashed-zeroes"> | ||
<strong>{jarInitial(utxo.mixdepth)}</strong> | ||
</span> | ||
: | ||
</span> | ||
<div> | ||
<span>{utxo.address}</span> | ||
( | ||
<Balance | ||
valueString={`${utxo.value}`} | ||
convertToUnit={settings.unit} | ||
showBalance={settings.showBalance} | ||
/> | ||
) | ||
<br /> | ||
<small>{shortenStringMiddle(utxo.utxo, 32)}</small> | ||
</div> | ||
</li> | ||
))} | ||
</ul> | ||
</Trans> | ||
</> | ||
</rb.Alert> | ||
) | ||
} | ||
|
||
return <></> | ||
} | ||
) |
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
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
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.