dtr-org / unit-e

A digital currency for a new era of decentralized trust
https://unit-e.io
MIT License
45 stars 15 forks source link

Fix segmentation fault after unloading wallet #904

Closed cmihai closed 5 years ago

cmihai commented 5 years ago

Bitcoin 0.17 now allows us to unload (and re-load) wallets. This clashed with the CWalletExtension::ManagePendingSlashings, which was scheduled to run periodically every 10 seconds, and which tried to access the wallet, even though it could be unloaded by that moment.

This commit saves a reference to the wallet during the execution of the task, to avoid a segfault. Further, it introduces a new type of benign exception, task_unscheduled, which interrupts the execution of the current task and does not reschedule it.