Add Message#cmd_sym as a convenience method
This commit is contained in:
@@ -398,6 +398,11 @@ module BtcWireProto
|
||||
uint32 :payload_len
|
||||
uint32 :checksum, :onlyif => :has_checksum?
|
||||
|
||||
def cmd_sym
|
||||
c = command.strip
|
||||
c == "" ? nil : c.to_sym
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
# version and verack messages don't have a checksum. The rest do.
|
||||
@@ -421,6 +426,10 @@ module BtcWireProto
|
||||
|
||||
message_hdr :header
|
||||
|
||||
def cmd_sym
|
||||
header ? header.cmd_sym : nil
|
||||
end
|
||||
|
||||
choice :payload, :selection => :payload_choice do
|
||||
version "version"
|
||||
addr_pre31402 "addr_pre31402"
|
||||
|
Reference in New Issue
Block a user