#!/bin/sh


warn() {
    echo "WARN Need Flush"
}

trap warn TERM
echo Genesis $@
sleep 1
test -z $4 && exit 1001
echo 'UPGRADE "Chain2" NEEDED at height: 49: {}'
echo '{"name":"Chain2","height":49,"info":""}' > $4
# Shutdown grace test waits 2 seconds for flush
# Flush within 1 second
sleep 1
echo 'Flushed'
# Now chain is halted for shutdown grace test.
sleep 2
echo Did not kill in time. Never should be printed!!!
