aboutsummaryrefslogtreecommitdiff
path: root/src/rpcrawtransaction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rpcrawtransaction.cpp')
-rw-r--r--src/rpcrawtransaction.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp
index fe365643fb..4912f71f9d 100644
--- a/src/rpcrawtransaction.cpp
+++ b/src/rpcrawtransaction.cpp
@@ -3,15 +3,21 @@
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#include <boost/assign/list_of.hpp>
+
#include "base58.h"
#include "bitcoinrpc.h"
-#include "db.h"
#include "init.h"
#include "net.h"
+#include "uint256.h"
#include "wallet.h"
+#include <stdint.h>
+
+#include <boost/assign/list_of.hpp>
+#include "json/json_spirit_utils.h"
+#include "json/json_spirit_value.h"
+
using namespace std;
using namespace boost;
using namespace boost::assign;
@@ -29,7 +35,7 @@ void ScriptPubKeyToJSON(const CScript& scriptPubKey, Object& out, bool fIncludeH
if (!ExtractDestinations(scriptPubKey, type, addresses, nRequired))
{
- out.push_back(Pair("type", GetTxnOutputType(TX_NONSTANDARD)));
+ out.push_back(Pair("type", GetTxnOutputType(type)));
return;
}
@@ -87,9 +93,9 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry)
if (mi != mapBlockIndex.end() && (*mi).second)
{
CBlockIndex* pindex = (*mi).second;
- if (pindex->IsInMainChain())
+ if (chainActive.Contains(pindex))
{
- entry.push_back(Pair("confirmations", 1 + nBestHeight - pindex->nHeight));
+ entry.push_back(Pair("confirmations", 1 + chainActive.Height() - pindex->nHeight));
entry.push_back(Pair("time", (boost::int64_t)pindex->nTime));
entry.push_back(Pair("blocktime", (boost::int64_t)pindex->nTime));
}
@@ -188,7 +194,7 @@ Value listunspent(const Array& params, bool fHelp)
continue;
}
- int64 nValue = out.tx->vout[out.i].nValue;
+ int64_t nValue = out.tx->vout[out.i].nValue;
const CScript& pk = out.tx->vout[out.i].scriptPubKey;
Object entry;
entry.push_back(Pair("txid", out.tx->GetHash().GetHex()));
@@ -269,7 +275,7 @@ Value createrawtransaction(const Array& params, bool fHelp)
CScript scriptPubKey;
scriptPubKey.SetDestination(address.Get());
- int64 nAmount = AmountFromValue(s.value_);
+ int64_t nAmount = AmountFromValue(s.value_);
CTxOut out(nAmount, scriptPubKey);
rawTx.vout.push_back(out);
@@ -550,7 +556,7 @@ Value sendrawtransaction(const Array& params, bool fHelp)
if (!fHave) {
// push to local node
CValidationState state;
- if (!mempool.accept(state, tx, false, NULL, !fOverrideFees))
+ if (!AcceptToMemoryPool(mempool, state, tx, false, NULL, !fOverrideFees))
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX rejected"); // TODO: report validation state
}
}
@@ -560,7 +566,7 @@ Value sendrawtransaction(const Array& params, bool fHelp)
// Not in block, but already in the memory pool; will drop
// through to re-relay it.
} else {
- SyncWithWallets(hashTx, tx, NULL, true);
+ SyncWithWallets(hashTx, tx, NULL);
}
RelayTransaction(tx, hashTx);