(self, tx, spend_tx)
| 1219 | # sign a transaction, using the key we know about |
| 1220 | # this signs input 0 in tx, which is assumed to be spending output n in spend_tx |
| 1221 | def sign_tx(self, tx, spend_tx): |
| 1222 | scriptPubKey = bytearray(spend_tx.vout[0].scriptPubKey) |
| 1223 | if (scriptPubKey[0] == OP_TRUE): # an anyone-can-spend |
| 1224 | tx.vin[0].scriptSig = CScript() |
| 1225 | return |
| 1226 | (sighash, err) = SignatureHash(spend_tx.vout[0].scriptPubKey, tx, 0, SIGHASH_ALL) |
| 1227 | tx.vin[0].scriptSig = CScript([self.coinbase_key.sign(sighash) + bytes(bytearray([SIGHASH_ALL]))]) |
| 1228 | |
| 1229 | def create_and_sign_transaction(self, spend_tx, value, script=CScript([OP_TRUE])): |
| 1230 | tx = self.create_tx(spend_tx, 0, value, script) |
no test coverage detected