From 2e5a02ca0cc470eb56effb49c908d77d044f1170 Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 28 Jun 2022 13:17:21 -0700 Subject: [PATCH] ... --- cold-setup | 17 ++- test/multisig_create.tests.sh | 8 +- test/multisig_create_interactive.tests.sh | 3 + test/setup.sh | 116 +++++++++--------- ...wallet_multisig_spend_correctness.tests.sh | 2 +- 5 files changed, 80 insertions(+), 66 deletions(-) diff --git a/cold-setup b/cold-setup index 4e91bd3..81127a7 100755 --- a/cold-setup +++ b/cold-setup @@ -2,17 +2,24 @@ set -euo pipefail +# filesystem directories DATA_DIRECTORY=".data" +USB_DIRECTORY="$DATA_DIRECTORY/.usb" + +# options +ENCRYPTION="luks" +MODE= + +# multisig parameters (M of N) M=3 N=7 -MODE= -ENCRYPTION="luks" -USB_PATH= -USB_DIRECTORY="$DATA_DIRECTORY/.usb" + +# variables used in usb functions USB_DECRYPT_NAME="cold-usb" +USB_PATH= USB_PATH_PRE_DECRYPT= -BITCOIN_CLI="bitcoin-cli -datadir=$DATA_DIRECTORY -chain=regtest" +BITCOIN_CLI="bitcoin-cli -datadir=$DATA_DIRECTORY" bitcoin_core_start() { RUNNING=`ps -A | ( grep bitcoind > /dev/null && echo "1" ) || echo "0"` diff --git a/test/multisig_create.tests.sh b/test/multisig_create.tests.sh index a6333f3..c96f35c 100755 --- a/test/multisig_create.tests.sh +++ b/test/multisig_create.tests.sh @@ -9,25 +9,25 @@ setup_env setup_test_wallets multisig_create -EXPECTED="87faa7387bf537283ef62654bf897c4198e3e27c7c97868cdda2e9dcf1945685dfc00722272a97f690afdb6549aaf16fe3e05f78c5fef8447b798787dd092891 .data/descriptors.txt" +EXPECTED="c7f64e597a1a36e00eacd8683dd235cb5a27718b93020a450ef8dfaadcadc971944cf9ecb222523f45aab629e07d0b30432811ebcec1a93f7c9185feadf7d722 .data/descriptors.txt" assert "$EXPECTED" "`b2sum $DATA_DIRECTORY/descriptors.txt`" M=1 N=3 multisig_create -EXPECTED="a4cfdcbe25bd990e66bd6f8f86597cbeca08fb38b5fa448f7d77e9bc8de24e52c6dabfd25e6ddd1e716c6fac695af5e5d830a43e654a84c1bb51db937599f37f .data/descriptors.txt" +EXPECTED="8cc32973b09603ed26f038c2812d91b465a70dd70076645569d4e4a1b6ec399b05b48b091ae587fd89fc9b5a4002897a1cced1a74b43975093db3d7b1698804c .data/descriptors.txt" assert "$EXPECTED" "`b2sum $DATA_DIRECTORY/descriptors.txt`" M=3 N=5 multisig_create -EXPECTED="702de574ece926314e6ffdc2cba809549eeea97e5e3de16dfed41c462dcc84ffeb9bcd2a5b95b7aa3747c336aa6ad7beaeb7376e607a35c7cd762db9bb6b2425 .data/descriptors.txt" +EXPECTED="b1b5c5ece2083d4310af19a93dd91e7efd7aa8b68dfa45773f5c7f98002797e22e8a6239b4eaa2a57de7180668d5711b54f69b3f2ba3fd99acba48353306908f .data/descriptors.txt" assert "$EXPECTED" "`b2sum $DATA_DIRECTORY/descriptors.txt`" M=6 N=7 multisig_create -EXPECTED="48513d041c3eeaa162dde91f252dee4925eb1a2ecb8099ca6d64a121e913ca49322fea7eaf00af8a80dfc59f6764033272f81bb369b3eebcfbd19d6054863410 .data/descriptors.txt" +EXPECTED="dbad09fff0449b0424c3261b80a103006117557e591f35b1b14a24506a799637a1762212bef182b65f61d8a4f1b1951d2b2578efe9057d2bfa687791d1fcad85 .data/descriptors.txt" assert "$EXPECTED" "`b2sum $DATA_DIRECTORY/descriptors.txt`" clean_env diff --git a/test/multisig_create_interactive.tests.sh b/test/multisig_create_interactive.tests.sh index c03c25b..90f0a8c 100755 --- a/test/multisig_create_interactive.tests.sh +++ b/test/multisig_create_interactive.tests.sh @@ -113,6 +113,9 @@ Format descriptors.txt to be ready to append change descriptors: Use bitcoin core to get information on fully formed change descriptors and output result to descriptors.txt: cat change.descriptors | bitcoin-cli -stdin getdescriptorinfo | jq -j '.descriptor' >> descriptors.txt + + +multi-signature descriptors created and saved to descriptors.txt successfully EOF assert "$( /dev/null 2>&1 setup_test_descriptors() { + RANGE=${1:-999} + cat > wallet1.descriptors << EOF { "wallet_name": "wallet1", @@ -36,7 +40,7 @@ setup_test_descriptors() { "internal": false, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -47,7 +51,7 @@ setup_test_descriptors() { "internal": false, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -58,7 +62,7 @@ setup_test_descriptors() { "internal": false, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -69,7 +73,7 @@ setup_test_descriptors() { "internal": false, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -80,7 +84,7 @@ setup_test_descriptors() { "internal": true, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -91,7 +95,7 @@ setup_test_descriptors() { "internal": true, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -102,7 +106,7 @@ setup_test_descriptors() { "internal": true, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -113,7 +117,7 @@ setup_test_descriptors() { "internal": true, "range": [ 0, - 2999 + $RANGE ], "next": 0 } @@ -132,7 +136,7 @@ EOF "internal": false, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -143,7 +147,7 @@ EOF "internal": false, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -154,7 +158,7 @@ EOF "internal": false, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -165,7 +169,7 @@ EOF "internal": false, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -176,7 +180,7 @@ EOF "internal": true, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -187,7 +191,7 @@ EOF "internal": true, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -198,7 +202,7 @@ EOF "internal": true, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -209,7 +213,7 @@ EOF "internal": true, "range": [ 0, - 2999 + $RANGE ], "next": 0 } @@ -228,7 +232,7 @@ EOF "internal": false, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -239,7 +243,7 @@ EOF "internal": false, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -250,7 +254,7 @@ EOF "internal": false, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -261,7 +265,7 @@ EOF "internal": false, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -272,7 +276,7 @@ EOF "internal": true, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -283,7 +287,7 @@ EOF "internal": true, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -294,7 +298,7 @@ EOF "internal": true, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -305,7 +309,7 @@ EOF "internal": true, "range": [ 0, - 2999 + $RANGE ], "next": 0 } @@ -324,7 +328,7 @@ EOF "internal": false, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -335,7 +339,7 @@ EOF "internal": false, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -346,7 +350,7 @@ EOF "internal": false, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -357,7 +361,7 @@ EOF "internal": false, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -368,7 +372,7 @@ EOF "internal": true, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -379,7 +383,7 @@ EOF "internal": true, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -390,7 +394,7 @@ EOF "internal": true, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -401,7 +405,7 @@ EOF "internal": true, "range": [ 0, - 2999 + $RANGE ], "next": 0 } @@ -420,7 +424,7 @@ EOF "internal": false, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -431,7 +435,7 @@ EOF "internal": false, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -442,7 +446,7 @@ EOF "internal": false, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -453,7 +457,7 @@ EOF "internal": false, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -464,7 +468,7 @@ EOF "internal": true, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -475,7 +479,7 @@ EOF "internal": true, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -486,7 +490,7 @@ EOF "internal": true, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -497,7 +501,7 @@ EOF "internal": true, "range": [ 0, - 2999 + $RANGE ], "next": 0 } @@ -516,7 +520,7 @@ EOF "internal": false, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -527,7 +531,7 @@ EOF "internal": false, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -538,7 +542,7 @@ EOF "internal": false, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -549,7 +553,7 @@ EOF "internal": false, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -560,7 +564,7 @@ EOF "internal": true, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -571,7 +575,7 @@ EOF "internal": true, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -582,7 +586,7 @@ EOF "internal": true, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -593,7 +597,7 @@ EOF "internal": true, "range": [ 0, - 2999 + $RANGE ], "next": 0 } @@ -612,7 +616,7 @@ EOF "internal": false, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -623,7 +627,7 @@ EOF "internal": false, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -634,7 +638,7 @@ EOF "internal": false, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -645,7 +649,7 @@ EOF "internal": false, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -656,7 +660,7 @@ EOF "internal": true, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -667,7 +671,7 @@ EOF "internal": true, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -678,7 +682,7 @@ EOF "internal": true, "range": [ 0, - 2999 + $RANGE ], "next": 0 }, @@ -689,7 +693,7 @@ EOF "internal": true, "range": [ 0, - 2999 + $RANGE ], "next": 0 } diff --git a/test/wallet_multisig_spend_correctness.tests.sh b/test/wallet_multisig_spend_correctness.tests.sh index 095150f..f49c772 100755 --- a/test/wallet_multisig_spend_correctness.tests.sh +++ b/test/wallet_multisig_spend_correctness.tests.sh @@ -77,7 +77,7 @@ MULTISIG_DESCRIPTORS="`cat "$DATA_DIRECTORY/descriptors.txt"`" reset_env -setup_test_descriptors +setup_test_descriptors 2999 (eval "$BITCOIN_CLI -named createwallet wallet_name=live descriptors=true blank=true disable_private_keys=true" > result) EXPECTED='{ -- 2.39.5