List solvability in listunspent output and improve help
This commit is contained in:
parent
48f3905831
commit
c3932b3270
5 changed files with 14 additions and 8 deletions
|
@ -572,7 +572,7 @@ void WalletModel::getOutputs(const std::vector<COutPoint>& vOutpoints, std::vect
|
||||||
if (!wallet->mapWallet.count(outpoint.hash)) continue;
|
if (!wallet->mapWallet.count(outpoint.hash)) continue;
|
||||||
int nDepth = wallet->mapWallet[outpoint.hash].GetDepthInMainChain();
|
int nDepth = wallet->mapWallet[outpoint.hash].GetDepthInMainChain();
|
||||||
if (nDepth < 0) continue;
|
if (nDepth < 0) continue;
|
||||||
COutput out(&wallet->mapWallet[outpoint.hash], outpoint.n, nDepth, true);
|
COutput out(&wallet->mapWallet[outpoint.hash], outpoint.n, nDepth, true, true);
|
||||||
vOutputs.push_back(out);
|
vOutputs.push_back(out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -599,7 +599,7 @@ void WalletModel::listCoins(std::map<QString, std::vector<COutput> >& mapCoins)
|
||||||
if (!wallet->mapWallet.count(outpoint.hash)) continue;
|
if (!wallet->mapWallet.count(outpoint.hash)) continue;
|
||||||
int nDepth = wallet->mapWallet[outpoint.hash].GetDepthInMainChain();
|
int nDepth = wallet->mapWallet[outpoint.hash].GetDepthInMainChain();
|
||||||
if (nDepth < 0) continue;
|
if (nDepth < 0) continue;
|
||||||
COutput out(&wallet->mapWallet[outpoint.hash], outpoint.n, nDepth, true);
|
COutput out(&wallet->mapWallet[outpoint.hash], outpoint.n, nDepth, true, true);
|
||||||
if (outpoint.n < out.tx->vout.size() && wallet->IsMine(out.tx->vout[outpoint.n]) == ISMINE_SPENDABLE)
|
if (outpoint.n < out.tx->vout.size() && wallet->IsMine(out.tx->vout[outpoint.n]) == ISMINE_SPENDABLE)
|
||||||
vCoins.push_back(out);
|
vCoins.push_back(out);
|
||||||
}
|
}
|
||||||
|
@ -611,7 +611,7 @@ void WalletModel::listCoins(std::map<QString, std::vector<COutput> >& mapCoins)
|
||||||
while (wallet->IsChange(cout.tx->vout[cout.i]) && cout.tx->vin.size() > 0 && wallet->IsMine(cout.tx->vin[0]))
|
while (wallet->IsChange(cout.tx->vout[cout.i]) && cout.tx->vin.size() > 0 && wallet->IsMine(cout.tx->vin[0]))
|
||||||
{
|
{
|
||||||
if (!wallet->mapWallet.count(cout.tx->vin[0].prevout.hash)) break;
|
if (!wallet->mapWallet.count(cout.tx->vin[0].prevout.hash)) break;
|
||||||
cout = COutput(&wallet->mapWallet[cout.tx->vin[0].prevout.hash], cout.tx->vin[0].prevout.n, 0, true);
|
cout = COutput(&wallet->mapWallet[cout.tx->vin[0].prevout.hash], cout.tx->vin[0].prevout.n, 0, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
CTxDestination address;
|
CTxDestination address;
|
||||||
|
|
|
@ -2348,7 +2348,9 @@ UniValue listunspent(const UniValue& params, bool fHelp)
|
||||||
" \"account\" : \"account\", (string) DEPRECATED. The associated account, or \"\" for the default account\n"
|
" \"account\" : \"account\", (string) DEPRECATED. The associated account, or \"\" for the default account\n"
|
||||||
" \"scriptPubKey\" : \"key\", (string) the script key\n"
|
" \"scriptPubKey\" : \"key\", (string) the script key\n"
|
||||||
" \"amount\" : x.xxx, (numeric) the transaction amount in " + CURRENCY_UNIT + "\n"
|
" \"amount\" : x.xxx, (numeric) the transaction amount in " + CURRENCY_UNIT + "\n"
|
||||||
" \"confirmations\" : n (numeric) The number of confirmations\n"
|
" \"confirmations\" : n, (numeric) The number of confirmations\n"
|
||||||
|
" \"spendable\" : xxx, (bool) Whether we have the private keys to spend this output\n"
|
||||||
|
" \"solvable\" : xxx (bool) Whether we know how to spend this output, ignoring the lack of keys\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" ,...\n"
|
" ,...\n"
|
||||||
"]\n"
|
"]\n"
|
||||||
|
@ -2425,6 +2427,7 @@ UniValue listunspent(const UniValue& params, bool fHelp)
|
||||||
entry.push_back(Pair("amount",ValueFromAmount(nValue)));
|
entry.push_back(Pair("amount",ValueFromAmount(nValue)));
|
||||||
entry.push_back(Pair("confirmations",out.nDepth));
|
entry.push_back(Pair("confirmations",out.nDepth));
|
||||||
entry.push_back(Pair("spendable", out.fSpendable));
|
entry.push_back(Pair("spendable", out.fSpendable));
|
||||||
|
entry.push_back(Pair("solvable", out.fSolvable));
|
||||||
results.push_back(entry);
|
results.push_back(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2446,6 +2449,7 @@ UniValue fundrawtransaction(const UniValue& params, bool fHelp)
|
||||||
"Note that all existing inputs must have their previous output transaction be in the wallet.\n"
|
"Note that all existing inputs must have their previous output transaction be in the wallet.\n"
|
||||||
"Note that all inputs selected must be of standard form and P2SH scripts must be"
|
"Note that all inputs selected must be of standard form and P2SH scripts must be"
|
||||||
"in the wallet using importaddress or addmultisigaddress (to calculate fees).\n"
|
"in the wallet using importaddress or addmultisigaddress (to calculate fees).\n"
|
||||||
|
"You can see whether this is the case by checking the \"solvable\" field in the listunspent output.\n"
|
||||||
"Only pay-to-pubkey, multisig, and P2SH versions thereof are currently supported for watch-only\n"
|
"Only pay-to-pubkey, multisig, and P2SH versions thereof are currently supported for watch-only\n"
|
||||||
"\nArguments:\n"
|
"\nArguments:\n"
|
||||||
"1. \"hexstring\" (string, required) The hex string of the raw transaction\n"
|
"1. \"hexstring\" (string, required) The hex string of the raw transaction\n"
|
||||||
|
|
|
@ -48,7 +48,7 @@ static void add_coin(const CAmount& nValue, int nAge = 6*24, bool fIsFromMe = fa
|
||||||
wtx->fDebitCached = true;
|
wtx->fDebitCached = true;
|
||||||
wtx->nDebitCached = 1;
|
wtx->nDebitCached = 1;
|
||||||
}
|
}
|
||||||
COutput output(wtx, nInput, nAge, true);
|
COutput output(wtx, nInput, nAge, true, true);
|
||||||
vCoins.push_back(output);
|
vCoins.push_back(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1675,7 +1675,8 @@ void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const
|
||||||
(!coinControl || !coinControl->HasSelected() || coinControl->fAllowOtherInputs || coinControl->IsSelected((*it).first, i)))
|
(!coinControl || !coinControl->HasSelected() || coinControl->fAllowOtherInputs || coinControl->IsSelected((*it).first, i)))
|
||||||
vCoins.push_back(COutput(pcoin, i, nDepth,
|
vCoins.push_back(COutput(pcoin, i, nDepth,
|
||||||
((mine & ISMINE_SPENDABLE) != ISMINE_NO) ||
|
((mine & ISMINE_SPENDABLE) != ISMINE_NO) ||
|
||||||
(coinControl && coinControl->fAllowWatchOnly && (mine & ISMINE_WATCH_SOLVABLE) != ISMINE_NO)));
|
(coinControl && coinControl->fAllowWatchOnly && (mine & ISMINE_WATCH_SOLVABLE) != ISMINE_NO),
|
||||||
|
(mine & (ISMINE_SPENDABLE | ISMINE_WATCH_SOLVABLE)) != ISMINE_NO));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -412,10 +412,11 @@ public:
|
||||||
int i;
|
int i;
|
||||||
int nDepth;
|
int nDepth;
|
||||||
bool fSpendable;
|
bool fSpendable;
|
||||||
|
bool fSolvable;
|
||||||
|
|
||||||
COutput(const CWalletTx *txIn, int iIn, int nDepthIn, bool fSpendableIn)
|
COutput(const CWalletTx *txIn, int iIn, int nDepthIn, bool fSpendableIn, bool fSolvableIn)
|
||||||
{
|
{
|
||||||
tx = txIn; i = iIn; nDepth = nDepthIn; fSpendable = fSpendableIn;
|
tx = txIn; i = iIn; nDepth = nDepthIn; fSpendable = fSpendableIn; fSolvable = fSolvableIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ToString() const;
|
std::string ToString() const;
|
||||||
|
|
Loading…
Reference in a new issue