bitcoin2graphdb 0.2.8 → 0.2.9
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/README.md +4 -0
- data/lib/bitcoin2graphdb/migration.rb +32 -1
- data/lib/bitcoin2graphdb/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 854f7412869212c2bb0dbc2f8047e726549d4eae
|
4
|
+
data.tar.gz: 3f8ee5b4fa09baec2983899e13446d707eb36bc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d743166100b6e74aea5df416eecc80362dc269353f10e9f979eea1e9618edb25925f18fbcff1c3befdf7b9c7673ad12c31474a12f201fc78263b342727cad6e
|
7
|
+
data.tar.gz: 19186986c5b135664350ce0b9d4227a6bb49530d14cfc3aa152c7518493a3126a4e4bf4114eb4a437f2d3d1b29570f6cd753f66809e02e165ffbe518ac65aa54
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@ module Bitcoin2Graphdb
|
|
9
9
|
c.neo4j_server = config[:neo4j][:server]
|
10
10
|
c.extensions = config[:extensions] unless config[:extensions].nil?
|
11
11
|
end
|
12
|
-
neo4j_config = {basic_auth: config[:neo4j][:basic_auth], initialize:
|
12
|
+
neo4j_config = {basic_auth: config[:neo4j][:basic_auth], initialize: neo4j_timeout_ops(config)}
|
13
13
|
Bitcoin2Graphdb::Bitcoin.provider = Bitcoin2Graphdb::Bitcoin::BlockchainProvider.new(config[:bitcoin])
|
14
14
|
Neo4j::Session.open(:server_db, config[:neo4j][:server], neo4j_config)
|
15
15
|
@sleep_interval = config[:bitcoin][:sleep_interval].nil? ? 600 : config[:bitcoin][:sleep_interval].to_i
|
@@ -40,6 +40,29 @@ module Bitcoin2Graphdb
|
|
40
40
|
puts "end migration for block height #{block_height}. #{Time.now}"
|
41
41
|
end
|
42
42
|
|
43
|
+
def repair_assign_txs(block_height)
|
44
|
+
Neo4j::Transaction.run do |tx|
|
45
|
+
begin
|
46
|
+
block = Graphdb::Model::Block.with_height(block_height).first
|
47
|
+
if block
|
48
|
+
hash = Bitcoin2Graphdb::Bitcoin.provider.block(block.block_hash)
|
49
|
+
tx_list = block.transactions.to_a
|
50
|
+
hash['tx'].each do |txid|
|
51
|
+
target = tx_list.find{|t|t.txid == txid}
|
52
|
+
if target.nil?
|
53
|
+
block.transactions << Graphdb::Model::Transaction.with_txid(txid).first
|
54
|
+
puts "repair tx = #{txid}"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
block.save!
|
58
|
+
end
|
59
|
+
rescue => e
|
60
|
+
tx.failure
|
61
|
+
raise e
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
43
66
|
def remove_block(block_height)
|
44
67
|
Neo4j::Transaction.run do |tx|
|
45
68
|
begin
|
@@ -98,5 +121,13 @@ module Bitcoin2Graphdb
|
|
98
121
|
@block_height = block.nil? ? -1 : block.height
|
99
122
|
end
|
100
123
|
|
124
|
+
def neo4j_timeout_ops(config)
|
125
|
+
if config[:neo4j][:initialize]
|
126
|
+
config[:neo4j][:initialize]
|
127
|
+
else
|
128
|
+
{request: {timeout: 600, open_timeout: 2}}
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
101
132
|
end
|
102
133
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bitcoin2graphdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- azuchi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: openassets-ruby
|