Sha256: 88b775955a8d84f0ada1a6a18bd6456ca85af86a02da47fa049cb0a9e66fd1f2
Contents?: true
Size: 884 Bytes
Versions: 6
Compression:
Stored size: 884 Bytes
Contents
module BTC # Represents a reference to a previous transaction. class TransactionOutpoint attr_accessor :transaction_hash attr_accessor :transaction_id attr_accessor :index def initialize(transaction_hash: nil, transaction_id: nil, index: 0) @transaction_hash = transaction_hash self.transaction_id = transaction_id if transaction_id @index = index end def transaction_id=(txid) self.transaction_hash = BTC.hash_from_id(txid) end def transaction_id BTC.id_from_hash(self.transaction_hash) end def outpoint_id %{#{transaction_id}:#{index}} end def ==(other) index == other.index && transaction_hash == other.transaction_hash end alias_method :eql?, :== def hash transaction_hash.hash ^ index end def to_s outpoint_id end end end
Version data entries
6 entries across 6 versions & 1 rubygems