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

@@ -2334,6 +2334,7 @@ UniValue listunspent(const UniValue& params, bool fHelp)
" {\n"
" \"txid\" : \"txid\", (string) the transaction id \n"
" \"vout\" : n, (numeric) the vout value\n"
" \"generated\" : true|false (boolean) true if txout is a coinbase transaction output\n"
" \"address\" : \"address\", (string) the zcash address\n"
" \"account\" : \"account\", (string) DEPRECATED. The associated account, or \"\" for the default account\n"
" \"scriptPubKey\" : \"key\", (string) the script key\n"
@@ -2396,6 +2397,7 @@ UniValue listunspent(const UniValue& params, bool fHelp)
UniValue entry(UniValue::VOBJ);
entry.push_back(Pair("txid", out.tx->GetHash().GetHex()));
entry.push_back(Pair("vout", out.i));
entry.push_back(Pair("generated", out.tx->IsCoinBase()));
CTxDestination address;
if (ExtractDestination(out.tx->vout[out.i].scriptPubKey, address)) {
entry.push_back(Pair("address", CBitcoinAddress(address).ToString()));