MCPcopy
hub / github.com/jimmysong/programmingbitcoin / script_pubkey

Method script_pubkey

code-ch08/tx.py:308–316  ·  view source on GitHub ↗

Get the ScriptPubKey by looking up the tx hash Returns a Script object

(self, testnet=False)

Source from the content-addressed store, hash-verified

306 return tx.tx_outs[self.prev_index].amount
307
308 def script_pubkey(self, testnet=False):
309 '''Get the ScriptPubKey by looking up the tx hash
310 Returns a Script object
311 '''
312 # use self.fetch_tx to get the transaction
313 tx = self.fetch_tx(testnet=testnet)
314 # get the output at self.prev_index
315 # return the script_pubkey property
316 return tx.tx_outs[self.prev_index].script_pubkey
317
318
319class TxOut:

Callers 5

test_input_pubkeyMethod · 0.95
sig_hashMethod · 0.45
verify_inputMethod · 0.45
sig_hashFunction · 0.45
verify_inputFunction · 0.45

Calls 1

fetch_txMethod · 0.95

Tested by 1

test_input_pubkeyMethod · 0.76