MyHush / hush

Hush is a fork of Zcash focused on secure communications
https://myhush.org
Other
67 stars 37 forks source link

Fix coredump on txindex=0 nodes #146

Closed leto closed 5 years ago

leto commented 5 years ago

This bug only exists when a node has txindex=0, the default, which all GUI wallets will have, and most mining pools. Notary nodes require txindex=1 and exchanges most likely use it as well, but most nodes on the network will have the default txindex=0.

This code was originally written for BTC 0.15 codebase, but it does not work correctly with BTC 0.11 internals. My belief is that wallet API in BTC 0.11 doesn't handle watch-only addresses gracefully, so instead, we use GetTransaction() with true parameter, which is slower but seems to work.

This was tested and worked on a partially (97% synced) node with txindex=0. The previous code coredumped and then this new code was able to correctly get to 100% sync, and had correct notarization information in getinfo output. This code is now sync'ing a txindex=0 node from scratch and I will update this PR with info when it completes.

Update: Node updated to 100% progress and notarization info is there!

  "notarizedhash": "00000006368a9b5e50f691c4874ab69c1209e789967e030f8de40b3df3ef9f6e",
  "notarizedtxid": "5e7e1275c7007993517aa4f1d3e3baff369ee55f013f8f38c1181f99c9b0b861",
  "notarized": 392070