Changeset View
Changeset View
Standalone View
Standalone View
test/functional/mempool_packages.py
Show All 33 Lines | def chain_transaction(self, node, parent_txid, vout, value, fee, num_outputs): | ||||
outputs = {} | outputs = {} | ||||
for i in range(num_outputs): | for i in range(num_outputs): | ||||
outputs[node.getnewaddress()] = send_value | outputs[node.getnewaddress()] = send_value | ||||
rawtx = node.createrawtransaction(inputs, outputs) | rawtx = node.createrawtransaction(inputs, outputs) | ||||
signedtx = node.signrawtransactionwithwallet(rawtx) | signedtx = node.signrawtransactionwithwallet(rawtx) | ||||
txid = node.sendrawtransaction(signedtx['hex']) | txid = node.sendrawtransaction(signedtx['hex']) | ||||
fulltx = node.getrawtransaction(txid, 1) | fulltx = node.getrawtransaction(txid, 1) | ||||
# make sure we didn't generate a change output | # make sure we didn't generate a change output | ||||
assert(len(fulltx['vout']) == num_outputs) | assert len(fulltx['vout']) == num_outputs | ||||
return (txid, send_value) | return (txid, send_value) | ||||
def run_test(self): | def run_test(self): | ||||
''' Mine some blocks and have them mature. ''' | ''' Mine some blocks and have them mature. ''' | ||||
self.nodes[0].generate(101) | self.nodes[0].generate(101) | ||||
utxo = self.nodes[0].listunspent(10) | utxo = self.nodes[0].listunspent(10) | ||||
txid = utxo[0]['txid'] | txid = utxo[0]['txid'] | ||||
vout = utxo[0]['vout'] | vout = utxo[0]['vout'] | ||||
▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
else: | else: | ||||
assert_equal(ainfo['depends'], []) | assert_equal(ainfo['depends'], []) | ||||
# Check that getmempoolancestors/getmempooldescendants correctly handle verbose=true | # Check that getmempoolancestors/getmempooldescendants correctly handle verbose=true | ||||
v_ancestors = self.nodes[0].getmempoolancestors(chain[-1], True) | v_ancestors = self.nodes[0].getmempoolancestors(chain[-1], True) | ||||
assert_equal(len(v_ancestors), len(chain) - 1) | assert_equal(len(v_ancestors), len(chain) - 1) | ||||
for x in v_ancestors.keys(): | for x in v_ancestors.keys(): | ||||
assert_equal(mempool[x], v_ancestors[x]) | assert_equal(mempool[x], v_ancestors[x]) | ||||
assert(chain[-1] not in v_ancestors.keys()) | assert chain[-1] not in v_ancestors.keys() | ||||
v_descendants = self.nodes[0].getmempooldescendants(chain[0], True) | v_descendants = self.nodes[0].getmempooldescendants(chain[0], True) | ||||
assert_equal(len(v_descendants), len(chain) - 1) | assert_equal(len(v_descendants), len(chain) - 1) | ||||
for x in v_descendants.keys(): | for x in v_descendants.keys(): | ||||
assert_equal(mempool[x], v_descendants[x]) | assert_equal(mempool[x], v_descendants[x]) | ||||
assert(chain[0] not in v_descendants.keys()) | assert chain[0] not in v_descendants.keys() | ||||
# Check that ancestor modified fees includes fee deltas from | # Check that ancestor modified fees includes fee deltas from | ||||
# prioritisetransaction | # prioritisetransaction | ||||
self.nodes[0].prioritisetransaction(chain[0], 0, 1000) | self.nodes[0].prioritisetransaction(chain[0], 0, 1000) | ||||
mempool = self.nodes[0].getrawmempool(True) | mempool = self.nodes[0].getrawmempool(True) | ||||
ancestor_fees = 0 | ancestor_fees = 0 | ||||
for x in chain: | for x in chain: | ||||
ancestor_fees += mempool[x]['fee'] | ancestor_fees += mempool[x]['fee'] | ||||
▲ Show 20 Lines • Show All 171 Lines • Show Last 20 Lines |