When the wallet is rescanned at startup in `bitcoind`, there seems to be no way to interrupt that in a clean way (other than forcefully killing the process).
{
    
    CKey key;                      
    CExtKey masterKey;             
    CExtKey accountKey;            
    CExtKey chainChildKey;         
    CExtKey childKey;              
    
    if (!GetKey(hdChain.masterKeyID, key))
        throw std::runtime_error(std::string(__func__) + ": Master key not found");
    masterKey.SetMaster(key.begin(), key.size());