(self, tx, spend_tx)
| 1378 | # sign a transaction, using the key we know about |
| 1379 | # this signs input 0 in tx, which is assumed to be spending output 0 in spend_tx |
| 1380 | def sign_tx(self, tx, spend_tx): |
| 1381 | scriptPubKey = bytearray(spend_tx.vout[0].scriptPubKey) |
| 1382 | if (scriptPubKey[0] == OP_TRUE): # an anyone-can-spend |
| 1383 | tx.vin[0].scriptSig = CScript() |
| 1384 | return |
| 1385 | (sighash, err) = LegacySignatureHash(spend_tx.vout[0].scriptPubKey, tx, 0, SIGHASH_ALL) |
| 1386 | tx.vin[0].scriptSig = CScript([self.coinbase_key.sign_ecdsa(sighash) + bytes(bytearray([SIGHASH_ALL]))]) |
| 1387 | |
| 1388 | def create_and_sign_transaction(self, spend_tx, value, script=CScript([OP_TRUE])): |
| 1389 | tx = self.create_tx(spend_tx, 0, value, script) |
no test coverage detected