- Use const where possible;
- Rename variables to make them clearer;
- There is no need to check whether command is null since it's a non-optional field.
Test that addnode with an invalid command should throw an error.
Make it clear in the doc that node in addnode refers to the node's address.
This is a backport of core#26366