class Tapyrus::Message::CmpctBlock
cmpctblock message. support only version 1. github.com/bitcoin/bips/blob/master/bip-0152.mediawiki
Constants
- COMMAND
Attributes
header_and_short_ids[RW]
Public Class Methods
from_block(block, nonce = SecureRandom.hex(8).to_i(16))
click to toggle source
generate CmpctBlock
from Block
data. @param [Tapyrus::Block] block the block to generate CmpctBlock
. @param [Integer] nonce @return [Tapyrus::Message::CmpctBlock]
# File lib/tapyrus/message/cmpct_block.rb, line 18 def self.from_block(block, nonce = SecureRandom.hex(8).to_i(16)) h = HeaderAndShortIDs.new(block.header, nonce) block.transactions[1..-1].each { |tx| h.short_ids << h.short_id(tx.txid) } h.prefilled_txn << PrefilledTx.new(0, block.transactions.first) self.new(h) end
new(header_and_short_ids)
click to toggle source
# File lib/tapyrus/message/cmpct_block.rb, line 10 def initialize(header_and_short_ids) @header_and_short_ids = header_and_short_ids end
parse_from_payload(payload)
click to toggle source
# File lib/tapyrus/message/cmpct_block.rb, line 25 def self.parse_from_payload(payload) self.new(HeaderAndShortIDs.parse_from_payload(payload)) end
Public Instance Methods
to_payload()
click to toggle source
# File lib/tapyrus/message/cmpct_block.rb, line 29 def to_payload header_and_short_ids.to_payload end