Changeset View
Changeset View
Standalone View
Standalone View
src/bitcoin-tx.cpp
Show All 18 Lines | |||||
#include "univalue.h" | #include "univalue.h" | ||||
#include "util.h" | #include "util.h" | ||||
#include "utilmoneystr.h" | #include "utilmoneystr.h" | ||||
#include "utilstrencodings.h" | #include "utilstrencodings.h" | ||||
#include <cstdio> | #include <cstdio> | ||||
#include <boost/algorithm/string.hpp> | #include <boost/algorithm/string.hpp> | ||||
#include <boost/assign/list_of.hpp> | |||||
static bool fCreateBlank; | static bool fCreateBlank; | ||||
static std::map<std::string, UniValue> registers; | static std::map<std::string, UniValue> registers; | ||||
static const int CONTINUE_EXECUTION = -1; | static const int CONTINUE_EXECUTION = -1; | ||||
// | // | ||||
// This function returns either one of EXIT_ codes when it's expected to stop | // This function returns either one of EXIT_ codes when it's expected to stop | ||||
// the process or CONTINUE_EXECUTION when it's expected to continue further. | // the process or CONTINUE_EXECUTION when it's expected to continue further. | ||||
▲ Show 20 Lines • Show All 567 Lines • ▼ Show 20 Lines | static void MutateTxSign(CMutableTransaction &tx, const std::string &flagStr) { | ||||
UniValue prevtxsObj = registers["prevtxs"]; | UniValue prevtxsObj = registers["prevtxs"]; | ||||
for (unsigned int previdx = 0; previdx < prevtxsObj.size(); previdx++) { | for (unsigned int previdx = 0; previdx < prevtxsObj.size(); previdx++) { | ||||
UniValue prevOut = prevtxsObj[previdx]; | UniValue prevOut = prevtxsObj[previdx]; | ||||
if (!prevOut.isObject()) { | if (!prevOut.isObject()) { | ||||
throw std::runtime_error("expected prevtxs internal object"); | throw std::runtime_error("expected prevtxs internal object"); | ||||
} | } | ||||
std::map<std::string, UniValue::VType> types = | std::map<std::string, UniValue::VType> types = { | ||||
boost::assign::map_list_of("txid", UniValue::VSTR)( | {"txid", UniValue::VSTR}, | ||||
"vout", UniValue::VNUM)("scriptPubKey", UniValue::VSTR); | {"vout", UniValue::VNUM}, | ||||
{"scriptPubKey", UniValue::VSTR}}; | |||||
if (!prevOut.checkObject(types)) { | if (!prevOut.checkObject(types)) { | ||||
throw std::runtime_error("prevtxs internal object typecheck fail"); | throw std::runtime_error("prevtxs internal object typecheck fail"); | ||||
} | } | ||||
uint256 txid = ParseHashUV(prevOut["txid"], "txid"); | uint256 txid = ParseHashUV(prevOut["txid"], "txid"); | ||||
int nOut = atoi(prevOut["vout"].getValStr()); | int nOut = atoi(prevOut["vout"].getValStr()); | ||||
if (nOut < 0) { | if (nOut < 0) { | ||||
▲ Show 20 Lines • Show All 285 Lines • Show Last 20 Lines |