File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,33 @@ def run_test (self):
151
151
152
152
assert (txid1 in self .nodes [3 ].getrawmempool ())
153
153
154
+ #check if we can list zero value tx as available coins
155
+ #1. create rawtx
156
+ #2. hex-changed one output to 0.0
157
+ #3. sign and send
158
+ #4. check if recipient (node0) can list the zero value tx
159
+ usp = self .nodes [1 ].listunspent ()
160
+ inputs = [{"txid" :usp [0 ]['txid' ], "vout" :usp [0 ]['vout' ]}]
161
+ outputs = {self .nodes [1 ].getnewaddress (): 49.998 , self .nodes [0 ].getnewaddress (): 11.11 }
162
+
163
+ rawTx = self .nodes [1 ].createrawtransaction (inputs , outputs ).replace ("c0833842" , "00000000" ) #replace 11.11 with 0.0 (int32)
164
+ decRawTx = self .nodes [1 ].decoderawtransaction (rawTx )
165
+ signedRawTx = self .nodes [1 ].signrawtransaction (rawTx )
166
+ decRawTx = self .nodes [1 ].decoderawtransaction (signedRawTx ['hex' ])
167
+ zeroValueTxid = decRawTx ['txid' ]
168
+ sendResp = self .nodes [1 ].sendrawtransaction (signedRawTx ['hex' ])
169
+
170
+ self .sync_all ()
171
+ self .nodes [1 ].generate (1 ) #mine a block
172
+ self .sync_all ()
173
+
174
+ unspentTxs = self .nodes [0 ].listunspent () #zero value tx must be in listunspents output
175
+ found = False
176
+ for uTx in unspentTxs :
177
+ if uTx ['txid' ] == zeroValueTxid :
178
+ found = True
179
+ assert_equal (uTx ['amount' ], Decimal ('0.00000000' ));
180
+ assert (found )
154
181
155
182
#do some -walletbroadcast tests
156
183
stop_nodes (self .nodes )
You can’t perform that action at this time.
0 commit comments