txcatcher 0.1.71 → 0.1.72

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 32240a798a402b144f746a22f3c4b7517fb3d15d
4
- data.tar.gz: 6cd3eb56cf193ad77a9113f8bd1d9ca7182201a4
3
+ metadata.gz: 74093f757ec54f54173a14105b6952219b8076b0
4
+ data.tar.gz: 9d38608c5c29a6f59ef90a441d16a5d529cc3a99
5
5
  SHA512:
6
- metadata.gz: 1972262b7cab9bab77026c886d34651d26a07bc721340626b72f027aaae071b7356ffc48593d4a196c7bb8871c8e88483c96e94d202e78121f2a67f484927875
7
- data.tar.gz: 3bb559675e35a04abbe349b6d12efdb5cae62aa0f04fba6f4abf8a3554df828b4241c72ef8e28804d52cd42441ad866d186cb707cf06a46102dfef38b890e283
6
+ metadata.gz: 42172fe4d2c92f3185e4e9e744429ed6f482d82df9e77436507029c658a5fb42b048b7324d2e581acc12fb1d8604f644eb60a13c3a057156ee1a364259bd6bdc
7
+ data.tar.gz: 81b97e896aa096bb02d554ffaba8425c4f750c4c16d7ca688d9d49d12aa29b5d6c545cdb7a9d0e479aa1e7586954e28346f87622393d19aede8ac2a7a6dafbc7
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.71
1
+ 0.1.72
@@ -17,6 +17,8 @@ module TxCatcher
17
17
  address(path)
18
18
  elsif path.start_with? "/tx/send"
19
19
  broadcast_tx(params["rawtx"])
20
+ elsif path.start_with? "/feerate"
21
+ feerate(params["blocks_target"] || 2)
20
22
  elsif path == "/" || path.empty?
21
23
  [200, {}, "TxCatcher server, #{TxCatcher::Config.rpcnode["name"]}, current_block_height: #{TxCatcher.current_block_height}"]
22
24
  else
@@ -78,6 +80,18 @@ module TxCatcher
78
80
  [200, {}, tx.to_json]
79
81
  end
80
82
 
83
+ def feerate(blocks_target)
84
+ result = TxCatcher.rpc_node.estimatesmartfee(blocks_target.to_i)
85
+
86
+ # This is for older versions of bitcoind/litecoind clients
87
+ if result.to_s.include?("error")
88
+ result = TxCatcher.rpc_node.estimatefee(blocks_target.to_i)
89
+ result = { "feerate" => result, "blocks" => blocks_target}
90
+ end
91
+
92
+ [200, {}, result["feerate"].to_s]
93
+ end
94
+
81
95
  end
82
96
 
83
97
  end
data/txcatcher.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: txcatcher 0.1.71 ruby lib
5
+ # stub: txcatcher 0.1.72 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "txcatcher"
9
- s.version = "0.1.71"
9
+ s.version = "0.1.72"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: txcatcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.71
4
+ version: 0.1.72
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Snitko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-13 00:00:00.000000000 Z
11
+ date: 2018-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: goliath