at 23.11-pre 2.1 kB view raw
1import ./make-test-python.nix ({ pkgs, ... }: { 2 name = "bitcoind"; 3 meta = with pkgs.lib; { 4 maintainers = with maintainers; [ _1000101 ]; 5 }; 6 7 nodes.machine = { ... }: { 8 services.bitcoind."mainnet" = { 9 enable = true; 10 rpc = { 11 port = 8332; 12 users.rpc.passwordHMAC = "acc2374e5f9ba9e62a5204d3686616cf$53abdba5e67a9005be6a27ca03a93ce09e58854bc2b871523a0d239a72968033"; 13 users.rpc2.passwordHMAC = "1495e4a3ad108187576c68f7f9b5ddc5$accce0881c74aa01bb8960ff3bdbd39f607fd33178147679e055a4ac35f53225"; 14 }; 15 }; 16 17 environment.etc."test.blank".text = ""; 18 services.bitcoind."testnet" = { 19 enable = true; 20 configFile = "/etc/test.blank"; 21 testnet = true; 22 rpc = { 23 port = 18332; 24 }; 25 extraCmdlineOptions = [ "-rpcuser=rpc" "-rpcpassword=rpc" "-rpcauth=rpc2:1495e4a3ad108187576c68f7f9b5ddc5$accce0881c74aa01bb8960ff3bdbd39f607fd33178147679e055a4ac35f53225" ]; 26 }; 27 }; 28 29 testScript = '' 30 start_all() 31 32 machine.wait_for_unit("bitcoind-mainnet.service") 33 machine.wait_for_unit("bitcoind-testnet.service") 34 35 machine.wait_until_succeeds( 36 'curl --fail --user rpc:rpc --data-binary \'{"jsonrpc": "1.0", "id":"curltest", "method": "getblockchaininfo", "params": [] }\' -H \'content-type: text/plain;\' localhost:8332 | grep \'"chain":"main"\' ' 37 ) 38 machine.wait_until_succeeds( 39 'curl --fail --user rpc2:rpc2 --data-binary \'{"jsonrpc": "1.0", "id":"curltest", "method": "getblockchaininfo", "params": [] }\' -H \'content-type: text/plain;\' localhost:8332 | grep \'"chain":"main"\' ' 40 ) 41 machine.wait_until_succeeds( 42 'curl --fail --user rpc:rpc --data-binary \'{"jsonrpc": "1.0", "id":"curltest", "method": "getblockchaininfo", "params": [] }\' -H \'content-type: text/plain;\' localhost:18332 | grep \'"chain":"test"\' ' 43 ) 44 machine.wait_until_succeeds( 45 'curl --fail --user rpc2:rpc2 --data-binary \'{"jsonrpc": "1.0", "id":"curltest", "method": "getblockchaininfo", "params": [] }\' -H \'content-type: text/plain;\' localhost:18332 | grep \'"chain":"test"\' ' 46 ) 47 ''; 48})