txcatcher 0.1.91 → 0.1.92
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/bin/txcatcher-monitor +14 -6
- data/db/schema.rb +9 -13
- data/txcatcher.gemspec +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7db3d79b8553c6d6c0e10e7e5f948feaa99d533
|
4
|
+
data.tar.gz: f991f5dedf6392f3cc0905a87d9be417e8164998
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d586ebaec43d73e0dcbb68606ddfc369aca3128f1a7efaebe17784dd87b10c86a80d34291a57a59ec430afe30d96876e9a4ac48e7b9fb31b96f2287a87cb393
|
7
|
+
data.tar.gz: 928fe120265c415886a46a832fd1e527fa4db0fdde5a04eaf64478020107f2e1375fa8c158e38ad7b78941bfe694a3ce60fb5348cf21e7dd685542105d0307b5
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.92
|
data/bin/txcatcher-monitor
CHANGED
@@ -76,7 +76,7 @@ def send_alert(subject, text)
|
|
76
76
|
|
77
77
|
end
|
78
78
|
|
79
|
-
def latest_output_addr
|
79
|
+
def latest_output_addr(i=0)
|
80
80
|
|
81
81
|
response = Faraday.get do |req|
|
82
82
|
req.url TxCatcher::Config["monitor"]["blockchain_source_url"]
|
@@ -86,8 +86,8 @@ def latest_output_addr
|
|
86
86
|
txs = JSON.parse(response.body)
|
87
87
|
|
88
88
|
txs.each do |tx|
|
89
|
-
if tx["outputs"] && tx["outputs"]
|
90
|
-
tx["outputs"]
|
89
|
+
if tx["outputs"] && tx["outputs"][i]["addresses"]
|
90
|
+
tx["outputs"][i]["addresses"].each do |addr|
|
91
91
|
# Blockcypher returns old Litecoin P2SH addresses which start with 3, which
|
92
92
|
# txcatcher doesn't support. Let's just ignore them.
|
93
93
|
if addr[0] != "3" || !TxCatcher::Config["monitor"]["ignore_3_litecoin_addr"]
|
@@ -125,13 +125,21 @@ read_config_file
|
|
125
125
|
|
126
126
|
response = nil
|
127
127
|
attempts = 0
|
128
|
+
addr = nil
|
128
129
|
while attempts < 3 && (response.nil? || response.empty?)
|
129
130
|
attempts += 1
|
130
131
|
begin
|
131
132
|
|
132
|
-
|
133
|
-
|
133
|
+
# if address is the same as in the previous attempt, let's try a different address.
|
134
|
+
addr_index = 0
|
135
|
+
begin
|
136
|
+
a = latest_output_addr(addr_index)
|
137
|
+
addr_index += 1
|
138
|
+
end until addr != a || addr_index > 5
|
139
|
+
addr = a
|
140
|
+
|
134
141
|
url = TxCatcher::Config["monitor"]["txcatcher_url"] + "/addr/#{addr}/utxo"
|
142
|
+
response = fetch_txcatcher_response(addr)
|
135
143
|
|
136
144
|
if response.empty?
|
137
145
|
LOGGER.report("Checked #{url}, got empty response, attempt #{attempts}", :error)
|
@@ -147,7 +155,7 @@ while attempts < 3 && (response.nil? || response.empty?)
|
|
147
155
|
if attempts >= 3
|
148
156
|
send_alert(
|
149
157
|
"TxCatcher monitor error",
|
150
|
-
"While checking #{
|
158
|
+
"While checking #{url} response, got the following error\n\n" +
|
151
159
|
"#{e.to_s}\n\n#{e.backtrace.join("\n")}"
|
152
160
|
)
|
153
161
|
else
|
data/db/schema.rb
CHANGED
@@ -1,16 +1,14 @@
|
|
1
1
|
Sequel.migration do
|
2
2
|
change do
|
3
|
-
create_table(:addresses
|
4
|
-
|
5
|
-
String :address, :size=>255
|
6
|
-
Integer :received, :default=>0
|
3
|
+
create_table(:addresses) do
|
4
|
+
String :address, :size=>255, :null=>false
|
7
5
|
|
8
|
-
|
6
|
+
primary_key [:address]
|
9
7
|
end
|
10
8
|
|
11
9
|
create_table(:deposits, :ignore_index_errors=>true) do
|
12
10
|
primary_key :id
|
13
|
-
|
11
|
+
Bignum :amount, :null=>false
|
14
12
|
Integer :transaction_id
|
15
13
|
Integer :address_id
|
16
14
|
|
@@ -22,14 +20,12 @@ Sequel.migration do
|
|
22
20
|
Integer :version, :default=>0, :null=>false
|
23
21
|
end
|
24
22
|
|
25
|
-
create_table(:transactions
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
Integer :amount
|
30
|
-
Integer :block_height
|
23
|
+
create_table(:transactions) do
|
24
|
+
String :txid, :size=>255, :null=>false
|
25
|
+
DateTime :created_at
|
26
|
+
TrueClass :protected, :default=>false
|
31
27
|
|
32
|
-
|
28
|
+
primary_key [:txid]
|
33
29
|
end
|
34
30
|
end
|
35
31
|
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.
|
5
|
+
# stub: txcatcher 0.1.92 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "txcatcher".freeze
|
9
|
-
s.version = "0.1.
|
9
|
+
s.version = "0.1.92"
|
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.
|
4
|
+
version: 0.1.92
|
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-
|
11
|
+
date: 2018-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: goliath
|
@@ -208,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
208
|
version: '0'
|
209
209
|
requirements: []
|
210
210
|
rubyforge_project:
|
211
|
-
rubygems_version: 2.6.
|
211
|
+
rubygems_version: 2.6.14
|
212
212
|
signing_key:
|
213
213
|
specification_version: 4
|
214
214
|
summary: An lightweight version of Bitpay's Insight, allows to check Bitcoin/Litecoin
|