Currently transactions in wallet's memory are ordered on purpose in OrderedTxItems. Also each in call to OrderedTxItems a walletdb is created which may take thousands of milliseconds. This especially affects importprivkey rpc.
The fix should remove OrderedTxItems() method and always keep transactions ordered.
When implementing avoid creating CWalletDB inside loops.
See also zcash@31d49b0
Currently transactions in wallet's memory are ordered on purpose in OrderedTxItems. Also each in call to OrderedTxItems a walletdb is created which may take thousands of milliseconds. This especially affects importprivkey rpc.
The fix should remove OrderedTxItems() method and always keep transactions ordered.
When implementing avoid creating CWalletDB inside loops.
See also zcash@31d49b0