16 parser.add_option(
"--mineblock", dest=
"mine_block", default=
False, action=
"store_true",
17 help=
"Test double-spend of 1-confirmed transaction")
25 starting_balance = 12500
32 fund_foo_txid = self.
nodes[0].
sendfrom(
"", node0_address_foo, 12190)
36 fund_bar_txid = self.
nodes[0].
sendfrom(
"", node0_address_bar, 290)
40 starting_balance - 12190 - 290 + fund_foo_tx[
"fee"] + fund_bar_tx[
"fee"])
47 doublespend_fee = Decimal(
'-.02')
49 rawtx_input_0[
"txid"] = fund_foo_txid
52 rawtx_input_1[
"txid"] = fund_bar_txid
54 inputs = [rawtx_input_0, rawtx_input_1]
57 outputs[node1_address] = 12400
58 outputs[change_address] = 12480 - 12400 + doublespend_fee
68 if (self.options.mine_block):
77 expected = starting_balance + fund_foo_tx[
"fee"] + fund_bar_tx[
"fee"]
78 if self.options.mine_block: expected += 500
79 expected += tx1[
"amount"] + tx1[
"fee"]
80 expected += tx2[
"amount"] + tx2[
"fee"]
87 if self.options.mine_block:
120 expected = starting_balance + 1000 - 12400 + fund_foo_tx[
"fee"] + fund_bar_tx[
"fee"] + doublespend_fee
140 if __name__ ==
'__main__':
UniValue getbalance(const UniValue ¶ms, bool fHelp)
UniValue sendfrom(const UniValue ¶ms, bool fHelp)
def connect_nodes(from_connection, node_num)
UniValue getnewaddress(const UniValue ¶ms, bool fHelp)
def find_output(node, txid, amount)
UniValue signrawtransaction(const UniValue ¶ms, bool fHelp)
UniValue createrawtransaction(const UniValue ¶ms, bool fHelp)
def add_options(self, parser)
UniValue generate(const UniValue ¶ms, bool fHelp)
UniValue sendrawtransaction(const UniValue ¶ms, bool fHelp)
def sync_blocks(rpc_connections, wait=1)
def assert_equal(thing1, thing2)
UniValue gettransaction(const UniValue ¶ms, bool fHelp)