Make output argument last argument so it works more easily with IPC framework
in #10102, and for consistency with other methods
Backport of Core PR18278 part [4/6] : https://github.com/bitcoin/bitcoin/pull/18278/commits/96dfe5ced64979e51649d20555aa182defc80119
Depends on D8021