lib/tapyrus/rpc/request_handler.rb in tapyrus-0.3.4 vs lib/tapyrus/rpc/request_handler.rb in tapyrus-0.3.5
- old
+ new
@@ -21,17 +21,17 @@
# get block header information.
# @param [String] block_id block hash(big endian)
def getblockheader(block_id, verbose)
block_hash = block_id.rhex
entry = node.chain.find_entry_by_hash(block_hash)
- raise ArgumentError.new('Block not found') unless entry
+ raise ArgumentError.new("Block not found") unless entry
if verbose
{
hash: block_id,
height: entry.height,
features: entry.header.features,
- featuresHex: entry.header.features.to_even_length_hex.ljust(8, '0'),
+ featuresHex: entry.header.features.to_even_length_hex.ljust(8, "0"),
merkleroot: entry.header.merkle_root.rhex,
immutablemerkleroot: entry.header.im_merkle_root.rhex,
time: entry.header.time,
mediantime: node.chain.mtp(block_hash),
xfield_type: entry.header.x_field_type,
@@ -51,11 +51,11 @@
local_addr = "#{peer.remote_version.remote_addr.ip}:18333"
{
id: peer.id,
addr: "#{peer.host}:#{peer.port}",
addrlocal: local_addr,
- services: peer.remote_version.services.to_even_length_hex.rjust(16, '0'),
+ services: peer.remote_version.services.to_even_length_hex.rjust(16, "0"),
relaytxes: peer.remote_version.relay,
lastsend: peer.last_send,
lastrecv: peer.last_recv,
bytessent: peer.bytes_sent,
bytesrecv: peer.bytes_recv,
@@ -84,11 +84,11 @@
# decode tx data.
def decoderawtransaction(hex_tx)
begin
Tapyrus::Tx.parse_from_payload(hex_tx.htb).to_h
rescue Exception
- raise ArgumentError.new('TX decode failed')
+ raise ArgumentError.new("TX decode failed")
end
end
# decode script data.
def decodescript(hex_script)
@@ -97,10 +97,10 @@
h = script.to_h
h.delete(:hex)
h[:p2sh] = script.to_p2sh.to_addr unless script.p2sh?
h
rescue Exception
- raise ArgumentError.new('Script decode failed')
+ raise ArgumentError.new("Script decode failed")
end
end
# wallet api