Changeset View
Changeset View
Standalone View
Standalone View
src/script/sign.cpp
Show First 20 Lines • Show All 168 Lines • ▼ Show 20 Lines | |||||
SignatureData DataFromTransaction(const CMutableTransaction &tx, | SignatureData DataFromTransaction(const CMutableTransaction &tx, | ||||
unsigned int nIn) { | unsigned int nIn) { | ||||
SignatureData data; | SignatureData data; | ||||
assert(tx.vin.size() > nIn); | assert(tx.vin.size() > nIn); | ||||
data.scriptSig = tx.vin[nIn].scriptSig; | data.scriptSig = tx.vin[nIn].scriptSig; | ||||
return data; | return data; | ||||
} | } | ||||
void UpdateInput(CTxIn &input, const SignatureData &data) { | |||||
input.scriptSig = data.scriptSig; | |||||
} | |||||
void UpdateTransaction(CMutableTransaction &tx, unsigned int nIn, | void UpdateTransaction(CMutableTransaction &tx, unsigned int nIn, | ||||
const SignatureData &data) { | const SignatureData &data) { | ||||
assert(tx.vin.size() > nIn); | assert(tx.vin.size() > nIn); | ||||
tx.vin[nIn].scriptSig = data.scriptSig; | UpdateInput(tx.vin[nIn], data); | ||||
} | } | ||||
bool SignSignature(const CKeyStore &keystore, const CScript &fromPubKey, | bool SignSignature(const CKeyStore &keystore, 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()); | ||||
CTransaction txToConst(txTo); | CTransaction txToConst(txTo); | ||||
▲ Show 20 Lines • Show All 200 Lines • Show Last 20 Lines |