at 25.11-pre 2.3 kB view raw
1import ./make-test-python.nix ( 2 { pkgs, ... }: 3 { 4 name = "bitcoind"; 5 meta = with pkgs.lib; { 6 maintainers = with maintainers; [ _1000101 ]; 7 }; 8 9 nodes.machine = 10 { ... }: 11 { 12 services.bitcoind."mainnet" = { 13 enable = true; 14 rpc = { 15 port = 8332; 16 users.rpc.passwordHMAC = "acc2374e5f9ba9e62a5204d3686616cf$53abdba5e67a9005be6a27ca03a93ce09e58854bc2b871523a0d239a72968033"; 17 users.rpc2.passwordHMAC = "1495e4a3ad108187576c68f7f9b5ddc5$accce0881c74aa01bb8960ff3bdbd39f607fd33178147679e055a4ac35f53225"; 18 }; 19 }; 20 21 environment.etc."test.blank".text = ""; 22 services.bitcoind."testnet" = { 23 enable = true; 24 configFile = "/etc/test.blank"; 25 testnet = true; 26 rpc = { 27 port = 18332; 28 }; 29 extraCmdlineOptions = [ 30 "-rpcuser=rpc" 31 "-rpcpassword=rpc" 32 "-rpcauth=rpc2:1495e4a3ad108187576c68f7f9b5ddc5$accce0881c74aa01bb8960ff3bdbd39f607fd33178147679e055a4ac35f53225" 33 ]; 34 }; 35 }; 36 37 testScript = '' 38 start_all() 39 40 machine.wait_for_unit("bitcoind-mainnet.service") 41 machine.wait_for_unit("bitcoind-testnet.service") 42 43 machine.wait_until_succeeds( 44 '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"\' ' 45 ) 46 machine.wait_until_succeeds( 47 '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"\' ' 48 ) 49 machine.wait_until_succeeds( 50 '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"\' ' 51 ) 52 machine.wait_until_succeeds( 53 '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"\' ' 54 ) 55 ''; 56 } 57)