aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bitcoinrpc.cpp5
-rw-r--r--src/makefile.mingw4
-rw-r--r--src/net.cpp2
-rw-r--r--src/rpcrawtransaction.cpp27
4 files changed, 30 insertions, 8 deletions
diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp
index c2bf45e1e2..85ef9031c7 100644
--- a/src/bitcoinrpc.cpp
+++ b/src/bitcoinrpc.cpp
@@ -2957,8 +2957,9 @@ void ConvertTo(Value& value)
{
// reinterpret string as unquoted json value
Value value2;
- if (!read_string(value.get_str(), value2))
- throw runtime_error("type mismatch");
+ string strJSON = value.get_str();
+ if (!read_string(strJSON, value2))
+ throw runtime_error(string("Error parsing JSON:")+strJSON);
value = value2.get_value<T>();
}
else
diff --git a/src/makefile.mingw b/src/makefile.mingw
index c270d4599a..3649afd0e9 100644
--- a/src/makefile.mingw
+++ b/src/makefile.mingw
@@ -7,12 +7,12 @@ USE_UPNP:=0
INCLUDEPATHS= \
-I"C:\boost-1.49.0-mgw" \
-I"C:\db-4.8.30.NC-mgw\build_unix" \
- -I"C:\openssl-1.0.0d-mgw\include"
+ -I"C:\openssl-1.0.1b-mgw\include"
LIBPATHS= \
-L"C:\boost-1.49.0-mgw\stage\lib" \
-L"C:\db-4.8.30.NC-mgw\build_unix" \
- -L"C:\openssl-1.0.0d-mgw"
+ -L"C:\openssl-1.0.1b-mgw"
LIBS= \
-l boost_system-mgw45-mt-s-1_49 \
diff --git a/src/net.cpp b/src/net.cpp
index 78b5a752db..f3c255c308 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -407,7 +407,7 @@ bool GetMyExternalIP(CNetAddr& ipRet)
void ThreadGetMyExternalIP(void* parg)
{
- // Make this thread recognisable as the message handling thread
+ // Make this thread recognisable as the external IP detection thread
RenameThread("bitcoin-ext-ip");
CNetAddr addrLocalHost;
diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp
index 8ffe4844c6..66e4d85f37 100644
--- a/src/rpcrawtransaction.cpp
+++ b/src/rpcrawtransaction.cpp
@@ -276,14 +276,16 @@ Value decoderawtransaction(const Array& params, bool fHelp)
Value signrawtransaction(const Array& params, bool fHelp)
{
- if (fHelp || params.size() < 1 || params.size() > 3)
+ if (fHelp || params.size() < 1 || params.size() > 4)
throw runtime_error(
- "signrawtransaction <hex string> [{\"txid\":txid,\"vout\":n,\"scriptPubKey\":hex},...] [<privatekey1>,...]\n"
+ "signrawtransaction <hex string> [{\"txid\":txid,\"vout\":n,\"scriptPubKey\":hex},...] [<privatekey1>,...] [sighashtype=\"ALL\"]\n"
"Sign inputs for raw transaction (serialized, hex-encoded).\n"
"Second optional argument is an array of previous transaction outputs that\n"
"this transaction depends on but may not yet be in the blockchain.\n"
"Third optional argument is an array of base58-encoded private\n"
"keys that, if given, will be the only keys used to sign the transaction.\n"
+ "Fourth option is a string that is one of six values; ALL, NONE, SINGLE or\n"
+ "ALL|ANYONECANPAY, NONE|ANYONECANPAY, SINGLE|ANYONECANPAY.\n"
"Returns json object with keys:\n"
" hex : raw transaction with signature(s) (hex-encoded string)\n"
" complete : 1 if transaction has a complete set of signature (0 if not)"
@@ -402,6 +404,25 @@ Value signrawtransaction(const Array& params, bool fHelp)
}
const CKeyStore& keystore = (fGivenKeys ? tempKeystore : *pwalletMain);
+ int nHashType = SIGHASH_ALL;
+ if (params.size() > 3)
+ {
+ static map<string, int> mapSigHashValues =
+ boost::assign::map_list_of
+ (string("ALL"), int(SIGHASH_ALL))
+ (string("ALL|ANYONECANPAY"), int(SIGHASH_ALL|SIGHASH_ANYONECANPAY))
+ (string("NONE"), int(SIGHASH_NONE))
+ (string("NONE|ANYONECANPAY"), int(SIGHASH_NONE|SIGHASH_ANYONECANPAY))
+ (string("SINGLE"), int(SIGHASH_SINGLE))
+ (string("SINGLE|ANYONECANPAY"), int(SIGHASH_SINGLE|SIGHASH_ANYONECANPAY))
+ ;
+ string strHashType = params[3].get_str();
+ if (mapSigHashValues.count(strHashType))
+ nHashType = mapSigHashValues[strHashType];
+ else
+ throw JSONRPCError(-8, "Invalid sighash param");
+ }
+
// Sign what we can:
for (unsigned int i = 0; i < mergedTx.vin.size(); i++)
{
@@ -414,7 +435,7 @@ Value signrawtransaction(const Array& params, bool fHelp)
const CScript& prevPubKey = mapPrevOut[txin.prevout];
txin.scriptSig.clear();
- SignSignature(keystore, prevPubKey, mergedTx, i);
+ SignSignature(keystore, prevPubKey, mergedTx, i, nHashType);
// ... and merge in other signatures:
BOOST_FOREACH(const CTransaction& txv, txVariants)