(prevout, initial_value, max_txs, tree_width=5, fee=0.00001 * COIN, _total_txs=None)
| 202 | tx0_outpoint = self.make_utxo(self.nodes[0], initial_nValue) |
| 203 | |
| 204 | def branch(prevout, initial_value, max_txs, tree_width=5, fee=0.00001 * COIN, _total_txs=None): |
| 205 | if _total_txs is None: |
| 206 | _total_txs = [0] |
| 207 | if _total_txs[0] >= max_txs: |
| 208 | return |
| 209 | |
| 210 | txout_value = (initial_value - fee) // tree_width |
| 211 | if txout_value < fee: |
| 212 | return |
| 213 | |
| 214 | vout = [CTxOut(txout_value, CScript([i+1])) |
| 215 | for i in range(tree_width)] |
| 216 | vout.append(CTxOut(int(initial_value - tree_width*txout_value))) |
| 217 | tx = CTransaction() |
| 218 | tx.vin = [CTxIn(prevout, nSequence=0)] |
| 219 | tx.vout = vout |
| 220 | tx_hex = tx.serialize().hex() |
| 221 | |
| 222 | assert len(tx.serialize()) < 100000 |
| 223 | txid = self.nodes[0].sendrawtransaction(tx_hex, 0) |
| 224 | yield tx |
| 225 | _total_txs[0] += 1 |
| 226 | |
| 227 | txid = int(txid, 16) |
| 228 | |
| 229 | for i, txout in enumerate(tx.vout): |
| 230 | if txout.is_fee(): |
| 231 | continue |
| 232 | for x in branch(COutPoint(txid, i), txout_value, |
| 233 | max_txs, |
| 234 | tree_width=tree_width, fee=fee, |
| 235 | _total_txs=_total_txs): |
| 236 | yield x |
| 237 | |
| 238 | fee = int(0.00001 * COIN) |
| 239 | n = MAX_REPLACEMENT_LIMIT |
nothing calls this directly
no test coverage detected