mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-25 07:58:12 +00:00
requested changes #2
This commit is contained in:
parent
fd95ff0531
commit
c588d0b4f3
@ -62,11 +62,11 @@ async def sign_tx(ctx, msg, keychain):
|
|||||||
)
|
)
|
||||||
|
|
||||||
elif msg.proposal is not None:
|
elif msg.proposal is not None:
|
||||||
proposed_protocols = _get_protocol_hash_from_msg(msg.proposal.proposals)
|
proposed_protocols = [_get_protocol_hash(p) for p in msg.proposal.proposals]
|
||||||
await layout.show_proposals(ctx, proposed_protocols)
|
await layout.show_proposals(ctx, proposed_protocols)
|
||||||
|
|
||||||
elif msg.ballot is not None:
|
elif msg.ballot is not None:
|
||||||
proposed_protocol = _get_protocol_hash_from_msg(msg.ballot.proposal)
|
proposed_protocol = _get_protocol_hash(msg.ballot.proposal)
|
||||||
submitted_ballot = _get_ballot(msg.ballot.ballot)
|
submitted_ballot = _get_ballot(msg.ballot.ballot)
|
||||||
await layout.require_confirm_ballot(ctx, proposed_protocol, submitted_ballot)
|
await layout.require_confirm_ballot(ctx, proposed_protocol, submitted_ballot)
|
||||||
|
|
||||||
@ -119,13 +119,8 @@ def _get_address_from_contract(address):
|
|||||||
raise wire.DataError("Invalid contract type")
|
raise wire.DataError("Invalid contract type")
|
||||||
|
|
||||||
|
|
||||||
def _get_protocol_hash_from_msg(proposals):
|
def _get_protocol_hash(proposal):
|
||||||
print(proposals)
|
return helpers.base58_encode_check(proposal, prefix="P")
|
||||||
if type(proposals) is not list:
|
|
||||||
return helpers.base58_encode_check(proposals, prefix="P")
|
|
||||||
return [
|
|
||||||
helpers.base58_encode_check(proposal, prefix="P") for proposal in proposals
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
def _get_ballot(ballot):
|
def _get_ballot(ballot):
|
||||||
@ -212,7 +207,7 @@ def _encode_proposal(w: bytearray, proposal):
|
|||||||
write_uint8(w, proposal_tag)
|
write_uint8(w, proposal_tag)
|
||||||
write_bytes(w, proposal.source)
|
write_bytes(w, proposal.source)
|
||||||
write_uint32_be(w, proposal.period)
|
write_uint32_be(w, proposal.period)
|
||||||
write_uint32_be(w, _get_proposals_bytecount(proposal.proposals))
|
write_uint32_be(w, len(proposal.proposals) * PROPOSAL_LENGTH)
|
||||||
for proposal_hash in proposal.proposals:
|
for proposal_hash in proposal.proposals:
|
||||||
write_bytes(w, proposal_hash)
|
write_bytes(w, proposal_hash)
|
||||||
|
|
||||||
@ -225,7 +220,3 @@ def _encode_ballot(w: bytearray, ballot):
|
|||||||
write_uint32_be(w, ballot.period)
|
write_uint32_be(w, ballot.period)
|
||||||
write_bytes(w, ballot.proposal)
|
write_bytes(w, ballot.proposal)
|
||||||
write_uint8(w, ballot.ballot)
|
write_uint8(w, ballot.ballot)
|
||||||
|
|
||||||
|
|
||||||
def _get_proposals_bytecount(proposals):
|
|
||||||
return len(proposals) * PROPOSAL_LENGTH
|
|
||||||
|
Loading…
Reference in New Issue
Block a user