MCPcopy Index your code
hub / github.com/jimmysong/programmingbitcoin / value

Method value

code-ch13/tx.py:451–459  ·  view source on GitHub ↗

Get the outpoint value by looking up the tx hash Returns the amount in satoshi

(self, testnet=False)

Source from the content-addressed store, hash-verified

449 return TxFetcher.fetch(self.prev_tx.hex(), testnet=testnet)
450
451 def value(self, testnet=False):
452 '''Get the outpoint value by looking up the tx hash
453 Returns the amount in satoshi
454 '''
455 # use self.fetch_tx to get the transaction
456 tx = self.fetch_tx(testnet=testnet)
457 # get the output at self.prev_index
458 # return the amount property
459 return tx.tx_outs[self.prev_index].amount
460
461 def script_pubkey(self, testnet=False):
462 '''Get the ScriptPubKey by looking up the tx hash

Callers 3

test_input_valueMethod · 0.95
feeMethod · 0.45
sig_hash_bip143Method · 0.45

Calls 1

fetch_txMethod · 0.95

Tested by 1

test_input_valueMethod · 0.76