Beispiel #1
0
    def test_broadcast_duplicate_tx_spent_signet(self):
        tx_hex = "020000000001017bf99a29dd2f9968ca9a075e85b43a638b600bcc49fd9ba0ac8eaf2fa8d851330000000000feffffff02a0860100000000001600149253a4d3d120add0ddd578a5cca6139891503cb917ef7d9c4f060000160014f59bb0a324f3f6026574c1186b4f7e82de9ed77e0247304402201d7531c7aff722a10f4c97ea52bd10ae48dda497d514d0c8d491e80c9981daa0022036b67fb050b0e503ebba71578e2f5c35118b4f0cfa65f0ded1605c896e3c09ce012102eb882bb156e79619d5cd9089be277b39980830030e2ee2c5a07deed3fa1aba7ff9940100"

        with self.assertRaises(HTTPError) as fail:
            TxFetcher.sendrawtransaction(tx_hex, network="signet")

        self.assertEqual(400, fail.exception.code)
        self.assertIn("missingorspent", fail.exception.read().decode())
Beispiel #2
0
    def test_broadcast_duplicate_tx_spent_testnet(self):
        tx_hex = "020000000001018b526b2fecec943908bbc2e61edbbe8182af32cdfaac3f3f97a07550c0221bc800000000171600145d2f5871d3b1c9a72e86071645fbff06634cdc00feffffff028c12d10300000000160014b2f894963b3bdb3dcf46e0eb06817aa0fd65cda050c30000000000001600143d9e1c6c27c4dd45816cedb9334672da6eea27a102473044022000f991d8a8556efa902a482c836557bde98fece79ed428b248d23480315e24780220461d4fc104d1af74967ba6a2ecd994746b243bf2c74b55ee25e6d170e778caa3012102fdd06a74d4791846e0f86239c7dbbf208afc7eb6108620b8ee842ebab1b1c6f2c4b72300"

        with self.assertRaises(HTTPError) as fail:
            TxFetcher.sendrawtransaction(tx_hex, network="testnet")

        self.assertEqual(400, fail.exception.code)
        self.assertIn("missingorspent", fail.exception.read().decode())
Beispiel #3
0
    def test_socket_guard(self):
        if getenv("INCLUDE_NETWORK_TESTS"):
            return

        with self.assertRaises(Exception) as cm:
            TxFetcher.fetch(tx_id="0" * 32)

        self.assertIn("Unit test requires internet", str(cm.exception))
Beispiel #4
0
 def test_verify_p2pkh(self):
     tx = TxFetcher.fetch(
         "452c629d67e41baec3ac6f04fe744b4b9617f8f859c63b3002f8684e7a4fee03"
     )
     self.assertTrue(tx.verify())
     tx = TxFetcher.fetch(
         "5418099cc755cb9dd3ebc6cf1a7888ad53a1a3beb5a025bce89eb1bf7f1650a2",
         network="testnet",
     )
     self.assertTrue(tx.verify())
Beispiel #5
0
 def test_verify_p2sh_p2wpkh(self):
     tx = TxFetcher.fetch(
         "c586389e5e4b3acb9d6c8be1c19ae8ab2795397633176f5a6442a261bbdefc3a"
     )
     self.assertTrue(tx.verify())
Beispiel #6
0
 def test_verify_p2wpkh(self):
     tx = TxFetcher.fetch(
         "d869f854e1f8788bcff294cc83b280942a8c728de71eb709a2c29d10bfe21b7c",
         network="testnet",
     )
     self.assertTrue(tx.verify())
Beispiel #7
0
 def test_verify_lightning_receiver_preimage(self):
     tx = TxFetcher.fetch(
         "36b1aff2ad0076be95b1ee1dc4036374998760c80c6583a6478a699e86658ac0"
     )
     self.assertTrue(tx.verify())
Beispiel #8
0
 def test_verify_sha1_pinata(self):
     tx = TxFetcher.fetch(
         "8d31992805518fd62daa3bdd2a5c4fd2cd3054c9b3dca1d78055e9528cff6adc"
     )
     self.assertTrue(tx.verify())
Beispiel #9
0
 def test_verify_lightning_sender_preimage(self):
     tx = TxFetcher.fetch(
         "89c744f0806a57a9b4634c320703cc941aaf272f290296373b709499064335e5"
     )
     self.assertTrue(tx.verify())
Beispiel #10
0
 def test_verify_lightning_receiver_timeout(self):
     tx = TxFetcher.fetch(
         "f9af9b93d66c7e5ee7dcbe0b53faa3d17aa6b9f4cc5b19f0985917b57d82c59a"
     )
     self.assertTrue(tx.verify())
Beispiel #11
0
 def test_verify_lightning_local_penalty(self):
     tx = TxFetcher.fetch(
         "0da5e5dba5e793d50820c2275dab74912b121c8b7e34ce32a9dbfd4567a9bf8e"
     )
     self.assertTrue(tx.verify())
Beispiel #12
0
 def test_verify_p2sh_p2wsh(self):
     tx = TxFetcher.fetch(
         "954f43dbb30ad8024981c07d1f5eb6c9fd461e2cf1760dd1283f052af746fc88",
         network="testnet",
     )
     self.assertTrue(tx.verify())
Beispiel #13
0
 def test_verify_csv_2(self):
     tx = TxFetcher.fetch(
         "807d464fff227ce98cfb5f1292069e2793e99f21b0539a1729cc460af32add77",
         network="testnet",
     )
     self.assertTrue(tx.verify())
Beispiel #14
0
 def test_verify_p2sh(self):
     tx = TxFetcher.fetch(
         "46df1a9484d0a81d03ce0ee543ab6e1a23ed06175c104a178268fad381216c2b"
     )
     self.assertTrue(tx.verify())
Beispiel #15
0
 def test_verify_csv(self):
     tx = TxFetcher.fetch(
         "d208b659eaca2640f732b07b11ea9800c1a0bb4ffdc03aaf82af76c1787570ac",
         network="testnet",
     )
     self.assertTrue(tx.verify())
Beispiel #16
0
 def test_verify_cltv(self):
     tx = TxFetcher.fetch(
         "ca2c7347aa2fdff68052f026fa9a092448c2451f774ca53f3a2b05d74405addc",
         network="testnet",
     )
     self.assertTrue(tx.verify())
Beispiel #17
0
 def test_verify_if(self):
     tx = TxFetcher.fetch(
         "61ba3a8b40706931b72929628cf1a07d604f158c8350055725c664d544d00030",
         network="testnet",
     )
     self.assertTrue(tx.verify())
Beispiel #18
0
 def setUpClass(cls):
     # fill with cache so we don't have to be online to run these tests
     TxFetcher.load_cache(cls.cache_file)
Beispiel #19
0
 def test_verify_lightning_sender_timeout(self):
     tx = TxFetcher.fetch(
         "a16f6d78a58d31fe7459887adf5bd6b4dd95277ea375d250c700cde9fa908bdb"
     )
     self.assertTrue(tx.verify())
Beispiel #20
0
 def test_verify_lightning_local_success(self):
     tx = TxFetcher.fetch(
         "0191535bfda21f5dfec1c904775c5e2fbee8a985815c88d77258a0b42dba3526"
     )
     self.assertTrue(tx.verify())
Beispiel #21
0
 def test_verify_p2wsh(self):
     tx = TxFetcher.fetch(
         "78457666f82c28aa37b74b506745a7c7684dc7842a52a457b09f09446721e11c",
         network="testnet",
     )
     self.assertTrue(tx.verify())