Closes #2446 by adding generated field to listunspent.

If generated is true, the unspent transaction output is from a
coinbase transaction and can only be sent to a shielded address.
This commit is contained in:
Simon
2017-07-11 00:53:55 -07:00
parent 5df11e9d8e
commit d77a0ac4a0
2 changed files with 14 additions and 0 deletions

View File

@@ -72,6 +72,18 @@ class WalletTest (BitcoinTestFramework):
node0utxos = self.nodes[0].listunspent(1)
assert_equal(len(node0utxos), 3)
# Check 'generated' field of listunspent
# Node 0: has one coinbase utxo and two regular utxos
assert_equal(sum(int(uxto["generated"] is True) for uxto in node0utxos), 1)
# Node 1: has 101 coinbase utxos and no regular utxos
node1utxos = self.nodes[1].listunspent(1)
assert_equal(len(node1utxos), 101)
assert_equal(sum(int(uxto["generated"] is True) for uxto in node1utxos), 101)
# Node 2: has no coinbase utxos and two regular utxos
node2utxos = self.nodes[2].listunspent(1)
assert_equal(len(node2utxos), 2)
assert_equal(sum(int(uxto["generated"] is True) for uxto in node2utxos), 0)
# create both transactions
txns_to_send = []
for utxo in node0utxos: