txcatcher 0.1.82 → 0.1.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +2 -2
- data/VERSION +1 -1
- data/lib/txcatcher/catcher.rb +2 -3
- data/lib/txcatcher/models/address.rb +1 -1
- data/lib/txcatcher/models/deposit.rb +1 -1
- data/lib/txcatcher/models/transaction.rb +1 -1
- data/lib/txcatcher/utils/crypto_unit.rb +15 -0
- data/lib/txcatcher.rb +2 -1
- data/spec/config/config.yml.sample +3 -4
- data/spec/spec_helper.rb +2 -1
- data/templates/config.yml +1 -0
- data/txcatcher.gemspec +2 -2
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c2490c3456737004783bc9d04fb086c0c13cabe5
|
|
4
|
+
data.tar.gz: 813de1fef0f9d0c28e5dbdcf227bab4ead700c24
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2ed2e03aee0673dc2a44774d7d4bd49d71ec70f9f6c60fca564bcb91d5a956ae730802deb208c55e16bf74f9a45c39c507b93f0088e2411f034c946fdcf6ff32
|
|
7
|
+
data.tar.gz: c420a2f8c1276a6379448a79461b7c181884cb7512ce29c0d8f0ddabe90083ac9e409cb3998c92292c646640213230eba9e596f5b069c6f911009326d0c4a084
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -5,6 +5,7 @@ GEM
|
|
|
5
5
|
async-rack (0.5.1)
|
|
6
6
|
rack (~> 1.1)
|
|
7
7
|
builder (3.2.3)
|
|
8
|
+
crypto-unit (0.3.3)
|
|
8
9
|
descendants_tracker (0.0.4)
|
|
9
10
|
thread_safe (~> 0.3, >= 0.3.1)
|
|
10
11
|
diff-lcs (1.3)
|
|
@@ -93,7 +94,6 @@ GEM
|
|
|
93
94
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
94
95
|
rspec-support (~> 3.7.0)
|
|
95
96
|
rspec-support (3.7.1)
|
|
96
|
-
satoshi-unit (0.2.2)
|
|
97
97
|
semver2 (3.4.2)
|
|
98
98
|
sentry-raven (2.6.3)
|
|
99
99
|
faraday (>= 0.7.6, < 1.0)
|
|
@@ -106,11 +106,11 @@ PLATFORMS
|
|
|
106
106
|
|
|
107
107
|
DEPENDENCIES
|
|
108
108
|
bundler
|
|
109
|
+
crypto-unit
|
|
109
110
|
ffi-rzmq
|
|
110
111
|
goliath
|
|
111
112
|
jeweler
|
|
112
113
|
rspec
|
|
113
|
-
satoshi-unit
|
|
114
114
|
sentry-raven
|
|
115
115
|
sequel
|
|
116
116
|
sqlite3
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.83
|
data/lib/txcatcher/catcher.rb
CHANGED
|
@@ -40,7 +40,7 @@ module TxCatcher
|
|
|
40
40
|
@queue[channel].pop.call
|
|
41
41
|
rescue Sequel::ValidationFailed => e
|
|
42
42
|
Logger.report e, :warn, timestamp: true
|
|
43
|
-
rescue
|
|
43
|
+
rescue Exception => e
|
|
44
44
|
Logger.report e, :error, timestamp: true
|
|
45
45
|
end
|
|
46
46
|
end
|
|
@@ -76,13 +76,12 @@ module TxCatcher
|
|
|
76
76
|
|
|
77
77
|
def handle_rawtx(txhex)
|
|
78
78
|
Logger.report "received tx hex: #{txhex[0..50]}..."
|
|
79
|
-
|
|
80
79
|
@queue["rawtx"] << ( Proc.new {
|
|
81
80
|
tx = TxCatcher::Transaction.new(hex: txhex)
|
|
82
81
|
tx.save
|
|
83
82
|
Logger.report "tx #{tx.txid} saved (id: #{tx.id}), deposits (outputs):"
|
|
84
83
|
tx.deposits.each do |d|
|
|
85
|
-
Logger.report " id: #{d.id}, addr: #{d.address.address}, amount: #{
|
|
84
|
+
Logger.report " id: #{d.id}, addr: #{d.address.address}, amount: #{CryptoUnit.new(Config["currency"], d.amount, from_unit: :primary).to_standart}"
|
|
86
85
|
end
|
|
87
86
|
})
|
|
88
87
|
end
|
|
@@ -10,7 +10,7 @@ module TxCatcher
|
|
|
10
10
|
parse_transaction
|
|
11
11
|
assign_transaction_attrs
|
|
12
12
|
@tx_hash["vout"].uniq { |out| out["n"] }.each do |out|
|
|
13
|
-
amount =
|
|
13
|
+
amount = CryptoUnit.new(Config["currency"], out["value"], from_unit: :standart).to_i if out["value"]
|
|
14
14
|
address = out["scriptPubKey"]["addresses"]&.first
|
|
15
15
|
# Do not create a new deposit unless it actually makes sense to create one
|
|
16
16
|
if address && amount && amount > 0
|
data/lib/txcatcher.rb
CHANGED
|
@@ -2,11 +2,12 @@ require 'rubygems'
|
|
|
2
2
|
require 'yaml'
|
|
3
3
|
require 'json'
|
|
4
4
|
require 'thread'
|
|
5
|
-
require '
|
|
5
|
+
require 'crypto-unit'
|
|
6
6
|
require 'sequel'
|
|
7
7
|
require 'sentry-raven'
|
|
8
8
|
Sequel.extension :migration
|
|
9
9
|
|
|
10
|
+
require_relative 'txcatcher/utils/crypto_unit'
|
|
10
11
|
require_relative 'txcatcher/utils/hash_string_to_sym_keys'
|
|
11
12
|
require_relative 'txcatcher/bitcoin_rpc'
|
|
12
13
|
require_relative 'txcatcher/config'
|
|
@@ -22,12 +22,11 @@ logger:
|
|
|
22
22
|
stdout_level: info
|
|
23
23
|
logfile_level: info
|
|
24
24
|
sentry_level: info
|
|
25
|
-
|
|
26
|
-
dsn: null
|
|
27
|
-
client_dsn: null
|
|
25
|
+
sentry_dsn: null
|
|
28
26
|
|
|
29
|
-
|
|
27
|
+
zeromq: bitcoind
|
|
30
28
|
max_db_transactions_stored: 10
|
|
31
29
|
db_clean_period_seconds: 300
|
|
32
30
|
protected_transactions: true
|
|
33
31
|
environment: development
|
|
32
|
+
currency: bitcoin
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require 'rubygems'
|
|
2
2
|
require 'yaml'
|
|
3
3
|
require 'json'
|
|
4
|
-
require '
|
|
4
|
+
require 'crypto-unit'
|
|
5
5
|
require 'sequel'
|
|
6
6
|
require 'sentry-raven'
|
|
7
7
|
Sequel.extension :migration
|
|
@@ -11,6 +11,7 @@ File.delete(db_file) if File.exists?(db_file)
|
|
|
11
11
|
|
|
12
12
|
require_relative '../lib/txcatcher/logger'
|
|
13
13
|
require_relative '../lib/txcatcher/utils/hash_string_to_sym_keys'
|
|
14
|
+
require_relative '../lib/txcatcher/utils/crypto_unit'
|
|
14
15
|
require_relative '../lib/txcatcher/config'
|
|
15
16
|
require_relative '../lib/txcatcher/initializer'
|
|
16
17
|
require_relative '../lib/txcatcher/bitcoin_rpc'
|
data/templates/config.yml
CHANGED
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.83 ruby lib
|
|
6
6
|
|
|
7
7
|
Gem::Specification.new do |s|
|
|
8
8
|
s.name = "txcatcher"
|
|
9
|
-
s.version = "0.1.
|
|
9
|
+
s.version = "0.1.83"
|
|
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.
|
|
4
|
+
version: 0.1.83
|
|
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-03-
|
|
11
|
+
date: 2018-03-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: goliath
|
|
@@ -53,7 +53,7 @@ dependencies:
|
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '0'
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
|
-
name:
|
|
56
|
+
name: crypto-unit
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
59
|
- - ">="
|
|
@@ -149,6 +149,7 @@ files:
|
|
|
149
149
|
- lib/txcatcher/models/deposit.rb
|
|
150
150
|
- lib/txcatcher/models/transaction.rb
|
|
151
151
|
- lib/txcatcher/server.rb
|
|
152
|
+
- lib/txcatcher/utils/crypto_unit.rb
|
|
152
153
|
- lib/txcatcher/utils/hash_string_to_sym_keys.rb
|
|
153
154
|
- spec/catcher_spec.rb
|
|
154
155
|
- spec/cleaner_spec.rb
|