Unless there is something important I’m missing, we’re just possible leaking information by preserving whatever ordering json object ordering is giving us (no guarantees at all).
This is unneeded for sendtoaddress
since there is only 1 or 2 outputs, and the change output is shuffled in.
This will not effect *raw
behavior by design, since users generally want full control using those apis. Further PRs could add optional args to over-ride that behavior.
Alternative ideas would be to sort the outputs by some deterministic ordering. (this would require more refactoring since change outputs are created and handled by caller)