bitcoin2graphdb 0.2.8 → 0.2.9

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: 1a25d7c3e0df7e46dea42c3679d604d70f70ae69
4
- data.tar.gz: 0cf2fbe186da4cba65663b85676a64fd36393a95
3
+ metadata.gz: 854f7412869212c2bb0dbc2f8047e726549d4eae
4
+ data.tar.gz: 3f8ee5b4fa09baec2983899e13446d707eb36bc0
5
5
  SHA512:
6
- metadata.gz: 68db0c05c3a3ddcf9c3c9a699d42ad8bfe2c0d4372b6342a50c89efbf044fb9ba92ebc88d8125f0fe64814085401a9030d10a788679efa03254c8ca83454c4c1
7
- data.tar.gz: 53f05da93364eb9023cbef6a36a98b862d2fc06f068050da85dbaf23df7bfd1a34a543ce878c2103be56b5fca38373ff7da8e091a4018008685eee037f112b7d
6
+ metadata.gz: 7d743166100b6e74aea5df416eecc80362dc269353f10e9f979eea1e9618edb25925f18fbcff1c3befdf7b9c7673ad12c31474a12f201fc78263b342727cad6e
7
+ data.tar.gz: 19186986c5b135664350ce0b9d4227a6bb49530d14cfc3aa152c7518493a3126a4e4bf4114eb4a437f2d3d1b29570f6cd753f66809e02e165ffbe518ac65aa54
data/README.md CHANGED
@@ -47,6 +47,10 @@ bitcoin2graphdb:
47
47
  basic_auth:
48
48
  username: 'neo4j username'
49
49
  password: 'neo4j password'
50
+ initialize:
51
+ request:
52
+ timeout: 600
53
+ open_timeout: 2
50
54
  ```
51
55
 
52
56
  ## Usage
@@ -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: {request: {timeout: 600, open_timeout: 5}}}
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
@@ -1,3 +1,3 @@
1
1
  module Bitcoin2Graphdb
2
- VERSION = "0.2.8"
2
+ VERSION = "0.2.9"
3
3
  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.8
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-23 00:00:00.000000000 Z
11
+ date: 2016-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: openassets-ruby