@@ -70,16 +70,22 @@ def run_test (self):
7070 #assert_equal(self.nodes[0].getbalance(), 21000000-1100000)
7171 #assert_equal(self.nodes[1].getbalance(), 1000000)
7272 #assert_equal(self.nodes[2].getbalance(), 100000)
73-
7473
7574 # Send 21 BTC from 0 to 2 using sendtoaddress call.
76- self .nodes [0 ].sendtoaddress (self .nodes [2 ].getnewaddress (), 11 )
77- self .nodes [0 ].sendtoaddress (self .nodes [2 ].getnewaddress (), 10 )
75+ txid1 = self .nodes [0 ].sendtoaddress (self .nodes [2 ].getnewaddress (), 11 )
76+ txout1v0 = self .nodes [0 ].gettxout (txid1 , 0 )
77+ assert_equal (txout1v0 ['confirmations' ], 0 )
78+ assert (not txout1v0 ['coinbase' ])
79+
80+ txid2 = self .nodes [0 ].sendtoaddress (self .nodes [2 ].getnewaddress (), 10 )
81+ txout2v0 = self .nodes [0 ].gettxout (txid2 , 0 )
82+ assert_equal (txout2v0 ['confirmations' ], 0 )
83+ assert (not txout2v0 ['coinbase' ])
7884
7985 walletinfo = self .nodes [0 ].getwalletinfo ("bitcoin" )
8086 assert_equal (walletinfo ['immature_balance' ], 0 )
8187
82- # Have node0 mine a block, thus it will collect its own fee.
88+ # Have node0 mine a block, thus it will collect its own fee. Confirm previous transactions.
8389 self .nodes [0 ].generate (1 )
8490 self .sync_all ()
8591
@@ -110,25 +116,28 @@ def run_test (self):
110116 # create both transactions
111117 txns_to_send = []
112118 for utxo in node0utxos :
113- if utxo ["amount" ] <= 3 :
119+ if utxo ["amount" ] <= 3 : # arbitrary value of 3?
114120 continue
115121 inputs = []
116122 outputs = {}
117123 inputs .append ({ "txid" : utxo ["txid" ], "vout" : utxo ["vout" ], "nValue" :utxo ["amount" ]})
118- outputs [self .nodes [2 ].getnewaddress ("from1" )] = utxo ["amount" ] - Decimal ( 3 )
124+ outputs [self .nodes [2 ].getnewaddress ("from1" )] = utxo ["amount" ]
119125 raw_tx = self .nodes [0 ].createrawtransaction (inputs , outputs )
120126 raw_tx = self .nodes [0 ].blindrawtransaction (raw_tx )
121127 txns_to_send .append (self .nodes [0 ].signrawtransaction (raw_tx ))
122128
123- return #TODO Fix the rest
124- # Have node 1 (miner) send the transactions
125- self .nodes [1 ].sendrawtransaction (txns_to_send [0 ]["hex" ], True )
126- self .nodes [1 ].sendrawtransaction (txns_to_send [1 ]["hex" ], True )
129+ # Have node 1 (miner) send the transaction
130+ txid = self .nodes [1 ].sendrawtransaction (txns_to_send [0 ]["hex" ], True )
127131
128- # Have node1 mine a block to confirm transactions :
132+ # Have node1 mine a block to confirm transaction :
129133 self .nodes [1 ].generate (1 )
130134 self .sync_all ()
131135
136+ txoutv0 = self .nodes [0 ].gettxout (txid , 0 )
137+ assert_equal (txoutv0 ['confirmations' ], 1 )
138+ assert (not txoutv0 ['coinbase' ])
139+ return #TODO fix the rest
140+
132141 assert_equal (self .nodes [0 ].getbalance (), 0 )
133142 assert_equal (self .nodes [2 ].getbalance (), 94 )
134143 assert_equal (self .nodes [2 ].getbalance ("from1" ), 94 - 21 )
0 commit comments