moneromooo-monero commented on this pull request.
> @@ -8423,16 +8529,15 @@ std::vector
// here, check if we need to sent tx and start a new one
LOG_PRINT_L2(«Considering whether to create a tx now, » << tx.selected_transfers.size() << " inputs, tx limit " - << upper_transaction_size_limit); - const size_t estimated_rct_tx_size = estimate_tx_size(use_rct, tx.selected_transfers.size(), fake_outs_count, tx.dsts.size() + 1, extra.size(), bulletproof); - bool try_tx = (unused_dust_indices.empty() && unused_transfers_indices.empty()) || ( estimated_rct_tx_size >= TX_SIZE_TARGET(upper_transaction_size_limit));
+ << upper_transaction_weight_limit); + const size_t estimated_rct_tx_weight = estimate_tx_weight(use_rct, tx.selected_transfers.size(), fake_outs_count, tx.dsts.size() + 2, extra.size(), bulletproof); +1 for the change, and +1 for the hypothetical output we'd add if we didn't try a tx now. That said, since we're aiming for 2/3 of the max size, it's not clear whether the best is to stop before we reach that target, or only after we're past it.