aboutsummaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-04-24 14:51:15 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2015-04-24 14:57:43 +0200
commit585b5dba745a25caf1cc20fdb751ff7cb3762bf0 (patch)
treeb075cb9ec48d9a3c201d6092a906faac9dbfe1c5 /qa
parentc2713042a3a816bbb1b2ac5b884bee957ad33b37 (diff)
parentf89b092d756b2c6d98390507c71db372f66c3f59 (diff)
downloadbitcoin-585b5dba745a25caf1cc20fdb751ff7cb3762bf0.tar.xz
Merge pull request #6036
f89b092 add rpc test for listunspents support for zero value txouts (Jonas Schnelli) 219953c Show zero value txouts in listunspent. (Gregory Maxwell)
Diffstat (limited to 'qa')
-rwxr-xr-xqa/rpc-tests/wallet.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/qa/rpc-tests/wallet.py b/qa/rpc-tests/wallet.py
index 5f3178c606..08032fc538 100755
--- a/qa/rpc-tests/wallet.py
+++ b/qa/rpc-tests/wallet.py
@@ -151,6 +151,33 @@ class WalletTest (BitcoinTestFramework):
assert(txid1 in self.nodes[3].getrawmempool())
+ #check if we can list zero value tx as available coins
+ #1. create rawtx
+ #2. hex-changed one output to 0.0
+ #3. sign and send
+ #4. check if recipient (node0) can list the zero value tx
+ usp = self.nodes[1].listunspent()
+ inputs = [{"txid":usp[0]['txid'], "vout":usp[0]['vout']}]
+ outputs = {self.nodes[1].getnewaddress(): 49.998, self.nodes[0].getnewaddress(): 11.11}
+
+ rawTx = self.nodes[1].createrawtransaction(inputs, outputs).replace("c0833842", "00000000") #replace 11.11 with 0.0 (int32)
+ decRawTx = self.nodes[1].decoderawtransaction(rawTx)
+ signedRawTx = self.nodes[1].signrawtransaction(rawTx)
+ decRawTx = self.nodes[1].decoderawtransaction(signedRawTx['hex'])
+ zeroValueTxid= decRawTx['txid']
+ sendResp = self.nodes[1].sendrawtransaction(signedRawTx['hex'])
+
+ self.sync_all()
+ self.nodes[1].generate(1) #mine a block
+ self.sync_all()
+
+ unspentTxs = self.nodes[0].listunspent() #zero value tx must be in listunspents output
+ found = False
+ for uTx in unspentTxs:
+ if uTx['txid'] == zeroValueTxid:
+ found = True
+ assert_equal(uTx['amount'], Decimal('0.00000000'));
+ assert(found)
#do some -walletbroadcast tests
stop_nodes(self.nodes)