txcatcher 0.1.7 → 0.1.8

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: 9c43d229ba733c395f0dbf5cac76eade727cb2a9
4
- data.tar.gz: fa0dd26fc337d4d6c94ed4c595655afa6fd2203a
3
+ metadata.gz: b6cac40db729a4877b1ac15405b50354360e3da0
4
+ data.tar.gz: 4cae9a975eede3fe04c7594a1ed02ea6060264a4
5
5
  SHA512:
6
- metadata.gz: 90682b9fba3a7f11d2a99cbdae37466382297012578ca83cec11d49e5fd706d03088afc29385835905a9d6840b3b54fa4777bddd4fc93a25b6d4b0a011d83a98
7
- data.tar.gz: 3d457be8d079ff1984bcb3fd300a5ba9b9e07d84fb1c28decc6097038982b1355be3fb92b836a3bd1b3f57403ddebfe46b8511168a09f01d37f0d0d800fc4b9b
6
+ metadata.gz: 2c49ea263e88f953ea1511cbf7709fe8988e6cf0504edd4eb70893df6c6b28cdad3bad1edb49e39f7cd3e53788347669b41a886bb0ed935c30f5b16d2bb92b88
7
+ data.tar.gz: c20d6feefdd431b05d44c04c0d9162d9815bcbec2adcd28465d559bae065530e2ef10ee5ab3f964d6f8b9c36e317139d1cf39317f3d03f4d092cce1cf396f3ab
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.7
1
+ 0.1.8
@@ -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
@@ -32,8 +34,8 @@ module TxCatcher
32
34
  if address
33
35
  transactions_ids = address.deposits.map { |d| d.transaction.txid }
34
36
  deposits = address.deposits.map do |d|
35
- t.update(protected: true) unless t.protected
36
37
  t = d.transaction
38
+ t.update(protected: true) unless t.protected
37
39
  t.update_block_height!
38
40
  {
39
41
  txid: t.txid,
@@ -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.7 ruby lib
5
+ # stub: txcatcher 0.1.8 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "txcatcher"
9
- s.version = "0.1.7"
9
+ s.version = "0.1.8"
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.7
4
+ version: 0.1.8
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