MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / sign_tx

Method sign_tx

test/functional/feature_block.py:1221–1227  ·  view source on GitHub ↗
(self, tx, spend_tx)

Source from the content-addressed store, hash-verified

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)

Callers 3

run_testMethod · 0.95
next_blockMethod · 0.95

Calls 3

CScriptClass · 0.90
SignatureHashFunction · 0.90
signMethod · 0.45

Tested by

no test coverage detected