16 lines
492 B
Bash
Executable File
16 lines
492 B
Bash
Executable File
#!/bin/sh
|
|
|
|
if [[ "$BITCOIN_CHAIN" = "regtest" ]]; then
|
|
# Check if the wallet already exists
|
|
if ! bitcoin-cli listwallets | grep -q "default"; then
|
|
# If the wallet does not exist, create it
|
|
bitcoin-cli createwallet default
|
|
fi
|
|
block_count=$(bitcoin-cli -chain=$BITCOIN_CHAIN getblockcount)
|
|
if [[ "$block_count" = "0" ]]; then
|
|
bitcoin-cli generatetoaddress 101 $(bitcoin-cli -chain=$BITCOIN_CHAIN getnewaddress)
|
|
fi
|
|
fi
|
|
|
|
bitcoin-cli -chain=$BITCOIN_CHAIN getblockchaininfo
|