Repository navigation
feat: estimate confirmation time for a custom fee #1641
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 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
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 |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| package to.bitkit.models | ||
|
|
||
| import com.synonym.bitkitcore.FeeRates | ||
| import org.junit.Test | ||
| import kotlin.test.assertEquals | ||
|
|
||
| class FeeRateTest { | ||
| private val feeRates = FeeRates(fast = 10u, mid = 5u, slow = 2u) | ||
|
|
||
| @Test | ||
| fun `custom rate at or above the fast tier confirms like fast`() { | ||
| assertEquals(FeeRate.FAST, FeeRate.forConfirmation(TransactionSpeed.Custom(10u), feeRates)) | ||
| assertEquals(FeeRate.FAST, FeeRate.forConfirmation(TransactionSpeed.Custom(40u), feeRates)) | ||
| } | ||
|
|
||
| @Test | ||
| fun `custom rate between tiers confirms like the tier below it`() { | ||
| assertEquals(FeeRate.NORMAL, FeeRate.forConfirmation(TransactionSpeed.Custom(7u), feeRates)) | ||
| assertEquals(FeeRate.SLOW, FeeRate.forConfirmation(TransactionSpeed.Custom(3u), feeRates)) | ||
| } | ||
|
|
||
| @Test | ||
| fun `custom rate below the slow tier confirms like minimum`() { | ||
| assertEquals(FeeRate.MINIMUM, FeeRate.forConfirmation(TransactionSpeed.Custom(1u), feeRates)) | ||
| } | ||
|
|
||
| @Test | ||
| fun `custom rate without fee tiers keeps the custom description`() { | ||
| assertEquals(FeeRate.CUSTOM, FeeRate.forConfirmation(TransactionSpeed.Custom(4u), null)) | ||
| assertEquals(FeeRate.CUSTOM, FeeRate.forConfirmation(TransactionSpeed.Custom(0u), feeRates)) | ||
| } | ||
|
|
||
| @Test | ||
| fun `preset speeds keep their own tier`() { | ||
| assertEquals(FeeRate.FAST, FeeRate.forConfirmation(TransactionSpeed.Fast, feeRates)) | ||
| assertEquals(FeeRate.NORMAL, FeeRate.forConfirmation(TransactionSpeed.Medium, feeRates)) | ||
| assertEquals(FeeRate.SLOW, FeeRate.forConfirmation(TransactionSpeed.Slow, feeRates)) | ||
| } | ||
| } |
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 @@ | ||
| The send confirmation now estimates the confirmation time for a custom on-chain fee from the current fee tiers. |
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,16 @@ | ||
| <journey name="custom fee confirmation estimate"> | ||
| <description> | ||
| Verifies that a custom on-chain fee shows the confirmation time of the fee tier it reaches, | ||
| the same text the preset speeds use, instead of "Depends on the fee". Preconditions: a synced | ||
| regtest wallet with at least 30,000 confirmed sats in Savings and the current fee tiers loaded. | ||
| The custom rate of 50 ₿/vbyte is above the regtest backend's Fast tier; on a backend whose Fast | ||
| tier is higher, use a rate above it. | ||
| </description> | ||
| <actions> | ||
| <action>Start an on-chain send of 5,000 sats from Savings to a fresh regtest address and reach the confirmation screen (testTag "SendConfirmContent")</action> | ||
| <action>Tap Show details (testTag "SendConfirmToggleDetails")</action> | ||
| <action>Open the speed picker by tapping the Speed and Fee value, then tap Custom (testTag "fee_CUSTOM_button")</action> | ||
| <action>On the custom fee screen (testTag "fee_screen"), clear the field with Remove (testTag "NRemove") and enter 50 with the number pad (testTags "N5", "N0"), then tap Continue (testTag "continue_btn")</action> | ||
| <action>Back on confirmation with details shown, verify Speed and Fee reads Custom and Confirming In reads "±10-20 minutes", the Fast speed's time, not "Depends on the fee"</action> | ||
| </actions> | ||
| </journey> |
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.
Uh oh!
There was an error while loading. Please reload this page.