Avoid copying undo data
Merge pull request #4835

ab15b2e Avoid copying undo data (Pieter Wuille)