fundrawtransaction was not respecting max_tx_weight in one case.
If the provided inputs were already enough to fund the transaction, coin selection returned early. The final weight check then used the standard 400,000 WU ceiling instead of the requested max_tx_weight.
I reproduced this with 10 legacy inputs and max_tx_weight=4000. Funding succeeded even though the transaction was 6,168 WU after signing. Same result with both add_inputs=false and add_inputs=true.
The fix is to use the configured max weight in the final check.
For signed transactions, it checks the actual transaction weight. For unsigned transactions, it checks the estimated signed weight.
I added a regression test for both add_inputs settings:
4000 WUmust fail8000 WUmust fund successfully- after signing, the transaction must still be within the limit
The test fails before the fix and passes after it.
Tested on macOS arm64:
wallet_fundrawtransaction.pywallet_send.pywallet_v3_txs.py- live regtest reproduction
All passed.