-
Notifications
You must be signed in to change notification settings - Fork 30
Description
Bug Report
Current behavior:
After adding 58 UTXOs via add_utxo
, finalize_transaction
returns NULL
(we're trying to send a lot of Dogecoin.)
Upon investigation, it's because finalize_transaction
calls get_raw_transaction
, which then calls utils_uint8_to_hex
, and that has an internal size limit of 1023 bytes (TO_UINT8_HEX_BUF_LEN/2-1
). This is because it uses a static buffer buffer_uint8_to_hex
with a fixed size of 2048 hex chars.
Also note that utils_uint8_to_hex
returns a pointer to this static buffer, as does get_raw_transaction
and finally finalize_transaction
ends up returning this static buffer address out through the public API, which might be surprising.
Expected behavior
finalize_transaction
should return the encoded hex form of the transaction, even for transactions larger than 1023 bytes (2046 hex chars.)
Steps to reproduce:
Test case: #261
However any transaction with more than ~25 UTXOs will hit the size limit.
libdogecoin commit
0.1.5-dev @ c8955d2, self-compiled
The same code is also present on 0.2.0-dev
Machine specs
- OS: Mac OS 12.7.6
- CPU: M1 Max
- RAM: 32 GB
- Disk size: ugh 2TB
- Disk Type (HD/SDD): SSD
Extra information
FAILED - test_transaction() - Line 540
Expect: not NULL
Receive: NULL