txcatcher 0.1.92 → 0.1.93

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: d7db3d79b8553c6d6c0e10e7e5f948feaa99d533
4
- data.tar.gz: f991f5dedf6392f3cc0905a87d9be417e8164998
3
+ metadata.gz: a4736918a4d5ce4b459d1fe6b7c13599b761ae9a
4
+ data.tar.gz: d2c55d4de1e480a521b94e196e893a5e80107bf8
5
5
  SHA512:
6
- metadata.gz: 2d586ebaec43d73e0dcbb68606ddfc369aca3128f1a7efaebe17784dd87b10c86a80d34291a57a59ec430afe30d96876e9a4ac48e7b9fb31b96f2287a87cb393
7
- data.tar.gz: 928fe120265c415886a46a832fd1e527fa4db0fdde5a04eaf64478020107f2e1375fa8c158e38ad7b78941bfe694a3ce60fb5348cf21e7dd685542105d0307b5
6
+ metadata.gz: 844452261a87b9ebafc4e9b1989e0adcc0df7e199e0aa1dd6aed2bf6e12f736b455c36df6434066ec862f78f7a8f1f64ce1f62d9a80f1bead62f89cea70a4831
7
+ data.tar.gz: b2fa81ebe3a22f05e7f721284eb1498585b652039aef84f9f3fdac06072acfdfcd03636508760abadcc93dc9fff3d441d0a93883cc099f6388eed18345fb6043
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.92
1
+ 0.1.93
@@ -78,15 +78,34 @@ end
78
78
 
79
79
  def latest_output_addr(i=0)
80
80
 
81
- response = Faraday.get do |req|
82
- req.url TxCatcher::Config["monitor"]["blockchain_source_url"]
83
- req.options.timeout = 5
84
- req.options.open_timeout = 5
81
+ txs = nil
82
+ attempts = 0
83
+ until txs || attempts > 10
84
+ attempts += 1
85
+ begin
86
+ response = Faraday.get do |req|
87
+ req.url TxCatcher::Config["monitor"]["blockchain_source_url"]
88
+ req.options.timeout = 5
89
+ req.options.open_timeout = 5
90
+ end
91
+ rescue StandardError => e
92
+ LOGGER.report(e, :error, data: { attempt: attempts })
93
+ if attempts >= 10
94
+ send_alert(
95
+ "TxCatcher monitor error",
96
+ "Tried fetching new txs from #{TxCatcher::Config["monitor"]["blockchain_source_url"]}, got the following error\n\n" +
97
+ "#{e.to_s}\n\n#{e.backtrace.join("\n")}"
98
+ )
99
+ return nil
100
+ else
101
+ sleep 15
102
+ end
103
+ end
104
+ txs = JSON.parse(response.body) if response
85
105
  end
86
- txs = JSON.parse(response.body)
87
106
 
88
107
  txs.each do |tx|
89
- if tx["outputs"] && tx["outputs"][i]["addresses"]
108
+ if tx["outputs"] && tx["outputs"][i] && tx["outputs"][i]["addresses"]
90
109
  tx["outputs"][i]["addresses"].each do |addr|
91
110
  # Blockcypher returns old Litecoin P2SH addresses which start with 3, which
92
111
  # txcatcher doesn't support. Let's just ignore them.
@@ -127,6 +146,9 @@ response = nil
127
146
  attempts = 0
128
147
  addr = nil
129
148
  while attempts < 3 && (response.nil? || response.empty?)
149
+
150
+ url = TxCatcher::Config["monitor"]["txcatcher_url"] + "/addr/#{addr}/utxo"
151
+
130
152
  attempts += 1
131
153
  begin
132
154
 
@@ -134,11 +156,11 @@ while attempts < 3 && (response.nil? || response.empty?)
134
156
  addr_index = 0
135
157
  begin
136
158
  a = latest_output_addr(addr_index)
159
+ exit unless a # error already sent in latest_output_addr, so just exit.
137
160
  addr_index += 1
138
161
  end until addr != a || addr_index > 5
139
162
  addr = a
140
163
 
141
- url = TxCatcher::Config["monitor"]["txcatcher_url"] + "/addr/#{addr}/utxo"
142
164
  response = fetch_txcatcher_response(addr)
143
165
 
144
166
  if response.empty?
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.92 ruby lib
5
+ # stub: txcatcher 0.1.93 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "txcatcher".freeze
9
- s.version = "0.1.92"
9
+ s.version = "0.1.93"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
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.92
4
+ version: 0.1.93
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-04-25 00:00:00.000000000 Z
11
+ date: 2018-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: goliath