MCPcopy Create free account
hub / github.com/ElementsProject/elements / branch

Method branch

test/functional/feature_rbf.py:204–236  ·  view source on GitHub ↗
(prevout, initial_value, max_txs, tree_width=5, fee=0.00001 * COIN, _total_txs=None)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 10

serializeMethod · 0.95
CTxOutClass · 0.90
CScriptClass · 0.90
CTransactionClass · 0.90
CTxInClass · 0.90
COutPointClass · 0.90
hexMethod · 0.80
sendrawtransactionMethod · 0.80
is_feeMethod · 0.80
enumerateFunction · 0.50

Tested by

no test coverage detected