From d69135da42e9df13fdc8fd9b131072ef695e1967 Mon Sep 17 00:00:00 2001 From: Rob N Date: Wed, 4 Dec 2024 08:36:32 -1000 Subject: [PATCH 1/2] doc: update `README` with testing guide --- README.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8cc109f..09d3b07 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ let mut addresses = HashSet::new(); addresses.insert(address); let builder = NodeBuilder::new(bitcoin::Network::Signet); // Add node preferences and build the node/client -let (mut node, mut client) = builder +let (node, client) = builder // Add the peers .add_peers(vec![TrustedPeer::from_ip(peer_1), TrustedPeer::from_ip(peer_1)]) // The Bitcoin scripts to monitor @@ -76,7 +76,7 @@ While connections over the Tor protocol are supported by the feature `tor`, the The preferred workflow is by using `just`. If you do not have `just` installed, check out the [installation page](https://just.systems/man/en/chapter_4.html). -To run the unit tests: +To run the unit tests and doc tests: ``` just test @@ -88,18 +88,22 @@ To sync with a live Signet node: just sync ``` -And to run scenarios against your `bitcoind` instance: +And to run scenarios against your `bitcoind` instance, set a `BITCOIND_EXE` environment variable to the path to `bitcoind`: ``` -just integrate +export BITCOIND_EXE = "/usr/path/to/bitcoind/" ``` -The default path to the `.bitcoin` directory is for Linux. To set this path to another operating system or location: +You may want to add this to your bash or zsh profile. + +To run the `bitcoind` tests: ``` -just bitcoindir=/path/to/bitcoin/folder/ integrate +just integrate ``` +If you do not have `bitcoind` installed, you may simply run `just integrate` and it will be installed for you in the `build` folder. + ## Project Layout `chain`: Contains all logic for syncing block headers, filter headers, filters, parsing blocks. Also contains preset checkpoints for Signet, Regtest, and Bitcoin networks. Notable files: `chain.rs` From a9128244417ca2a37102cb61c015d37f56ee05cd Mon Sep 17 00:00:00 2001 From: Rob N Date: Wed, 4 Dec 2024 08:37:36 -1000 Subject: [PATCH 2/2] lib: remove unneeded bash scripts --- scripts/integration.sh | 54 ------------------------------------------ scripts/kill.sh | 1 - scripts/mine.sh | 9 ------- scripts/regtest.sh | 1 - 4 files changed, 65 deletions(-) delete mode 100644 scripts/integration.sh delete mode 100644 scripts/kill.sh delete mode 100644 scripts/mine.sh delete mode 100644 scripts/regtest.sh diff --git a/scripts/integration.sh b/scripts/integration.sh deleted file mode 100644 index 59db081..0000000 --- a/scripts/integration.sh +++ /dev/null @@ -1,54 +0,0 @@ -if [ -z "$1" ]; then - echo "Usage: $0 " - exit 1 -fi -BITCOIN_DIR="$1" -echo "Cleaning up: $BITCOIN_DIR and starting integration tests" -rm -rf "$BITCOIN_DIR/regtest" -sleep 2 -rm -rf data -bitcoind --chain=regtest --txindex --blockfilterindex --peerblockfilters --rpcport=18443 --rpcuser=test --rpcpassword=kyoto --rest=1 --server=1 --listen=1 --printtoconsole=0 & -sleep 2 -echo "Testing in-memory reorganization" -cargo test -q test_reorg -- --nocapture -echo "Cleaning up..." -sleep 1 -rm -rf "$BITCOIN_DIR/regtest" -rm -rf data -bitcoind --chain=regtest --txindex --blockfilterindex --peerblockfilters --rpcport=18443 --rpcuser=test --rpcpassword=kyoto --rest=1 --server=1 --listen=1 --printtoconsole=0 --v2transport=1 & -sleep 2 -echo "Testing mining after reorganization" -cargo test -q test_mine_after_reorg -- --nocapture -echo "Cleaning up..." -sleep 1 -rm -rf data -rm -rf "$BITCOIN_DIR/regtest" -bitcoind --chain=regtest --txindex --blockfilterindex --peerblockfilters --rpcport=18443 --rpcuser=test --rpcpassword=kyoto --rest=1 --server=1 --listen=1 --printtoconsole=0 --v2transport=1 & -sleep 2 -echo "Testing SQL handles reorganization" -cargo test -q test_sql_reorg -- --nocapture -echo "Cleaning up..." -sleep 1 -rm -rf data -rm -rf "$BITCOIN_DIR/regtest" -bitcoind --chain=regtest --txindex --blockfilterindex --peerblockfilters --rpcport=18443 --rpcuser=test --rpcpassword=kyoto --rest=1 --server=1 --listen=1 --printtoconsole=0 --v2transport=1 & -sleep 2 -echo "Testing a reorganization of depth two" -cargo test -q test_two_deep_reorg -- --nocapture -echo "Cleaning up..." -sleep 1 -rm -rf data -rm -rf "$BITCOIN_DIR/regtest" -bitcoind --chain=regtest --txindex --blockfilterindex --peerblockfilters --rpcport=18443 --rpcuser=test --rpcpassword=kyoto --rest=1 --server=1 --listen=1 --printtoconsole=0 --v2transport=1 & -sleep 2 -echo "Mining blocks" -RPC_USER="test" -RPC_PASSWORD="kyoto" -CHAIN="regtest" -WALLET="test_kyoto" -bitcoin-cli -chain=$CHAIN -rpcuser=$RPC_USER -rpcpassword=$RPC_PASSWORD createwallet $WALLET -bitcoin-cli -chain=$CHAIN -rpcuser=$RPC_USER -rpcpassword=$RPC_PASSWORD loadwallet $WALLET -NEW_ADDRESS=$(bitcoin-cli -chain=$CHAIN -rpcuser=$RPC_USER -rpcpassword=$RPC_PASSWORD getnewaddress) -bitcoin-cli -chain=$CHAIN -rpcuser=$RPC_USER -rpcpassword=$RPC_PASSWORD generatetoaddress 2500 $NEW_ADDRESS -echo "Testing start on stale block" -cargo test -q test_sql_stale_anchor -- --nocapture \ No newline at end of file diff --git a/scripts/kill.sh b/scripts/kill.sh deleted file mode 100644 index e3fa645..0000000 --- a/scripts/kill.sh +++ /dev/null @@ -1 +0,0 @@ -bitcoin-cli -chain=regtest -rpcuser="test" -rpcpassword="kyoto" stop \ No newline at end of file diff --git a/scripts/mine.sh b/scripts/mine.sh deleted file mode 100644 index b602fe6..0000000 --- a/scripts/mine.sh +++ /dev/null @@ -1,9 +0,0 @@ - -RPC_USER="test" -RPC_PASSWORD="kyoto" -CHAIN="regtest" -WALLET="test_kyoto" -bitcoin-cli -chain=$CHAIN -rpcuser=$RPC_USER -rpcpassword=$RPC_PASSWORD createwallet $WALLET -bitcoin-cli -chain=$CHAIN -rpcuser=$RPC_USER -rpcpassword=$RPC_PASSWORD loadwallet $WALLET -NEW_ADDRESS=$(bitcoin-cli -chain=$CHAIN -rpcuser=$RPC_USER -rpcpassword=$RPC_PASSWORD getnewaddress) -bitcoin-cli -chain=$CHAIN -rpcuser=$RPC_USER -rpcpassword=$RPC_PASSWORD generatetoaddress 2500 $NEW_ADDRESS \ No newline at end of file diff --git a/scripts/regtest.sh b/scripts/regtest.sh deleted file mode 100644 index a5e01c7..0000000 --- a/scripts/regtest.sh +++ /dev/null @@ -1 +0,0 @@ -bitcoind --chain=regtest --txindex --blockfilterindex --peerblockfilters --rpcport=18443 --rpcuser=test --rpcpassword=kyoto --rest=1 --server=1 --listen=1 --v2transport=1 \ No newline at end of file