(self)
| 46 | assert_equal(shuffled_testres, self.nodes[0].testmempoolaccept(shuffled_package)) |
| 47 | |
| 48 | def run_test(self): |
| 49 | self.log.info("Generate blocks to create UTXOs") |
| 50 | node = self.nodes[0] |
| 51 | self.privkeys = [node.get_deterministic_priv_key().key] |
| 52 | self.address = node.get_deterministic_priv_key().address |
| 53 | self.coins = [] |
| 54 | # The last 100 coinbase transactions are premature |
| 55 | for b in self.generatetoaddress(node, 200, self.address)[:100]: |
| 56 | coinbase = node.getblock(blockhash=b, verbosity=2)["tx"][0] |
| 57 | self.coins.append({ |
| 58 | "txid": coinbase["txid"], |
| 59 | "amount": coinbase["vout"][0]["value"], |
| 60 | "scriptPubKey": coinbase["vout"][0]["scriptPubKey"], |
| 61 | }) |
| 62 | |
| 63 | # Create some transactions that can be reused throughout the test. Never submit these to mempool. |
| 64 | self.independent_txns_hex = [] |
| 65 | self.independent_txns_testres = [] |
| 66 | for _ in range(3): |
| 67 | coin = self.coins.pop() |
| 68 | rawtx = node.createrawtransaction([{"txid": coin["txid"], "vout": 0}], |
| 69 | [{self.address : coin["amount"] - Decimal("0.0001")}, {"fee" : Decimal("0.0001") }]) |
| 70 | signedtx = node.signrawtransactionwithkey(hexstring=rawtx, privkeys=self.privkeys) |
| 71 | assert signedtx["complete"] |
| 72 | testres = node.testmempoolaccept([signedtx["hex"]]) |
| 73 | assert testres[0]["allowed"] |
| 74 | self.independent_txns_hex.append(signedtx["hex"]) |
| 75 | # testmempoolaccept returns a list of length one, avoid creating a 2D list |
| 76 | self.independent_txns_testres.append(testres[0]) |
| 77 | self.independent_txns_testres_blank = [{ |
| 78 | "txid": res["txid"], "wtxid": res["wtxid"]} for res in self.independent_txns_testres] |
| 79 | |
| 80 | self.test_independent() |
| 81 | self.test_chain() |
| 82 | self.test_multiple_children() |
| 83 | self.test_multiple_parents() |
| 84 | self.test_conflicting() |
| 85 | self.test_rbf() |
| 86 | |
| 87 | def test_independent(self): |
| 88 | self.log.info("Test multiple independent transactions in a package") |
nothing calls this directly
no test coverage detected