Skip to content

Commit

Permalink
wb | keep one stake-delegators genesis keys per producer
Browse files Browse the repository at this point in the history
  • Loading branch information
fmaste committed Dec 30, 2024
1 parent 551db59 commit aa8bb84
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions nix/workbench/genesis/genesis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -734,14 +734,31 @@ genesis-create-testnet-data() {
mkdir -p "$dir/utxo-keys"
link_keys utxo-keys utxo-keys

info genesis "removing delegator keys."
rm "$dir/stake-delegators" -rf

local is_voting
is_voting=$(jq --raw-output '.generator.drep_voting' "$profile_json")
if [[ "$is_voting" == "true" ]];
then info genesis "voting workload specified - skipping deletion of DRep keys"
then
info genesis "voting workload specified - keeping one stake key per producer"
mv "$dir/stake-delegators" "$dir/stake-delegators.bak"
mkdir "$dir/stake-delegators"
local pools
pools="$(jq --raw-output '.composition.n_pools' "${profile_json}")"
for i in $(seq 1 $pools)
do
if test -d "$dir/stake-delegators.bak/delegator${i}"
then
local from_dir to_dir
from_dir="$dir/stake-delegators.bak/delegator${i}"
to_dir="$dir/stake-delegators/delegator$(($i - 1))"
mkdir "$to_dir"
cp "$from_dir"/{payment,staking}.{skey,vkey} "$to_dir"/
fi
done
rm "$dir/stake-delegators.bak" -rf
info genesis "voting workload specified - skipping deletion of DRep keys"
else
info genesis "removing delegator keys."
rm "$dir/stake-delegators" -rf
info genesis "removing dreps keys."
rm "$dir"/drep-keys -rf
fi
Expand Down

0 comments on commit aa8bb84

Please sign in to comment.