aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/release-process.txt6
-rw-r--r--src/bitcoinrpc.cpp5
-rw-r--r--src/main.cpp33
-rw-r--r--src/main.h3
-rw-r--r--src/util.cpp23
5 files changed, 54 insertions, 16 deletions
diff --git a/doc/release-process.txt b/doc/release-process.txt
index ee1a5d4a34..3f1a6a5fb7 100644
--- a/doc/release-process.txt
+++ b/doc/release-process.txt
@@ -1,3 +1,5 @@
+* update translations (ping tcatm on IRC for now)
+
* update (commit) version in sources
bitcoin-qt.pro
src/main.h (CLIENT_VERSION : PROTOCOL_VERSION in serialize.h is updated only on protocol changes)
@@ -77,9 +79,9 @@
Build output expected:
Bitcoin-Qt.dmg
-* upload source and builds to SourceForge
+* upload builds to SourceForge
-* create SHA1SUMS for builds, and PGP-sign it
+* create SHA256SUMS for builds, and PGP-sign it
* update bitcoin.org version
diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp
index 5ac58de06d..3063abd1fa 100644
--- a/src/bitcoinrpc.cpp
+++ b/src/bitcoinrpc.cpp
@@ -1025,9 +1025,12 @@ Value addmultisigaddress(const Array& params, bool fHelp)
if (address.IsScript())
throw runtime_error(
strprintf("%s is a pay-to-script address",ks.c_str()));
- if (!pwalletMain->GetKey(address, pubkeys[i]))
+ std::vector<unsigned char> vchPubKey;
+ if (!pwalletMain->GetPubKey(address, vchPubKey))
throw runtime_error(
strprintf("no full public key for address %s",ks.c_str()));
+ if (vchPubKey.empty() || !pubkeys[i].SetPubKey(vchPubKey))
+ throw runtime_error(" Invalid public key: "+ks);
}
// Case 2: hex public key
diff --git a/src/main.cpp b/src/main.cpp
index 891dbed980..e242fa640d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -277,11 +277,8 @@ bool CTransaction::IsStandard() const
//
bool CTransaction::AreInputsStandard(const MapPrevTx& mapInputs) const
{
- if (fTestNet)
- return true; // Allow non-standard on testnet
-
if (IsCoinBase())
- return true; // Coinbases are allowed to have any input
+ return true; // Coinbases don't use vin normally
for (int i = 0; i < vin.size(); i++)
{
@@ -492,15 +489,18 @@ bool CTransaction::AcceptToMemoryPool(CTxDB& txdb, bool fCheckInputs, bool* pfMi
{
MapPrevTx mapInputs;
map<uint256, CTxIndex> mapUnused;
- if (!FetchInputs(txdb, mapUnused, false, false, mapInputs))
+ bool fInvalid = false;
+ if (!FetchInputs(txdb, mapUnused, false, false, mapInputs, fInvalid))
{
+ if (fInvalid)
+ return error("AcceptToMemoryPool() : FetchInputs found invalid tx %s", hash.ToString().substr(0,10).c_str());
if (pfMissingInputs)
*pfMissingInputs = true;
return error("AcceptToMemoryPool() : FetchInputs failed %s", hash.ToString().substr(0,10).c_str());
}
// Check for non-standard pay-to-script-hash in inputs
- if (!AreInputsStandard(mapInputs))
+ if (!AreInputsStandard(mapInputs) && !fTestNet)
return error("AcceptToMemoryPool() : nonstandard transaction input");
int64 nFees = GetValueIn(mapInputs)-GetValueOut();
@@ -546,8 +546,6 @@ bool CTransaction::AcceptToMemoryPool(CTxDB& txdb, bool fCheckInputs, bool* pfMi
// This is done last to help prevent CPU exhaustion denial-of-service attacks.
if (!ConnectInputs(mapInputs, mapUnused, CDiskTxPos(1,1,1), pindexBest, false, false))
{
- if (pfMissingInputs)
- *pfMissingInputs = true;
return error("AcceptToMemoryPool() : ConnectInputs failed %s", hash.ToString().substr(0,10).c_str());
}
}
@@ -923,8 +921,14 @@ bool CTransaction::DisconnectInputs(CTxDB& txdb)
bool CTransaction::FetchInputs(CTxDB& txdb, const map<uint256, CTxIndex>& mapTestPool,
- bool fBlock, bool fMiner, MapPrevTx& inputsRet)
+ bool fBlock, bool fMiner, MapPrevTx& inputsRet, bool& fInvalid)
{
+ // FetchInputs can return false either because we just haven't seen some inputs
+ // (in which case the transaction should be stored as an orphan)
+ // or because the transaction is malformed (in which case the transaction should
+ // be dropped). If tx is definitely invalid, fInvalid will be set to true.
+ fInvalid = false;
+
if (IsCoinBase())
return true; // Coinbase transactions have no inputs to fetch.
@@ -980,7 +984,12 @@ bool CTransaction::FetchInputs(CTxDB& txdb, const map<uint256, CTxIndex>& mapTes
const CTxIndex& txindex = inputsRet[prevout.hash].first;
const CTransaction& txPrev = inputsRet[prevout.hash].second;
if (prevout.n >= txPrev.vout.size() || prevout.n >= txindex.vSpent.size())
+ {
+ // Revisit this if/when transaction replacement is implemented and allows
+ // adding inputs:
+ fInvalid = true;
return DoS(100, error("FetchInputs() : %s prevout.n out of range %d %d %d prev tx %s\n%s", GetHash().ToString().substr(0,10).c_str(), prevout.n, txPrev.vout.size(), txindex.vSpent.size(), prevout.hash.ToString().substr(0,10).c_str(), txPrev.ToString().c_str()));
+ }
}
return true;
@@ -1203,7 +1212,8 @@ bool CBlock::ConnectBlock(CTxDB& txdb, CBlockIndex* pindex)
MapPrevTx mapInputs;
if (!tx.IsCoinBase())
{
- if (!tx.FetchInputs(txdb, mapQueuedChanges, true, false, mapInputs))
+ bool fInvalid;
+ if (!tx.FetchInputs(txdb, mapQueuedChanges, true, false, mapInputs, fInvalid))
return false;
int nTxOps = tx.GetSigOpCount(mapInputs);
@@ -3063,7 +3073,8 @@ CBlock* CreateNewBlock(CReserveKey& reservekey)
// because we're already processing them in order of dependency
map<uint256, CTxIndex> mapTestPoolTmp(mapTestPool);
MapPrevTx mapInputs;
- if (!tx.FetchInputs(txdb, mapTestPoolTmp, false, true, mapInputs))
+ bool fInvalid;
+ if (!tx.FetchInputs(txdb, mapTestPoolTmp, false, true, mapInputs, fInvalid))
continue;
int64 nFees = tx.GetValueIn(mapInputs)-tx.GetValueOut();
diff --git a/src/main.h b/src/main.h
index be5f2f58a5..ec5623d17d 100644
--- a/src/main.h
+++ b/src/main.h
@@ -684,10 +684,11 @@ public:
@param[in] fBlock True if being called to add a new best-block to the chain
@param[in] fMiner True if being called by CreateNewBlock
@param[out] inputsRet Pointers to this transaction's inputs
+ @param[out] fInvalid returns true if transaction is invalid
@return Returns true if all inputs are in txdb or mapTestPool
*/
bool FetchInputs(CTxDB& txdb, const std::map<uint256, CTxIndex>& mapTestPool,
- bool fBlock, bool fMiner, MapPrevTx& inputsRet);
+ bool fBlock, bool fMiner, MapPrevTx& inputsRet, bool& fInvalid);
/** Sanity check previous transactions, then, if all checks succeed,
mark them as spent by this transaction.
diff --git a/src/util.cpp b/src/util.cpp
index 67e1bf801a..6a4c2a2ef3 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -1153,7 +1153,18 @@ static void pop_lock()
void CCriticalSection::Enter(const char* pszName, const char* pszFile, int nLine)
{
push_lock(this, CLockLocation(pszName, pszFile, nLine));
+#ifdef DEBUG_LOCKCONTENTION
+ bool result = mutex.try_lock();
+ if (!result)
+ {
+ printf("LOCKCONTENTION: %s\n", pszName);
+ printf("Locker: %s:%d\n", pszFile, nLine);
+ mutex.lock();
+ printf("Locked\n");
+ }
+#else
mutex.lock();
+#endif
}
void CCriticalSection::Leave()
{
@@ -1170,9 +1181,19 @@ bool CCriticalSection::TryEnter(const char* pszName, const char* pszFile, int nL
#else
-void CCriticalSection::Enter(const char*, const char*, int)
+void CCriticalSection::Enter(const char* pszName, const char* pszFile, int nLine)
{
+#ifdef DEBUG_LOCKCONTENTION
+ bool result = mutex.try_lock();
+ if (!result)
+ {
+ printf("LOCKCONTENTION: %s\n", pszName);
+ printf("Locker: %s:%d\n", pszFile, nLine);
+ mutex.lock();
+ }
+#else
mutex.lock();
+#endif
}
void CCriticalSection::Leave()