mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
Merge pull request #6415
d042854SQUASH "Implement watchonly support in fundrawtransaction" (Matt Corallo)428a898SQUASH "Add have-pubkey distinction to ISMINE flags" (Matt Corallo)6bdb474Implement watchonly support in fundrawtransaction (Matt Corallo)f5813bdAdd logic to track pubkeys as watch-only, not just scripts (Matt Corallo)d3354c5Add have-pubkey distinction to ISMINE flags (Matt Corallo)5c17059Update importaddress help to push its use to script-only (Matt Corallo)a1d7df3Add importpubkey method to import a watch-only pubkey (Matt Corallo)907a425Add p2sh option to importaddress to import redeemScripts (Matt Corallo)983d2d9Split up importaddress into helper functions (Matt Corallo)cfc3dd3Also remove pay-2-pubkey from watch when adding a priv key (Matt Corallo)
This commit is contained in:
@@ -112,6 +112,9 @@ bool CWallet::AddKeyPubKey(const CKey& secret, const CPubKey &pubkey)
|
||||
// check if we need to remove from watch-only
|
||||
CScript script;
|
||||
script = GetScriptForDestination(pubkey.GetID());
|
||||
if (HaveWatchOnly(script))
|
||||
RemoveWatchOnly(script);
|
||||
script = GetScriptForRawPubKey(pubkey);
|
||||
if (HaveWatchOnly(script))
|
||||
RemoveWatchOnly(script);
|
||||
|
||||
@@ -1527,7 +1530,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_SOLVABLE) != ISMINE_NO)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1743,7 +1748,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;
|
||||
|
||||
@@ -1756,6 +1761,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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user