MCPcopy Create free account
hub / github.com/ElementsProject/elements / sign_tx

Method sign_tx

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

Source from the content-addressed store, hash-verified

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)

Callers 8

run_testMethod · 0.95
next_blockMethod · 0.95
create_bip112specialMethod · 0.45
create_bip68txsMethod · 0.45
create_bip112txsMethod · 0.45
run_testMethod · 0.45

Calls 3

CScriptClass · 0.90
LegacySignatureHashFunction · 0.90
sign_ecdsaMethod · 0.80

Tested by

no test coverage detected