mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-18 12:28:09 +00:00
refactor(core/bitcoin): Use global static buffer for Tx serialization.
This commit is contained in:
parent
fb9b53930e
commit
8538f55edc
@ -36,6 +36,7 @@ if False:
|
||||
|
||||
# the number of bytes to preallocate for serialized transaction chunks
|
||||
_MAX_SERIALIZED_CHUNK_SIZE = const(2048)
|
||||
_SERIALIZED_TX_BUFFER = empty_bytearray(_MAX_SERIALIZED_CHUNK_SIZE)
|
||||
|
||||
|
||||
class Bitcoin:
|
||||
@ -77,6 +78,8 @@ class Bitcoin:
|
||||
coin: CoinInfo,
|
||||
approver: approvers.Approver | None,
|
||||
) -> None:
|
||||
global _SERIALIZED_TX_BUFFER
|
||||
|
||||
self.tx_info = TxInfo(self, helpers.sanitize_sign_tx(tx, coin))
|
||||
self.keychain = keychain
|
||||
self.coin = coin
|
||||
@ -93,7 +96,8 @@ class Bitcoin:
|
||||
self.external: set[int] = set()
|
||||
|
||||
# transaction and signature serialization
|
||||
self.serialized_tx = empty_bytearray(_MAX_SERIALIZED_CHUNK_SIZE)
|
||||
_SERIALIZED_TX_BUFFER[:] = bytes()
|
||||
self.serialized_tx = _SERIALIZED_TX_BUFFER
|
||||
self.tx_req = TxRequest()
|
||||
self.tx_req.details = TxRequestDetailsType()
|
||||
self.tx_req.serialized = TxRequestSerializedType()
|
||||
|
Loading…
Reference in New Issue
Block a user