| 
									
										
										
										
											2020-07-21 13:43:32 +02:00
										 |  |  | import ./make-test-python.nix ({ pkgs, ... }: { | 
					
						
							|  |  |  |   name = "bitcoind"; | 
					
						
							| 
									
										
										
										
											2021-01-10 20:08:30 +01:00
										 |  |  |   meta = with pkgs.lib; { | 
					
						
							| 
									
										
										
										
											2020-07-29 20:57:20 +10:00
										 |  |  |     maintainers = with maintainers; [ _1000101 ]; | 
					
						
							| 
									
										
										
										
											2020-07-21 13:43:32 +02:00
										 |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   machine = { ... }: { | 
					
						
							|  |  |  |     services.bitcoind."mainnet" = { | 
					
						
							|  |  |  |       enable = true; | 
					
						
							|  |  |  |       rpc = { | 
					
						
							|  |  |  |         port = 8332; | 
					
						
							|  |  |  |         users.rpc.passwordHMAC = "acc2374e5f9ba9e62a5204d3686616cf$53abdba5e67a9005be6a27ca03a93ce09e58854bc2b871523a0d239a72968033"; | 
					
						
							|  |  |  |         users.rpc2.passwordHMAC = "1495e4a3ad108187576c68f7f9b5ddc5$accce0881c74aa01bb8960ff3bdbd39f607fd33178147679e055a4ac35f53225"; | 
					
						
							|  |  |  |       }; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     services.bitcoind."testnet" = { | 
					
						
							|  |  |  |       enable = true; | 
					
						
							|  |  |  |       configFile = "/test.blank"; | 
					
						
							|  |  |  |       testnet = true; | 
					
						
							|  |  |  |       rpc = { | 
					
						
							|  |  |  |         port = 18332; | 
					
						
							|  |  |  |       }; | 
					
						
							|  |  |  |       extraCmdlineOptions = [ "-rpcuser=rpc" "-rpcpassword=rpc" "-rpcauth=rpc2:1495e4a3ad108187576c68f7f9b5ddc5$accce0881c74aa01bb8960ff3bdbd39f607fd33178147679e055a4ac35f53225" ]; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   testScript = ''
 | 
					
						
							|  |  |  |     start_all() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     machine.wait_for_unit("bitcoind-mainnet.service") | 
					
						
							|  |  |  |     machine.wait_for_unit("bitcoind-testnet.service") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     machine.wait_until_succeeds( | 
					
						
							| 
									
										
										
										
											2020-09-16 09:58:09 -07:00
										 |  |  |         '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"\' ' | 
					
						
							| 
									
										
										
										
											2020-07-21 13:43:32 +02:00
										 |  |  |     ) | 
					
						
							|  |  |  |     machine.wait_until_succeeds( | 
					
						
							| 
									
										
										
										
											2020-09-16 09:58:09 -07:00
										 |  |  |         '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"\' ' | 
					
						
							| 
									
										
										
										
											2020-07-21 13:43:32 +02:00
										 |  |  |     ) | 
					
						
							|  |  |  |     machine.wait_until_succeeds( | 
					
						
							| 
									
										
										
										
											2020-09-16 09:58:09 -07:00
										 |  |  |         '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"\' ' | 
					
						
							| 
									
										
										
										
											2020-07-21 13:43:32 +02:00
										 |  |  |     ) | 
					
						
							|  |  |  |     machine.wait_until_succeeds( | 
					
						
							| 
									
										
										
										
											2020-09-16 09:58:09 -07:00
										 |  |  |         '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"\' ' | 
					
						
							| 
									
										
										
										
											2020-07-21 13:43:32 +02:00
										 |  |  |     ) | 
					
						
							|  |  |  |   '';
 | 
					
						
							|  |  |  | }) |