Class: Bitcoin::Message::SendTxRcncl

Inherits:
Base
  • Object
show all
Includes:
Schnorr::Util
Defined in:
lib/bitcoin/message/send_tx_rcncl.rb

Overview

Constant Summary collapse

COMMAND =
'sendtxrcncl'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

from_pkt, #to_pkt

Methods included from Util

#byte_to_bit, #calc_checksum, #decode_base58_address, #double_sha256, #encode_base58_address, #hash160, #hkdf_sha256, #hmac_sha256, #pack_boolean, #pack_var_int, #pack_var_string, #padding_zero, #sha256, #tagged_hash, #unpack_boolean, #unpack_var_int, #unpack_var_int_from_io, #unpack_var_string, #valid_address?

Methods included from HexConverter

#to_hex

Constructor Details

#initialize(version, salt) ⇒ SendTxRcncl

Returns a new instance of SendTxRcncl.

Parameters:

Raises:

  • (ArgumentError)


14
15
16
17
18
19
20
21
22
# File 'lib/bitcoin/message/send_tx_rcncl.rb', line 14

def initialize(version, salt)
  raise ArgumentError, "version must be integer." unless version.is_a?(Integer)
  raise ArgumentError, "salt must be integer." unless salt.is_a?(Integer)
  raise ArgumentError, "version must be positive number." unless version > 0
  raise ArgumentError, "version is out of range." if version < 0 || version > 0xffffffff
  raise ArgumentError, "salt is out of range." if salt < 0 || salt > 0xffffffffffffffff
  @version = version
  @salt = salt
end

Instance Attribute Details

#saltObject (readonly)

Returns the value of attribute salt.



10
11
12
# File 'lib/bitcoin/message/send_tx_rcncl.rb', line 10

def salt
  @salt
end

#versionObject (readonly)

Returns the value of attribute version.



9
10
11
# File 'lib/bitcoin/message/send_tx_rcncl.rb', line 9

def version
  @version
end

Class Method Details

.parse_from_payload(payload) ⇒ Object



24
25
26
27
28
# File 'lib/bitcoin/message/send_tx_rcncl.rb', line 24

def self.parse_from_payload(payload)
  buf = StringIO.new(payload)
  version, salt = buf.read(16).unpack('VQ<')
  SendTxRcncl.new(version, salt)
end

Instance Method Details

#to_payloadObject



30
31
32
# File 'lib/bitcoin/message/send_tx_rcncl.rb', line 30

def to_payload
  [version, salt].pack('VQ<')
end