Changeset View
Changeset View
Standalone View
Standalone View
src/bitcoin-tx.cpp
Show First 20 Lines • Show All 398 Lines • ▼ Show 20 Lines | static void MutateTxAddOutMultiSig(CMutableTransaction &tx, | ||||
} 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) { | ||||
if (scriptPubKey.size() > MAX_SCRIPT_ELEMENT_SIZE) { | |||||
throw std::runtime_error( | |||||
strprintf("redeemScript exceeds size limit: %d > %d", | |||||
scriptPubKey.size(), MAX_SCRIPT_ELEMENT_SIZE)); | |||||
} | |||||
// 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)); | ||||
} | } | ||||
// construct TxOut, append to transaction output list | // construct TxOut, append to transaction output list | ||||
CTxOut txout(value, scriptPubKey); | CTxOut txout(value, scriptPubKey); | ||||
tx.vout.push_back(txout); | tx.vout.push_back(txout); | ||||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | static void MutateTxAddOutScript(CMutableTransaction &tx, | ||||
// 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 (scriptPubKey.size() > MAX_SCRIPT_SIZE) { | |||||
throw std::runtime_error(strprintf("script exceeds size limit: %d > %d", | |||||
scriptPubKey.size(), | |||||
MAX_SCRIPT_SIZE)); | |||||
} | |||||
if (bScriptHash) { | if (bScriptHash) { | ||||
if (scriptPubKey.size() > MAX_SCRIPT_ELEMENT_SIZE) { | |||||
throw std::runtime_error( | |||||
strprintf("redeemScript exceeds size limit: %d > %d", | |||||
scriptPubKey.size(), MAX_SCRIPT_ELEMENT_SIZE)); | |||||
} | |||||
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); | ||||
tx.vout.push_back(txout); | tx.vout.push_back(txout); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 401 Lines • Show Last 20 Lines |