2020-03-11 09:00:13 -07:00
|
|
|
#!/bin/bash
|
|
|
|
# Submits a list of blocks, one per line in the file, to darksidewalletd.
|
2020-05-04 17:11:13 -07:00
|
|
|
# Usage: ./submitblocks.sh <sapling activation> <file>
|
|
|
|
# e.g. ./submitblocks.sh 1000 blocks.txt
|
|
|
|
#
|
2020-03-11 09:00:13 -07:00
|
|
|
set -e
|
2020-05-06 23:05:05 -07:00
|
|
|
test $# -ne 2 && { echo usage: $0 sapling-height blocks-file;exit 1;}
|
2020-03-11 09:00:13 -07:00
|
|
|
|
2020-05-18 16:33:27 -07:00
|
|
|
# must do a Reset first
|
|
|
|
grpcurl -plaintext -d '{"saplingActivation":'$1',"branchID":"2bb40e60","chainName":"main"}' localhost:9067 cash.z.wallet.sdk.rpc.DarksideStreamer/Reset
|
2020-03-11 09:00:13 -07:00
|
|
|
|
2020-05-18 16:33:27 -07:00
|
|
|
# send the blocks and make them active
|
2020-05-04 17:11:13 -07:00
|
|
|
sed 's/^/{"block":"/;s/$/"}/' $2 |
|
2020-05-18 16:33:27 -07:00
|
|
|
grpcurl -plaintext -d @ localhost:9067 cash.z.wallet.sdk.rpc.DarksideStreamer/StageBlocksStream
|
|
|
|
let latest=$1+$(cat $2|wc -l)-1
|
|
|
|
grpcurl -plaintext -d '{"height":'$latest'}' localhost:9067 cash.z.wallet.sdk.rpc.DarksideStreamer/ApplyStaged
|