MyHush / hush

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

Add optional minBranchLen argument to getchaintips RPC #151

Closed leto closed 6 years ago

leto commented 6 years ago

getchaintips now takes optional argument to filter out all tips with a branchlen < minBranchLen . It's normal to get branchlen=1, but larger branchlen's are indicative of mining attacks. For instance, recently on Hush are many branchlen's between 20 to 45, which are selfish mining attacks, which were also potentially double spend attacks.

This change makes it easy to filter out normal tips so potential mining attacks can be easily spotted. getchaintips 2 will most likely only contain tips of a selfish miner, it's extremely improbable that chaintips of branchlen>=2 happen normally.

Additionally, it was discovered that Hush getchaintips tests failed because of assumptions in the test suite inherited from ZEC/BTC. These have been fixed and now getchaintips tests pass, including testing the new optional argument.

Thanks to @hellcatz of LuckPool for suggesting this feature to Hush core devs.