increase firo gap check to 50 from 20

This commit is contained in:
Marco 2022-10-13 13:31:24 -06:00
parent 3c29b9acdf
commit a30ee6f329
5 changed files with 27 additions and 10 deletions

View file

@ -275,7 +275,7 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
// without using them
await manager.recoverFromMnemonic(
mnemonic: mnemonic,
maxUnusedAddressGap: 20,
maxUnusedAddressGap: widget.coin == Coin.firo ? 50 : 20,
maxNumberOfIndexesToCheck: 1000,
height: height,
);

View file

@ -402,7 +402,7 @@ abstract class SWB {
// without using them
await manager.recoverFromMnemonic(
mnemonic: mnemonic,
maxUnusedAddressGap: 20,
maxUnusedAddressGap: manager.coin == Coin.firo ? 50 : 20,
maxNumberOfIndexesToCheck: 1000,
height: restoreHeight,
);

View file

@ -35,7 +35,8 @@ class _RestoringWalletCardState extends ConsumerState<RestoringWalletCard> {
case StackRestoringStatus.waiting:
return SvgPicture.asset(
Assets.svg.loader,
color: Theme.of(context).extension<StackColors>()!.buttonBackSecondary,
color:
Theme.of(context).extension<StackColors>()!.buttonBackSecondary,
);
case StackRestoringStatus.restoring:
return const LoadingIndicator();
@ -95,7 +96,10 @@ class _RestoringWalletCardState extends ConsumerState<RestoringWalletCard> {
try {
final mnemonicList = await manager.mnemonic;
const maxUnusedAddressGap = 20;
int maxUnusedAddressGap = 20;
if (coin == Coin.firo) {
maxUnusedAddressGap = 50;
}
const maxNumberOfIndexesToCheck = 1000;
if (mnemonicList.isEmpty) {
@ -155,14 +159,17 @@ class _RestoringWalletCardState extends ConsumerState<RestoringWalletCard> {
? Container(
height: 20,
decoration: BoxDecoration(
color: Theme.of(context).extension<StackColors>()!.buttonBackSecondary,
color: Theme.of(context)
.extension<StackColors>()!
.buttonBackSecondary,
borderRadius: BorderRadius.circular(
1000,
),
),
child: RawMaterialButton(
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
splashColor: Theme.of(context).extension<StackColors>()!.highlight,
splashColor:
Theme.of(context).extension<StackColors>()!.highlight,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(
1000,
@ -187,7 +194,9 @@ class _RestoringWalletCardState extends ConsumerState<RestoringWalletCard> {
child: Text(
"Show recovery phrase",
style: STextStyles.infoSmall(context).copyWith(
color: Theme.of(context).extension<StackColors>()!.accentColorDark),
color: Theme.of(context)
.extension<StackColors>()!
.accentColorDark),
),
),
),

View file

@ -77,7 +77,8 @@ class _WalletNetworkSettingsViewState
Future<void> _attemptRescan() async {
if (!Platform.isLinux) Wakelock.enable();
const int maxUnusedAddressGap = 20;
int maxUnusedAddressGap = 20;
const int maxNumberOfIndexesToCheck = 1000;
showDialog<dynamic>(
@ -88,6 +89,13 @@ class _WalletNetworkSettingsViewState
);
try {
if (ref
.read(walletsChangeNotifierProvider)
.getManager(widget.walletId)
.coin ==
Coin.firo) {
maxUnusedAddressGap = 50;
}
await ref
.read(walletsChangeNotifierProvider)
.getManager(widget.walletId)

View file

@ -3283,9 +3283,9 @@ void main() {
"a5V5r6We6mNZzWJwGwEeRML3mEYLjvK39w",
]);
expect(await firo.maxFee, 1234); // ???
expect(await firo.maxFee, 0); // ???
expect(await firo.balanceMinusMaxFee, Decimal.parse("-0.00001234"));
expect(await firo.balanceMinusMaxFee, Decimal.parse("0"));
});
test("wallet balance minus maxfee - wallet balance is not zero", () async {