diff options
| author | Matt Corallo <[email protected]> | 2015-04-23 21:42:49 -0700 |
|---|---|---|
| committer | Matt Corallo <[email protected]> | 2015-07-20 16:01:38 -0700 |
| commit | 6bdb474dc9dd34e1a5b13ce9494a936cba77e027 (patch) | |
| tree | 9f48399117d4b22be76ac33b046437da77045615 /src/wallet/wallet.cpp | |
| parent | Add logic to track pubkeys as watch-only, not just scripts (diff) | |
| download | discoin-6bdb474dc9dd34e1a5b13ce9494a936cba77e027.tar.xz discoin-6bdb474dc9dd34e1a5b13ce9494a936cba77e027.zip | |
Implement watchonly support in fundrawtransaction
Some code and test cases stolen from
Bryan Bishop <[email protected]> (pull #5524).
Diffstat (limited to 'src/wallet/wallet.cpp')
| -rw-r--r-- | src/wallet/wallet.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index c11800863..5bc34f9ed 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1524,7 +1524,9 @@ void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const if (!(IsSpent(wtxid, i)) && mine != ISMINE_NO && !IsLockedCoin((*it).first, i) && (pcoin->vout[i].nValue > 0 || fIncludeZeroValue) && (!coinControl || !coinControl->HasSelected() || coinControl->fAllowOtherInputs || coinControl->IsSelected((*it).first, i))) - vCoins.push_back(COutput(pcoin, i, nDepth, (mine & ISMINE_SPENDABLE) != ISMINE_NO)); + vCoins.push_back(COutput(pcoin, i, nDepth, + ((mine & ISMINE_SPENDABLE) != ISMINE_NO) || + (coinControl && coinControl->fAllowWatchOnly && (mine & ISMINE_WATCH_PUBKEY) != ISMINE_NO))); } } } @@ -1740,7 +1742,7 @@ bool CWallet::SelectCoins(const CAmount& nTargetValue, set<pair<const CWalletTx* return res; } -bool CWallet::FundTransaction(CMutableTransaction& tx, CAmount &nFeeRet, int& nChangePosRet, std::string& strFailReason) +bool CWallet::FundTransaction(CMutableTransaction& tx, CAmount &nFeeRet, int& nChangePosRet, std::string& strFailReason, bool includeWatching) { vector<CRecipient> vecSend; @@ -1753,6 +1755,7 @@ bool CWallet::FundTransaction(CMutableTransaction& tx, CAmount &nFeeRet, int& nC CCoinControl coinControl; coinControl.fAllowOtherInputs = true; + coinControl.fAllowWatchOnly = includeWatching; BOOST_FOREACH(const CTxIn& txin, tx.vin) coinControl.Select(txin.prevout); |