lib/bitcoin/protocol.rb in bitcoin-ruby-0.0.10 vs lib/bitcoin/protocol.rb in bitcoin-ruby-0.0.11
- old
+ new
@@ -11,19 +11,21 @@
MAX_INV_SZ = 50000
# BIP 0031, pong message, is enabled for all versions AFTER this one
BIP0031_VERSION = 60000
- autoload :TxIn, 'bitcoin/protocol/txin'
- autoload :TxOut, 'bitcoin/protocol/txout'
- autoload :Tx, 'bitcoin/protocol/tx'
- autoload :Block, 'bitcoin/protocol/block'
- autoload :Addr, 'bitcoin/protocol/address'
- autoload :Alert, 'bitcoin/protocol/alert'
- autoload :Reject, 'bitcoin/protocol/reject'
- autoload :Version, 'bitcoin/protocol/version'
- autoload :AuxPow, 'bitcoin/protocol/aux_pow'
+ autoload :ScriptWitness, 'bitcoin/protocol/script_witness'
+ autoload :TxIn, 'bitcoin/protocol/txin'
+ autoload :TxOut, 'bitcoin/protocol/txout'
+ autoload :Tx, 'bitcoin/protocol/tx'
+ autoload :Block, 'bitcoin/protocol/block'
+ autoload :Addr, 'bitcoin/protocol/address'
+ autoload :Alert, 'bitcoin/protocol/alert'
+ autoload :Reject, 'bitcoin/protocol/reject'
+ autoload :Version, 'bitcoin/protocol/version'
+ autoload :AuxPow, 'bitcoin/protocol/aux_pow'
+ autoload :PartialMerkleTree, 'bitcoin/protocol/partial_merkle_tree'
autoload :Handler, 'bitcoin/protocol/handler'
autoload :Parser, 'bitcoin/protocol/parser'
Uniq = rand(0xffffffffffffffff)
@@ -139,11 +141,11 @@
def self.verack_pkt
pkt("verack", "")
end
- TypeLookup = Hash[:tx, 1, :block, 2, nil, 0]
+ TypeLookup = Hash[:tx, 1, :block, 2, :filtered_block, 3, nil, 0]
def self.getdata_pkt(type, hashes)
return if hashes.size > MAX_INV_SZ
t = [ TypeLookup[type] ].pack("V")
pkt("getdata", pack_var_int(hashes.size) + hashes.map{|hash| t + hash[0..32].reverse }.join)
@@ -156,10 +158,10 @@
end
DEFAULT_STOP_HASH = "00"*32
def self.locator_payload(version, locator_hashes, stop_hash)
- payload = [
+ [
[version].pack("V"),
pack_var_int(locator_hashes.size),
locator_hashes.map{|l| l.htb_reverse }.join,
stop_hash.htb_reverse
].join