Changeset View
Changeset View
Standalone View
Standalone View
src/bitcoin-tx.cpp
Show First 20 Lines • Show All 328 Lines • ▼ Show 20 Lines | static void MutateTxAddOutPubKey(CMutableTransaction &tx, | ||||
} | } | ||||
CScript scriptPubKey = GetScriptForRawPubKey(pubkey); | CScript scriptPubKey = GetScriptForRawPubKey(pubkey); | ||||
// Extract and validate FLAGS | // Extract and validate FLAGS | ||||
bool bScriptHash = false; | bool bScriptHash = false; | ||||
if (vStrInputParts.size() == 3) { | if (vStrInputParts.size() == 3) { | ||||
std::string flags = vStrInputParts[2]; | std::string flags = vStrInputParts[2]; | ||||
bScriptHash = (flags.find("S") != std::string::npos); | bScriptHash = (flags.find('S') != std::string::npos); | ||||
} | } | ||||
if (bScriptHash) { | if (bScriptHash) { | ||||
// Get the ID for the script, and then construct a P2SH destination for | // Get the ID for the script, and then construct a P2SH destination for | ||||
// it. | // it. | ||||
scriptPubKey = GetScriptForDestination(CScriptID(scriptPubKey)); | scriptPubKey = GetScriptForDestination(CScriptID(scriptPubKey)); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | for (int pos = 1; pos <= int(numkeys); pos++) { | ||||
pubkeys.push_back(pubkey); | pubkeys.push_back(pubkey); | ||||
} | } | ||||
// Extract FLAGS | // Extract FLAGS | ||||
bool bScriptHash = false; | bool bScriptHash = false; | ||||
if (vStrInputParts.size() == numkeys + 4) { | if (vStrInputParts.size() == numkeys + 4) { | ||||
std::string flags = vStrInputParts.back(); | std::string flags = vStrInputParts.back(); | ||||
bScriptHash = (flags.find("S") != std::string::npos); | bScriptHash = (flags.find('S') != std::string::npos); | ||||
} else if (vStrInputParts.size() > numkeys + 4) { | } else if (vStrInputParts.size() > numkeys + 4) { | ||||
// Validate that there were no more parameters passed | // Validate that there were no more parameters passed | ||||
throw std::runtime_error("Too many parameters"); | throw std::runtime_error("Too many parameters"); | ||||
} | } | ||||
CScript scriptPubKey = GetScriptForMultisig(required, pubkeys); | CScript scriptPubKey = GetScriptForMultisig(required, pubkeys); | ||||
if (bScriptHash) { | if (bScriptHash) { | ||||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | static void MutateTxAddOutScript(CMutableTransaction &tx, | ||||
// extract and validate script | // extract and validate script | ||||
std::string strScript = vStrInputParts[1]; | std::string strScript = vStrInputParts[1]; | ||||
CScript scriptPubKey = ParseScript(strScript); | CScript scriptPubKey = ParseScript(strScript); | ||||
// Extract FLAGS | // Extract FLAGS | ||||
bool bScriptHash = false; | bool bScriptHash = false; | ||||
if (vStrInputParts.size() == 3) { | if (vStrInputParts.size() == 3) { | ||||
std::string flags = vStrInputParts.back(); | std::string flags = vStrInputParts.back(); | ||||
bScriptHash = (flags.find("S") != std::string::npos); | bScriptHash = (flags.find('S') != std::string::npos); | ||||
} | } | ||||
if (bScriptHash) { | if (bScriptHash) { | ||||
scriptPubKey = GetScriptForDestination(CScriptID(scriptPubKey)); | scriptPubKey = GetScriptForDestination(CScriptID(scriptPubKey)); | ||||
} | } | ||||
// construct TxOut, append to transaction output list | // construct TxOut, append to transaction output list | ||||
CTxOut txout(value, scriptPubKey); | CTxOut txout(value, scriptPubKey); | ||||
▲ Show 20 Lines • Show All 410 Lines • Show Last 20 Lines |