| 1165 | /** Serialize an input of txTo */ |
| 1166 | template<typename S> |
| 1167 | void SerializeInput(S &s, unsigned int nInput) const { |
| 1168 | // In case of SIGHASH_ANYONECANPAY, only the input being signed is serialized |
| 1169 | if (fAnyoneCanPay) |
| 1170 | nInput = nIn; |
| 1171 | // Serialize the prevout |
| 1172 | ::Serialize(s, txTo.vin[nInput].prevout); |
| 1173 | // Serialize the script |
| 1174 | if (nInput != nIn) |
| 1175 | // Blank out other inputs' signatures |
| 1176 | ::Serialize(s, CScript()); |
| 1177 | else |
| 1178 | SerializeScriptCode(s); |
| 1179 | // Serialize the nSequence |
| 1180 | if (nInput != nIn && (fHashSingle || fHashNone)) |
| 1181 | // let the others update at will |
| 1182 | ::Serialize(s, (int)0); |
| 1183 | else |
| 1184 | ::Serialize(s, txTo.vin[nInput].nSequence); |
| 1185 | } |
| 1186 | |
| 1187 | /** Serialize an output of txTo */ |
| 1188 | template<typename S> |