I noticed there is a problem with dumpwallet option. It does not seem to dump segwit addresses ("3"), and dumps only the standard one ("1"). Is it a bug or work as intended? How can I perform full dump of an wallet then?
file << strprintf("label=%s", EncodeDumpString(pwallet->mapAddressBook[keyid].name));
            } else if (keyid == masterKeyID) {
                file << "hdmaster=1";
            } else if (mapKeyPool.count(keyid)) {
                file << "reserve=1";
            } else if (pwallet->mapKeyMetadata[keyid].hdKeypath == "m") {
                file << "inactivehdmaster=1";
            } else {
                file << "change=1";
            }
            file << strprintf(" # addr=%s%s\n", strAddr, (pwallet->mapKeyMetadata[keyid].hdKeypath.size() > 0 ? " hdkeypath="+pwallet->mapKeyMetadata[keyid].hdKeypath : ""));
        }
    }
    file << "\n";
    for (const CScriptID &scriptid : scripts) {
        CScript script;
        std::string address = EncodeDestination(scriptid);
        if(pwallet->GetCScript(scriptid, script)) {
            file << strprintf("%s 0 script=1", HexStr(script.begin(), script.end()));
            file << strprintf(" # addr=%s\n", address);
        }
    }
    file << "\n";
    file << "# End of dump\n";
    file.close();
    UniValue reply(UniValue::VOBJ);
    reply.push_back(Pair("filename", filepath.string()));
    return reply;
}
UniValue ProcessImport(CWallet * const pwallet, const UniValue& data, const int64_t timestamp)