lib/bitcoin/storage/models.rb in bitcoin-ruby-0.0.5 vs lib/bitcoin/storage/models.rb in bitcoin-ruby-0.0.6
- old
+ new
@@ -93,17 +93,18 @@
end
# Transaction input retrieved from storage. (see Bitcoin::Protocol::TxIn
class TxIn < Bitcoin::Protocol::TxIn
- attr_reader :store, :id, :tx_id, :tx_idx
+ attr_reader :store, :id, :tx_id, :tx_idx, :p2sh_type
def initialize store, data
@store = store
@id = data[:id]
@tx_id = data[:tx_id]
@tx_idx = data[:tx_idx]
+ @p2sh_type = data[:p2sh_type]
end
# get the transaction this input is in
def get_tx
@tx ||= @store.get_tx_by_id(@tx_id)
@@ -132,44 +133,38 @@
@tx_idx = data[:tx_idx]
@type = data[:type]
end
def hash160
- script.get_hash160
+ parsed_script.get_hash160
end
# get the transaction this output is in
def get_tx
@tx ||= @store.get_tx_by_id(@tx_id)
end
# get the next input that references this output
def get_next_in
@store.get_txin_for_txout(get_tx.hash, @tx_idx)
- rescue
- nil
end
# get all addresses this txout corresponds to (if possible)
def get_address
- script.get_address
+ parsed_script.get_address
end
# get the single address this txout corresponds to (first for multisig tx)
def get_addresses
- script.get_addresses
+ parsed_script.get_addresses
end
def get_namecoin_name
@store.get_name_by_txout_id(@id)
end
def type
- script.type
- end
-
- def script
- @_script = Bitcoin::Script.new(@pk_script)
+ parsed_script.type
end
end
end