Exemplo n.º 1
0
 def test_from_user_input_scans_if_requested(self, mock_register,
                                             mock_ping):
     btc.new_from_user_input({
         "version": "1",
         "name": "nokey",
         "testnet": True,
         "private_key": "d5a5rEM/qyqD0oHoBk8pyTUTMTm2LsUsjnPeKEQMDcY=",
         "utxo_scan": True
     })
     mock_register.assert_called_once_with(True)
Exemplo n.º 2
0
def create_bitcoin_interchain_v1(user_data: Dict[str, Any], conflict_check: bool = True) -> Dict[str, Any]:
    client = btc.new_from_user_input(user_data)
    if conflict_check and interchain_dao.does_interchain_exist("bitcoin", client.name):
        _log.error("Bitcoin network is already registered")
        raise exceptions.InterchainConflict(f"A bitcoin interchain network with the name {client.name} is already registered")
    interchain_dao.save_interchain_client(client)
    return _get_output_dto_v1(client)
Exemplo n.º 3
0
 def test_from_user_input_uses_provided_node_and_auth(
         self, mock_register, mock_ping):
     client = btc.new_from_user_input({
         "version": "1",
         "name": "nokey",
         "testnet": True,
         "rpc_address": "thing",
         "rpc_authorization": "yup"
     })
     self.assertEqual(client.rpc_address, "thing")
     self.assertEqual(client.authorization, "yup")
Exemplo n.º 4
0
 def test_from_user_input_works_with_no_provided_key(
         self, mock_register, mock_ping):
     client = btc.new_from_user_input({
         "version": "1",
         "name": "nokey",
         "testnet": True
     })
     mock_ping.assert_called_once()
     mock_register.assert_called_once_with(False)
     self.assertEqual(client.name, "nokey")
     self.assertEqual(
         client.rpc_address,
         "http://internal-Btc-Testnet-Internal-1334656512.us-west-2.elb.amazonaws.com:18332"
     )
     self.assertEqual(client.authorization, "Yml0Y29pbnJwYzpkcmFnb24=")
     self.assertTrue(bool(client.priv_key.to_bytes()))
     self.assertTrue(client.testnet)
Exemplo n.º 5
0
 def test_from_user_input_wif_defaults(self, mock_register, mock_ping):
     client = btc.new_from_user_input({
         "version":
         "1",
         "name":
         "banana",
         "private_key":
         "L1EB9j5D3PN3dZFoKKczBy9ieav5cx2dAWASBHmhS9Yn7Go5U4dh"
     })
     mock_ping.assert_called_once()
     mock_register.assert_called_once_with(False)
     self.assertEqual(client.name, "banana")
     self.assertEqual(
         client.rpc_address,
         "http://internal-Btc-Mainnet-Internal-297595751.us-west-2.elb.amazonaws.com:8332"
     )
     self.assertEqual(client.authorization, "Yml0Y29pbnJwYzpkcmFnb24=")
     self.assertEqual(
         client.priv_key.to_bytes(),
         b"w\x96\xb9\xacC?\xab*\x83\xd2\x81\xe8\x06O)\xc95\x1319\xb6.\xc5,\x8es\xde(D\x0c\r\xc6"
     )
     self.assertFalse(client.testnet)
Exemplo n.º 6
0
def create_bitcoin_interchain_v1(user_data: Dict[str, Any]) -> Dict[str, Any]:
    client = btc.new_from_user_input(user_data)
    interchain_dao.save_interchain_client(client)
    return _get_output_dto_v1(client)