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

Method make_utxos

test/functional/p2p_compactblocks.py:164–184  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

162
163 # Create 10 more anyone-can-spend utxo's for testing.
164 def make_utxos(self):
165 block = self.build_block_on_tip(self.nodes[0])
166 self.segwit_node.send_and_ping(msg_no_witness_block(block))
167 assert int(self.nodes[0].getbestblockhash(), 16) == block.sha256
168 self.generate(self.wallet, COINBASE_MATURITY)
169
170 total_value = block.vtx[0].vout[0].nValue.getAmount()
171 out_value = total_value // 10
172 tx = CTransaction()
173 tx.vin.append(CTxIn(COutPoint(block.vtx[0].sha256, 0), b''))
174 for _ in range(10):
175 tx.vout.append(CTxOut(out_value, CScript([OP_TRUE])))
176 tx.rehash()
177
178 block2 = self.build_block_on_tip(self.nodes[0])
179 block2.vtx.append(tx)
180 block2.hashMerkleRoot = block2.calc_merkle_root()
181 block2.solve()
182 self.segwit_node.send_and_ping(msg_no_witness_block(block2))
183 assert_equal(int(self.nodes[0].getbestblockhash(), 16), block2.sha256)
184 self.utxos.extend([[tx.sha256, i, out_value] for i in range(10)])
185
186
187 # Test "sendcmpct" (between peers preferring the same version):

Callers 1

run_testMethod · 0.95

Calls 14

build_block_on_tipMethod · 0.95
rehashMethod · 0.95
CTransactionClass · 0.90
CTxInClass · 0.90
COutPointClass · 0.90
CTxOutClass · 0.90
CScriptClass · 0.90
assert_equalFunction · 0.90
getAmountMethod · 0.80
send_and_pingMethod · 0.45
generateMethod · 0.45

Tested by

no test coverage detected