Skip to content
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

Testnet buried #49

Merged
merged 3 commits into from Nov 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions releases/ChangeLog.md
Expand Up @@ -5,6 +5,12 @@
- Enhancement: Promoted the address explorer to the main menu. It's useful!
- Bugfix: zero-length BIP39 passphrase, when saved, would cause a crash when
restore attempted. We recommend longer passphrases, but fixed the issue.
- Enhancement: Move the "blockchain" setting deep into the "Danger Zone" and add
warning screen. This mitigates a concern raised by @benma (Marko Bencun) where
an attacker could socially-engineer you to sign a transaction on Testnet, which
corresponds to UTXO on main net being stolen. Only developers should be using
Testnet anyway.


## 3.1.9 - Aug 6, 2020

Expand Down
12 changes: 12 additions & 0 deletions shared/actions.py
Expand Up @@ -426,6 +426,18 @@ async def pick_scramble(*a):
from menu import start_chooser
start_chooser(scramble_keypad_chooser)

async def confirm_testnet_mode(*a):
from choosers import chain_chooser
from menu import start_chooser
from chains import current_chain

if settings.get('chain') != 'XTN':
if not await ux_confirm("Testnet must only be used by developers because \
correctly- crafted transactions signed on Testnet could be broadcast on Mainnet."):
return

start_chooser(chain_chooser)

async def pick_inputs_delete(*a):
# Setting: delete input PSBT
if await ux_show_story('''\
Expand Down
3 changes: 1 addition & 2 deletions shared/auth.py
Expand Up @@ -939,8 +939,7 @@ async def interact(self):


def start_bip39_passphrase(pw):
# tell the local user the secret words, and then save to SPI flash
# USB caller has to come back and download encrypted contents.
# new passphrase has come in via USB. offer to switch to it.

UserAuthorizedAction.cleanup()
UserAuthorizedAction.active_request = NewPassphrase(pw)
Expand Down
1 change: 1 addition & 0 deletions shared/choosers.py
Expand Up @@ -81,6 +81,7 @@ def set_login_countdown(idx, text):


def chain_chooser():
# Pick Bitcoin or Testnet3 blockchains
from chains import AllChains

chain = settings.get('chain', 'BTC')
Expand Down
2 changes: 1 addition & 1 deletion shared/flow.py
Expand Up @@ -63,7 +63,6 @@ def has_secrets():
MenuItem('Set Nickname', f=pick_nickname),
MenuItem('Scramble Keypad', f=pick_scramble),
MenuItem('Delete PSBTs', f=pick_inputs_delete),
MenuItem('Blockchain', chooser=chain_chooser),
]

WalletExportMenu = [
Expand Down Expand Up @@ -143,6 +142,7 @@ def has_secrets():
MenuItem("Set High-Water", f=set_highwater),
MenuItem('Wipe HSM Policy', f=wipe_hsm_policy, predicate=hsm_policy_available),
MenuItem('Clear OV cache', f=wipe_ovc),
MenuItem('Testnet Mode', f=confirm_testnet_mode),
MenuItem('Settings space', f=show_settings_space),
]

Expand Down
2 changes: 1 addition & 1 deletion shared/menu.py
Expand Up @@ -16,7 +16,7 @@ def start_chooser(chooser):
# get which one to show as selected, list of choices, and fcn to call after
selected, choices, setter = chooser()

def picked(menu, picked, xx_self):
async def picked(menu, picked, xx_self):
menu.chosen = picked
menu.show()
await sleep_ms(100) # visual feedback that we changed it
Expand Down
1 change: 1 addition & 0 deletions testing/test_pwsave.py
Expand Up @@ -43,6 +43,7 @@ def doit():
'aBc1 aBc2 aBc3',
'abcd defg',
'1aaa 2aaa',
'1aaa2aaa',
'ab'*25,
])
def test_first_time(pws, need_keypress, cap_story, pick_menu_item, goto_home, enter_complex, cap_menu, get_to_pwmenu):
Expand Down
4 changes: 3 additions & 1 deletion testing/test_sign.py
Expand Up @@ -309,10 +309,11 @@ def EncodeDecimal(o):
network = a2b_hex(resp['hex'])

# assert resp['complete']
#print("Final txn: %r" % network)
print("Final txn: %r" % network)
open('debug/finalized-by-btcd.txn', 'wb').write(network)

# try to send it
assert 0
txed = bitcoind.sendrawtransaction(B2A(network))
print("Final txn hash: %r" % txed)

Expand All @@ -321,6 +322,7 @@ def EncodeDecimal(o):
#print("Final txn: %s" % B2A(signed))
open('debug/finalized-by-cc.txn', 'wb').write(signed)

assert 0
txed = bitcoind.sendrawtransaction(B2A(signed))
print("Final txn hash: %r" % txed)

Expand Down