locktime ux fix (less spacing)
This commit is contained in:
parent
176a7f80cb
commit
d9be8cb2f1
@ -426,7 +426,6 @@ class ApproveTransaction(UserAuthorizedAction):
|
||||
|
||||
for label, m in self.psbt.ux_notes:
|
||||
msg.write('- %s: %s\n' % (label, m))
|
||||
msg.write("\n")
|
||||
|
||||
if self.psbt.warnings:
|
||||
msg.write('---WARNING---\n\n')
|
||||
@ -446,7 +445,7 @@ class ApproveTransaction(UserAuthorizedAction):
|
||||
|
||||
if not hsm_active:
|
||||
esc = ""
|
||||
msg.write("\nPress %s to approve and sign transaction." % OK)
|
||||
msg.write("Press %s to approve and sign transaction." % OK)
|
||||
if needs_txn_explorer:
|
||||
esc += "2"
|
||||
msg.write(" Press (2) to explore txn.")
|
||||
@ -686,7 +685,7 @@ class ApproveTransaction(UserAuthorizedAction):
|
||||
visible_change_sum = 0
|
||||
if len(largest_change) == 1:
|
||||
visible_change_sum += largest_change[0][0]
|
||||
msg.write(' - to address -\n%s\n' % show_single_address(largest_change[0][1]))
|
||||
msg.write(' - to address -\n%s\n\n' % show_single_address(largest_change[0][1]))
|
||||
else:
|
||||
msg.write(' - to addresses -\n')
|
||||
for val, addr in largest_change:
|
||||
@ -698,9 +697,7 @@ class ApproveTransaction(UserAuthorizedAction):
|
||||
if left_c:
|
||||
needs_txn_explorer = True
|
||||
msg.write('.. plus %d smaller change output(s), not shown here, which total: ' % left_c)
|
||||
msg.write('%s %s\n' % self.chain.render_value(total_change - visible_change_sum))
|
||||
|
||||
msg.write("\n")
|
||||
msg.write('%s %s\n\n' % self.chain.render_value(total_change - visible_change_sum))
|
||||
|
||||
# if we didn't already show all outputs, then give user a chance to
|
||||
# view them individually
|
||||
|
||||
@ -1313,11 +1313,11 @@ class psbtObject(psbtProxy):
|
||||
# Block height relative lock-time
|
||||
if num_bb == 1:
|
||||
idx, val = bb[0]
|
||||
msg = "Input %d. has relative block height timelock of %d blocks" % (
|
||||
msg = "Input %d. has relative block height timelock of %d blocks\n" % (
|
||||
idx, val
|
||||
)
|
||||
elif all(bb[0][1] == i[1] for i in bb):
|
||||
msg = "%d inputs have relative block height timelock of %d blocks" % (
|
||||
msg = "%d inputs have relative block height timelock of %d blocks\n" % (
|
||||
num_bb, bb[0][1]
|
||||
)
|
||||
else:
|
||||
@ -1335,11 +1335,11 @@ class psbtObject(psbtProxy):
|
||||
if num_tb == 1:
|
||||
idx, val = tb[0]
|
||||
val = seconds2human_readable(val)
|
||||
msg = "Input %d. has relative time-based timelock of:\n %s" % (
|
||||
msg = "Input %d. has relative time-based timelock of:\n %s\n" % (
|
||||
idx, val
|
||||
)
|
||||
elif all(tb[0][1] == i[1] for i in tb):
|
||||
msg = "%d inputs have relative time-based timelock of:\n %s" % (
|
||||
msg = "%d inputs have relative time-based timelock of:\n %s\n" % (
|
||||
num_tb, seconds2human_readable(tb[0][1])
|
||||
)
|
||||
else:
|
||||
|
||||
@ -2553,7 +2553,7 @@ def test_nsequence_blockheight_relative_locktime_ux(sequence, use_regtest, bitco
|
||||
@pytest.mark.bitcoind
|
||||
@pytest.mark.parametrize("num_ins", [1, 4, 11])
|
||||
@pytest.mark.parametrize("differ", [True, False])
|
||||
@pytest.mark.parametrize("seconds", [512, 10000, 1000000, 33554431])
|
||||
@pytest.mark.parametrize("seconds", [512, 10240, 1024000, 33554431])
|
||||
def test_nsequence_timebased_relative_locktime_ux(seconds, use_regtest, bitcoind_d_sim_watch, start_sign,
|
||||
microsd_path, cap_story, goto_home, press_select,
|
||||
pick_menu_item, bitcoind, end_sign, num_ins, differ,
|
||||
@ -2575,18 +2575,22 @@ def test_nsequence_timebased_relative_locktime_ux(seconds, use_regtest, bitcoind
|
||||
|
||||
ins = []
|
||||
num_ins_locked = 0
|
||||
locked_indexes = []
|
||||
for i, utxo in enumerate(utxos):
|
||||
# time-based RTL
|
||||
if i and differ:
|
||||
nSeq = sequence - (sequence * i)
|
||||
if i and differ and (seconds > 512):
|
||||
secs = seconds // i
|
||||
nSeq = SEQUENCE_LOCKTIME_TYPE_FLAG | (secs >> 9)
|
||||
if nSeq < 0:
|
||||
nSeq = 0
|
||||
|
||||
else:
|
||||
secs = seconds
|
||||
nSeq = sequence
|
||||
|
||||
if nSeq > 0:
|
||||
num_ins_locked += 1
|
||||
locked_indexes.append((i, secs))
|
||||
|
||||
inp = {
|
||||
"txid": utxo["txid"],
|
||||
@ -2618,9 +2622,9 @@ def test_nsequence_timebased_relative_locktime_ux(seconds, use_regtest, bitcoind
|
||||
if num_ins_locked == 1:
|
||||
assert ("has " + base_msg) in story
|
||||
else:
|
||||
if differ:
|
||||
if differ and (seconds > 512):
|
||||
assert ("%d inputs have relative time-based timelock." % num_ins_locked) in story
|
||||
for i in range(num_ins_locked):
|
||||
for i, _ in sorted(locked_indexes, key=lambda i: i[1], reverse=True)[:10]:
|
||||
assert ("%d. " % i) in story
|
||||
else:
|
||||
msg1 = "%d inputs have " % num_ins_locked
|
||||
|
||||
Loading…
Reference in New Issue
Block a user