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

Method value

code-ch08/tx.py:298–306  ·  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

296 return TxFetcher.fetch(self.prev_tx.hex(), testnet=testnet)
297
298 def value(self, testnet=False):
299 '''Get the outpoint value by looking up the tx hash
300 Returns the amount in satoshi
301 '''
302 # use self.fetch_tx to get the transaction
303 tx = self.fetch_tx(testnet=testnet)
304 # get the output at self.prev_index
305 # return the amount property
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

Callers 2

test_input_valueMethod · 0.95
feeMethod · 0.45

Calls 1

fetch_txMethod · 0.95

Tested by 1

test_input_valueMethod · 0.76