The crash occurs because we assume the cached scripts structure will not be empty, but it can be empty for watch-only wallets that start blank.
This also adds test coverage for standalone imported keys, which were also crashing
because pubkey imports are treated the same way as hex script imports through
importaddress()
.
Testing Notes: This can be verified by cherry-picking and running any of the test commits on master. It will crash there but pass on this branch.