Skip to content

Instantly share code, notes, and snippets.

@LarryRuane
Last active June 23, 2020 21:18
Show Gist options
  • Save LarryRuane/42b181618757c6aacba6f41d53fdbca7 to your computer and use it in GitHub Desktop.
Save LarryRuane/42b181618757c6aacba6f41d53fdbca7 to your computer and use it in GitHub Desktop.
#!/bin/bash
# reproduce https://github.com/zcash/zcash/issues/4301
test ! -f zcashd && { echo ./zcashd not found;exit 1;}
rm -rf dd
mkdir dd
(echo regtest=1 ; testnet=1 ; echo rpcuser=u ; echo rpcpassword=p) > dd/zcash.conf
./zcashd -datadir=dd -nuparams=5ba81b19:1 -nuparams=76b809bb:2 -nuparams=2bb40e60:3 -nuparams=f5b9230b:4 &
sleep 8
./zcash-cli -datadir=dd generate 4
./zcash-cli -datadir=dd z_getnewaddress sapling >testzaddr
./zcash-cli -datadir=dd stop
wait
./zcashd -datadir=dd -nuparams=5ba81b19:1 -nuparams=76b809bb:2 -nuparams=2bb40e60:3 -nuparams=f5b9230b:4 -mineraddress=$(cat testzaddr) &
sleep 8
./zcash-cli -datadir=dd generate 1
./zcash-cli -datadir=dd stop
wait
./zcashd -datadir=dd -nuparams=5ba81b19:1 -nuparams=76b809bb:2 -nuparams=2bb40e60:3 -nuparams=f5b9230b:4 -mineraddress=$(cat testzaddr) &
sleep 3620 # one hour(+), so that the next generate causes SetBestChain() to run
./zcash-cli -datadir=dd generate 1
./zcash-cli -datadir=dd stop
wait
./zcashd -datadir=dd -nuparams=5ba81b19:1 -nuparams=76b809bb:2 -nuparams=2bb40e60:3 -nuparams=f5b9230b:4 -mineraddress=$(cat testzaddr) &
sleep 8
./zcash-cli -datadir=dd generate 1 # this should cause zcashd to assert
wait
@LarryRuane
Copy link
Author

Just had to update sleep 4 to sleep 8 because startup can take longer than 4 seconds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment