Changeset View
Changeset View
Standalone View
Standalone View
src/bitcoin-tx.cpp
Show First 20 Lines • Show All 652 Lines • ▼ Show 20 Lines | for (unsigned int previdx = 0; previdx < prevtxsObj.size(); previdx++) { | ||||
tempKeystore.AddCScript(redeemScript); | tempKeystore.AddCScript(redeemScript); | ||||
} | } | ||||
} | } | ||||
const CKeyStore &keystore = tempKeystore; | const CKeyStore &keystore = tempKeystore; | ||||
// Sign what we can: | // Sign what we can: | ||||
for (size_t i = 0; i < mergedTx.vin.size(); i++) { | for (size_t i = 0; i < mergedTx.vin.size(); i++) { | ||||
const CTxIn &txin = mergedTx.vin[i]; | CTxIn &txin = mergedTx.vin[i]; | ||||
const Coin &coin = view.AccessCoin(txin.prevout); | const Coin &coin = view.AccessCoin(txin.prevout); | ||||
if (coin.IsSpent()) { | if (coin.IsSpent()) { | ||||
continue; | continue; | ||||
} | } | ||||
const CScript &prevPubKey = coin.GetTxOut().scriptPubKey; | const CScript &prevPubKey = coin.GetTxOut().scriptPubKey; | ||||
const Amount amount = coin.GetTxOut().nValue; | const Amount amount = coin.GetTxOut().nValue; | ||||
SignatureData sigdata; | SignatureData sigdata; | ||||
// Only sign SIGHASH_SINGLE if there's a corresponding output: | // Only sign SIGHASH_SINGLE if there's a corresponding output: | ||||
if ((sigHashType.getBaseType() != BaseSigHashType::SINGLE) || | if ((sigHashType.getBaseType() != BaseSigHashType::SINGLE) || | ||||
(i < mergedTx.vout.size())) { | (i < mergedTx.vout.size())) { | ||||
ProduceSignature(keystore, | ProduceSignature(keystore, | ||||
MutableTransactionSignatureCreator( | MutableTransactionSignatureCreator( | ||||
&mergedTx, i, amount, sigHashType), | &mergedTx, i, amount, sigHashType), | ||||
prevPubKey, sigdata); | prevPubKey, sigdata); | ||||
} | } | ||||
// ... and merge in other signatures: | // ... and merge in other signatures: | ||||
sigdata = CombineSignatures( | sigdata = CombineSignatures( | ||||
prevPubKey, | prevPubKey, | ||||
MutableTransactionSignatureChecker(&mergedTx, i, amount), sigdata, | MutableTransactionSignatureChecker(&mergedTx, i, amount), sigdata, | ||||
DataFromTransaction(txv, i)); | DataFromTransaction(txv, i)); | ||||
UpdateTransaction(mergedTx, i, sigdata); | UpdateInput(txin, sigdata); | ||||
} | } | ||||
tx = mergedTx; | tx = mergedTx; | ||||
} | } | ||||
class Secp256k1Init { | class Secp256k1Init { | ||||
ECCVerifyHandle globalVerifyHandle; | ECCVerifyHandle globalVerifyHandle; | ||||
▲ Show 20 Lines • Show All 192 Lines • Show Last 20 Lines |