Changeset View
Changeset View
Standalone View
Standalone View
src/script/sign.cpp
Show First 20 Lines • Show All 170 Lines • ▼ Show 20 Lines | SignatureData DataFromTransaction(const CMutableTransaction &tx, | ||||
data.scriptSig = tx.vin[nIn].scriptSig; | data.scriptSig = tx.vin[nIn].scriptSig; | ||||
return data; | return data; | ||||
} | } | ||||
void UpdateInput(CTxIn &input, const SignatureData &data) { | void UpdateInput(CTxIn &input, const SignatureData &data) { | ||||
input.scriptSig = data.scriptSig; | input.scriptSig = data.scriptSig; | ||||
} | } | ||||
void UpdateTransaction(CMutableTransaction &tx, unsigned int nIn, | |||||
const SignatureData &data) { | |||||
assert(tx.vin.size() > nIn); | |||||
UpdateInput(tx.vin[nIn], data); | |||||
} | |||||
bool SignSignature(const SigningProvider &provider, const CScript &fromPubKey, | bool SignSignature(const SigningProvider &provider, const CScript &fromPubKey, | ||||
CMutableTransaction &txTo, unsigned int nIn, | CMutableTransaction &txTo, unsigned int nIn, | ||||
const Amount amount, SigHashType sigHashType) { | const Amount amount, SigHashType sigHashType) { | ||||
assert(nIn < txTo.vin.size()); | assert(nIn < txTo.vin.size()); | ||||
MutableTransactionSignatureCreator creator(&txTo, nIn, amount, sigHashType); | MutableTransactionSignatureCreator creator(&txTo, nIn, amount, sigHashType); | ||||
SignatureData sigdata; | SignatureData sigdata; | ||||
bool ret = ProduceSignature(provider, creator, fromPubKey, sigdata); | bool ret = ProduceSignature(provider, creator, fromPubKey, sigdata); | ||||
UpdateTransaction(txTo, nIn, sigdata); | UpdateInput(txTo.vin.at(nIn), sigdata); | ||||
return ret; | return ret; | ||||
} | } | ||||
bool SignSignature(const SigningProvider &provider, const CTransaction &txFrom, | bool SignSignature(const SigningProvider &provider, const CTransaction &txFrom, | ||||
CMutableTransaction &txTo, unsigned int nIn, | CMutableTransaction &txTo, unsigned int nIn, | ||||
SigHashType sigHashType) { | SigHashType sigHashType) { | ||||
assert(nIn < txTo.vin.size()); | assert(nIn < txTo.vin.size()); | ||||
CTxIn &txin = txTo.vin[nIn]; | CTxIn &txin = txTo.vin[nIn]; | ||||
▲ Show 20 Lines • Show All 190 Lines • Show Last 20 Lines |