Class: BSV::Transaction::MerklePath::PathElement
- Inherits:
-
Object
- Object
- BSV::Transaction::MerklePath::PathElement
- Defined in:
- lib/bsv/transaction/merkle_path.rb
Overview
A single leaf in one level of the merkle path.
Instance Attribute Summary collapse
-
#duplicate ⇒ Boolean
readonly
Whether this leaf duplicates its sibling.
-
#hash ⇒ String?
readonly
32-byte hash (nil when duplicate).
-
#offset ⇒ Integer
readonly
Position index within the tree level.
-
#txid ⇒ Boolean
readonly
Whether this leaf is a transaction ID.
Instance Method Summary collapse
-
#initialize(offset:, hash: nil, txid: false, duplicate: false) ⇒ PathElement
constructor
A new instance of PathElement.
Constructor Details
#initialize(offset:, hash: nil, txid: false, duplicate: false) ⇒ PathElement
Returns a new instance of PathElement.
34 35 36 37 38 39 |
# File 'lib/bsv/transaction/merkle_path.rb', line 34 def initialize(offset:, hash: nil, txid: false, duplicate: false) @offset = offset @hash = hash @txid = txid @duplicate = duplicate end |
Instance Attribute Details
#duplicate ⇒ Boolean (readonly)
Returns whether this leaf duplicates its sibling.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/bsv/transaction/merkle_path.rb', line 27 class PathElement attr_reader :offset, :hash, :txid, :duplicate # @param offset [Integer] position index within the tree level # @param hash [String, nil] 32-byte hash (nil when duplicate) # @param txid [Boolean] whether this leaf is a transaction ID # @param duplicate [Boolean] whether this leaf duplicates its sibling def initialize(offset:, hash: nil, txid: false, duplicate: false) @offset = offset @hash = hash @txid = txid @duplicate = duplicate end end |
#hash ⇒ String? (readonly)
Returns 32-byte hash (nil when duplicate).
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/bsv/transaction/merkle_path.rb', line 27 class PathElement attr_reader :offset, :hash, :txid, :duplicate # @param offset [Integer] position index within the tree level # @param hash [String, nil] 32-byte hash (nil when duplicate) # @param txid [Boolean] whether this leaf is a transaction ID # @param duplicate [Boolean] whether this leaf duplicates its sibling def initialize(offset:, hash: nil, txid: false, duplicate: false) @offset = offset @hash = hash @txid = txid @duplicate = duplicate end end |
#offset ⇒ Integer (readonly)
Returns position index within the tree level.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/bsv/transaction/merkle_path.rb', line 27 class PathElement attr_reader :offset, :hash, :txid, :duplicate # @param offset [Integer] position index within the tree level # @param hash [String, nil] 32-byte hash (nil when duplicate) # @param txid [Boolean] whether this leaf is a transaction ID # @param duplicate [Boolean] whether this leaf duplicates its sibling def initialize(offset:, hash: nil, txid: false, duplicate: false) @offset = offset @hash = hash @txid = txid @duplicate = duplicate end end |
#txid ⇒ Boolean (readonly)
Returns whether this leaf is a transaction ID.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/bsv/transaction/merkle_path.rb', line 27 class PathElement attr_reader :offset, :hash, :txid, :duplicate # @param offset [Integer] position index within the tree level # @param hash [String, nil] 32-byte hash (nil when duplicate) # @param txid [Boolean] whether this leaf is a transaction ID # @param duplicate [Boolean] whether this leaf duplicates its sibling def initialize(offset:, hash: nil, txid: false, duplicate: false) @offset = offset @hash = hash @txid = txid @duplicate = duplicate end end |