19 self.
nodes.append(
start_node(0, self.options.tmpdir, [
"-maxorphantx=1000",
"-relaypriority=0",
"-debug"]))
20 self.
nodes.append(
start_node(1, self.options.tmpdir, [
"-maxorphantx=1000",
"-relaypriority=0",
"-limitancestorcount=5",
"-debug"]))
29 inputs = [ {
'txid' : parent_txid,
'vout' : vout} ]
31 for i
in xrange(num_outputs):
32 outputs[node.getnewaddress()] = send_value
33 rawtx = node.createrawtransaction(inputs, outputs)
34 signedtx = node.signrawtransaction(rawtx)
35 txid = node.sendrawtransaction(signedtx[
'hex'])
36 fulltx = node.getrawtransaction(txid, 1)
37 assert(len(fulltx[
'vout']) == num_outputs)
38 return (txid, send_value)
41 ''' Mine some blocks and have them mature. ''' 44 txid = utxo[0][
'txid']
45 vout = utxo[0][
'vout']
46 value = utxo[0][
'amount']
48 fee = Decimal(
"0.0001")
51 for i
in xrange(MAX_ANCESTORS):
64 for x
in reversed(chain):
65 assert_equal(mempool[x][
'descendantcount'], descendant_count)
66 descendant_fees += mempool[x][
'fee']
67 assert_equal(mempool[x][
'modifiedfee'], mempool[x][
'fee'])
68 assert_equal(mempool[x][
'descendantfees'], descendant_fees * COIN)
69 descendant_size += mempool[x][
'size']
70 assert_equal(mempool[x][
'descendantsize'], descendant_size)
79 for x
in reversed(chain):
80 descendant_fees += mempool[x][
'fee']
81 assert_equal(mempool[x][
'descendantfees'], descendant_fees * COIN + 1000)
86 except JSONRPCException
as e:
87 print "too-long-ancestor-chain successfully rejected" 105 for x
in reversed(chain):
106 descendant_fees += mempool[x][
'fee']
109 assert_equal(mempool[x][
'descendantfees'], descendant_fees * COIN + 2000)
116 txid = utxo[1][
'txid']
117 value = utxo[1][
'amount']
118 vout = utxo[1][
'vout']
120 transaction_package = []
123 parent_transaction = txid
125 transaction_package.append({
'txid': txid,
'vout': i,
'amount': sent_value})
127 for i
in xrange(MAX_DESCENDANTS):
128 utxo = transaction_package.pop(0)
130 (txid, sent_value) = self.
chain_transaction(self.
nodes[0], utxo[
'txid'], utxo[
'vout'], utxo[
'amount'], fee, 10)
132 transaction_package.append({
'txid': txid,
'vout': j,
'amount': sent_value})
133 if i == MAX_DESCENDANTS - 2:
135 assert_equal(mempool[parent_transaction][
'descendantcount'], MAX_DESCENDANTS)
136 except JSONRPCException
as e:
137 print e.error[
'message']
139 print "tx that would create too large descendant package successfully rejected" 167 txid = utxo[0][
'txid']
168 value = utxo[0][
'amount']
169 vout = utxo[0][
'vout']
172 inputs = [ {
'txid' : txid,
'vout' : vout} ]
198 inputs = [ {
'txid' : tx1_id,
'vout': 0}, {
'txid' : txid,
'vout': 0} ]
210 if __name__ ==
'__main__':
UniValue prioritisetransaction(const UniValue ¶ms, bool fHelp)
UniValue reconsiderblock(const UniValue ¶ms, bool fHelp)
UniValue listunspent(const UniValue ¶ms, bool fHelp)
def connect_nodes(from_connection, node_num)
UniValue getnewaddress(const UniValue ¶ms, bool fHelp)
def sync_mempools(rpc_connections, wait=1)
UniValue signrawtransaction(const UniValue ¶ms, bool fHelp)
UniValue createrawtransaction(const UniValue ¶ms, bool fHelp)
def satoshi_round(amount)
def start_node(i, dirname, extra_args=None, rpchost=None, timewait=None, binary=None)
UniValue generate(const UniValue ¶ms, bool fHelp)
UniValue sendrawtransaction(const UniValue ¶ms, bool fHelp)
def sync_blocks(rpc_connections, wait=1)
UniValue getrawmempool(const UniValue ¶ms, bool fHelp)
UniValue getbestblockhash(const UniValue ¶ms, bool fHelp)
def chain_transaction(self, node, parent_txid, vout, value, fee, num_outputs)
def assert_equal(thing1, thing2)