mirror of
https://github.com/SeedSigner/seedsigner.git
synced 2026-10-05 15:08:25 +00:00
Merge pull request #284 from newtonick/improved-see-psbt-flow-2
[Enhancement] Skip second seed selection & clear PSBT data on MainMenuView
This commit is contained in:
@@ -228,12 +228,14 @@ class Controller(Singleton):
|
||||
# Home always wipes the back_stack
|
||||
self.clear_back_stack()
|
||||
|
||||
# Clear other temp vars
|
||||
# Home always wipes the back_stack/state of temp vars
|
||||
self.resume_main_flow = None
|
||||
self.multisig_wallet_descriptor = None
|
||||
self.unverified_address = None
|
||||
self.address_explorer_data = None
|
||||
|
||||
self.psbt = None
|
||||
self.psbt_parser = None
|
||||
self.psbt_seed = None
|
||||
|
||||
print(f"back_stack: {self.back_stack}")
|
||||
|
||||
|
||||
@@ -49,6 +49,11 @@ class PSBTSelectSeedView(View):
|
||||
button_data.append(TYPE_12WORD)
|
||||
button_data.append(TYPE_24WORD)
|
||||
|
||||
if self.controller.psbt_seed:
|
||||
if PSBTParser.has_matching_input_fingerprint(psbt=self.controller.psbt, seed=self.controller.psbt_seed, network=self.settings.get_value(SettingsConstants.SETTING__NETWORK)):
|
||||
# skip the seed prompt if a seed was previous selected and has matching input fingerprint
|
||||
return Destination(PSBTOverviewView)
|
||||
|
||||
selected_menu_num = ButtonListScreen(
|
||||
title="Select Signer",
|
||||
is_button_text_centered=False,
|
||||
@@ -143,6 +148,7 @@ class PSBTOverviewView(View):
|
||||
selected_menu_num = screen.display()
|
||||
|
||||
if selected_menu_num == RET_CODE__BACK_BUTTON:
|
||||
self.controller.psbt_seed = None
|
||||
return Destination(BackStackView)
|
||||
|
||||
# expecting p2sh (legacy multisig) and p2pkh to have no policy set
|
||||
@@ -446,11 +452,8 @@ class PSBTAddressVerificationFailedView(View):
|
||||
show_back_button=False,
|
||||
).display()
|
||||
|
||||
# Clear out the bad PSBT
|
||||
self.controller.psbt = None
|
||||
self.controller.psbt_parser = None
|
||||
self.controller.psbt_seed = None
|
||||
|
||||
# We're done with this PSBT. Route back to MainMenuView which always
|
||||
# clears all ephemeral data (except in-memory seeds).
|
||||
return Destination(MainMenuView, clear_history=True)
|
||||
|
||||
|
||||
@@ -501,11 +504,8 @@ class PSBTSignedQRDisplayView(View):
|
||||
)
|
||||
QRDisplayScreen(qr_encoder=qr_encoder).display()
|
||||
|
||||
# We're done with this PSBT. Remove all related data
|
||||
self.controller.psbt = None
|
||||
self.controller.psbt_parser = None
|
||||
self.controller.psbt_seed = None
|
||||
|
||||
# We're done with this PSBT. Route back to MainMenuView which always
|
||||
# clears all ephemeral data (except in-memory seeds).
|
||||
return Destination(MainMenuView, clear_history=True)
|
||||
|
||||
|
||||
|
||||
@@ -349,7 +349,6 @@ class SeedOptionsView(View):
|
||||
from seedsigner.views.psbt_views import PSBTOverviewView
|
||||
|
||||
SCAN_PSBT = ("Scan PSBT", FontAwesomeIconConstants.QRCODE)
|
||||
REVIEW_PSBT = "Review PSBT"
|
||||
VERIFY_ADDRESS = "Verify Addr"
|
||||
EXPORT_XPUB = "Export Xpub"
|
||||
EXPLORER = "Address Explorer"
|
||||
@@ -375,20 +374,7 @@ class SeedOptionsView(View):
|
||||
VERIFY_ADDRESS += f" {addr}"
|
||||
button_data.append(VERIFY_ADDRESS)
|
||||
|
||||
if self.controller.psbt:
|
||||
if PSBTParser.has_matching_input_fingerprint(self.controller.psbt, self.seed, network=self.settings.get_value(SettingsConstants.SETTING__NETWORK)):
|
||||
if self.controller.resume_main_flow and self.controller.resume_main_flow == Controller.FLOW__PSBT:
|
||||
# Re-route us directly back to the start of the PSBT flow
|
||||
self.controller.resume_main_flow = None
|
||||
self.controller.psbt_seed = self.seed
|
||||
return Destination(PSBTOverviewView, skip_current_view=True)
|
||||
else:
|
||||
# This seed does not seem to be a signer for this PSBT
|
||||
# TODO: How sure are we? Should disable this entirely if we're 100% sure?
|
||||
REVIEW_PSBT += " (?)"
|
||||
button_data.append(REVIEW_PSBT)
|
||||
else:
|
||||
button_data.append(SCAN_PSBT)
|
||||
button_data.append(SCAN_PSBT)
|
||||
|
||||
if self.settings.get_value(SettingsConstants.SETTING__XPUB_EXPORT) == SettingsConstants.OPTION__ENABLED:
|
||||
button_data.append(EXPORT_XPUB)
|
||||
@@ -411,12 +397,9 @@ class SeedOptionsView(View):
|
||||
# Force BACK to always return to the Main Menu
|
||||
return Destination(MainMenuView)
|
||||
|
||||
if button_data[selected_menu_num] == REVIEW_PSBT:
|
||||
self.controller.psbt_seed = self.controller.get_seed(self.seed_num)
|
||||
return Destination(PSBTOverviewView)
|
||||
|
||||
if button_data[selected_menu_num] == SCAN_PSBT:
|
||||
from seedsigner.views.scan_views import ScanView
|
||||
self.controller.psbt_seed = self.controller.get_seed(self.seed_num)
|
||||
return Destination(ScanView)
|
||||
|
||||
elif button_data[selected_menu_num] == VERIFY_ADDRESS:
|
||||
|
||||
Reference in New Issue
Block a user