<!-- This issue tracker is only for technical issues related to Bitcoin Core.

General bitcoin questions and/or support requests are best directed to the Bitcoin StackExchange at https://bitcoin.stackexchange.com.

For reporting security issues, please read instructions at https://bitcoincore.org/en/contact/.

If the node is "stuck" during sync or giving "block checksum mismatch" errors, please ensure your hardware is stable by running memtest and observe CPU temperature with a load-test tool such as linpack before creating an issue! -->

<!-- Describe the issue -->

During startup of bitcoint-qt version 0.16.0

```
$ ./bitcoin-qt
```

 the following assertion is triggered:

```
bitcoin-qt: wallet/wallet.cpp:542: void CWallet::SyncMetaData(std::pair<std::_Rb_tree_iterator<std::pair<const COutPoint, uint256> >, std::_Rb_tree_iterator<std::pair<const COutPoint, uint256> > >): Assertion `copyFrom' failed.
```

The issue reliably reproduces with 0.16.0 when using the same `~/.bitcoin` directory that was used without problems in 0.15.1. Relaunching 0.15.1 instead of 0.16.0 gives no assertion failure and still works without any issue.

A (stripped down) [debug.log](https://github.com/bitcoin/bitcoin/files/1958057/debug.log) is attached here. The log really ends at `2018-04-28 17:21:47 init message: Loading wallet...` (which seems consistent with the assertion failure).

`bitcoin.conf` is an empty, zero byte file.

This machine runs (K)Ubuntu 17.04. CPU is an AMD A6-7400K Radeon R5, 6 Compute Cores 2C+4G. Disk is an Intel 512 GB 545s SSD.

Bitcoin Core 0.15.1 was downloaded from [https://bitcoin.org/bin/bitcoin-core-0.15.1/bitcoin-0.15.1-x86_64-linux-gnu.tar.gz](https://bitcoin.org/bin/bitcoin-core-0.15.1/bitcoin-0.15.1-x86_64-linux-gnu.tar.gz) if I recall correctly.

Bitcoin Core 0.16.0 was downloaded from [https://bitcoincore.org/bin/bitcoin-core-0.16.0/bitcoin-0.16.0-x86_64-linux-gnu.tar.gz](https://bitcoincore.org/bin/bitcoin-core-0.16.0/bitcoin-0.16.0-x86_64-linux-gnu.tar.gz).

Note that those are *not* versions from the Ubuntu repositories/the Ubuntu specific downloads.

<!--- What behavior did you expect? -->

<!--- What was the actual behavior (provide screenshots if the issue is GUI-related)? -->

<!--- How reliably can you reproduce the issue, what are the steps to do so? -->

<!-- What version of Bitcoin Core are you using, where did you get it (website, self-compiled, etc)? -->

<!-- What type of machine are you observing the error on (OS/CPU and disk type)? -->

<!-- Any extra information that might be useful in the debugging process. -->
<!--- This is normally the contents of a `debug.log` or `config.log` file. Raw text or a link to a pastebin type site are preferred. -->

wtxOrdered.insert(std::make_pair(wtx.nOrderPos, TxPair(&wtx, nullptr)));
        wtx.nTimeSmart = ComputeTimeSmart(wtx);
        AddToSpends(hash);
    }
    bool fUpdated = false;
    if (!fInsertedNew)
    {
        
        if (!wtxIn.hashUnset() && wtxIn.hashBlock != wtx.hashBlock)
        {
            wtx.hashBlock = wtxIn.hashBlock;
            fUpdated = true;
        }
        
        if (wtxIn.hashBlock.IsNull() && wtx.isAbandoned())
        {
            wtx.hashBlock = wtxIn.hashBlock;
            fUpdated = true;
        }
        if (wtxIn.nIndex != -1 && (wtxIn.nIndex != wtx.nIndex))
        {
            wtx.nIndex = wtxIn.nIndex;
            fUpdated = true;
        }
        if (wtxIn.fFromMe && wtxIn.fFromMe != wtx.fFromMe)
        {
            wtx.fFromMe = wtxIn.fFromMe;
            fUpdated = true;
        }