bitcoinrb 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/bitcoinrb.gemspec +1 -1
- data/lib/bitcoin/constants.rb +3 -3
- data/lib/bitcoin/out_point.rb +5 -0
- data/lib/bitcoin/script/script_interpreter.rb +1 -1
- data/lib/bitcoin/store.rb +1 -1
- data/lib/bitcoin/store/db/level_db.rb +2 -2
- data/lib/bitcoin/util.rb +12 -0
- data/lib/bitcoin/version.rb +1 -1
- data/lib/bitcoin/wallet/base.rb +1 -1
- data/lib/bitcoin/wallet/db.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df5d412165565c3dde3e626417f6a08e08d8698f66712c080b967f5d1e4e1688
|
4
|
+
data.tar.gz: 305d2ffba9338edfb26364da1d76ed166c1d2bbb253a2f3337db346a565247ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 171bd45d707d1d49398d1f272ee7559bc88b5df66a8a4c15afbc107eb9c631eb243c3fad3ec3073d455c8e6c49048ddcd0bedbe96cb4c06b6af7daaad9d31c20
|
7
|
+
data.tar.gz: ef995e0e5db4d6b7352de9f7efa7d97bd2a6c0de39c811e352595c89a6b79966ab50304b7e0059bc7c2afff1826a37c99748233f79956d1dca80a745d6aec888
|
data/README.md
CHANGED
@@ -36,10 +36,10 @@ If you use node features, please install level DB as follows.
|
|
36
36
|
|
37
37
|
$ brew install leveldb
|
38
38
|
|
39
|
-
and put `leveldb-
|
39
|
+
and put `leveldb-native` in your Gemfile and run bundle install.
|
40
40
|
|
41
41
|
```
|
42
|
-
gem leveldb-
|
42
|
+
gem leveldb-native
|
43
43
|
```
|
44
44
|
|
45
45
|
## Installation
|
data/bitcoinrb.gemspec
CHANGED
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
|
|
37
37
|
spec.add_runtime_dependency 'activesupport', '~> 5.2.3'
|
38
38
|
|
39
39
|
# for options
|
40
|
-
spec.add_development_dependency 'leveldb-
|
40
|
+
spec.add_development_dependency 'leveldb-native'
|
41
41
|
|
42
42
|
spec.add_development_dependency 'bundler'
|
43
43
|
spec.add_development_dependency 'rake', '~> 10.0'
|
data/lib/bitcoin/constants.rb
CHANGED
@@ -146,9 +146,9 @@ module Bitcoin
|
|
146
146
|
SCRIPT_ERR_SIG_HIGH_S = 54
|
147
147
|
SCRIPT_ERR_SIG_NULLDUMMY = 55
|
148
148
|
SCRIPT_ERR_PUBKEYTYPE = 56
|
149
|
-
SCRIPT_ERR_CLEANSTACK =
|
150
|
-
SCRIPT_ERR_MINIMALIF =
|
151
|
-
SCRIPT_ERR_SIG_NULLFAIL =
|
149
|
+
SCRIPT_ERR_CLEANSTACK = 57
|
150
|
+
SCRIPT_ERR_MINIMALIF = 58
|
151
|
+
SCRIPT_ERR_SIG_NULLFAIL = 59
|
152
152
|
|
153
153
|
# softfork safeness
|
154
154
|
SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS = 60
|
data/lib/bitcoin/out_point.rb
CHANGED
@@ -133,7 +133,7 @@ module Bitcoin
|
|
133
133
|
|
134
134
|
return false unless eval_script(script_pubkey, :witness_v0)
|
135
135
|
|
136
|
-
return set_error(
|
136
|
+
return set_error(SCRIPT_ERR_CLEANSTACK) unless stack.size == 1
|
137
137
|
return set_error(SCRIPT_ERR_EVAL_FALSE) unless cast_to_bool(stack.last)
|
138
138
|
true
|
139
139
|
end
|
data/lib/bitcoin/store.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'leveldb'
|
1
|
+
require 'leveldb-native'
|
2
2
|
|
3
3
|
module Bitcoin
|
4
4
|
module Store
|
@@ -12,7 +12,7 @@ module Bitcoin
|
|
12
12
|
def initialize(path = "#{Bitcoin.base_dir}/db/spv")
|
13
13
|
# @logger = Bitcoin::Logger.create(:debug)
|
14
14
|
FileUtils.mkdir_p(path)
|
15
|
-
@db = ::
|
15
|
+
@db = ::LevelDBNative::DB.new(path)
|
16
16
|
# logger.debug 'Opened LevelDB successfully.'
|
17
17
|
end
|
18
18
|
|
data/lib/bitcoin/util.rb
CHANGED
@@ -128,6 +128,18 @@ module Bitcoin
|
|
128
128
|
OpenSSL::HMAC.digest(DIGEST_NAME_SHA256, key, data)
|
129
129
|
end
|
130
130
|
|
131
|
+
# check whether +addr+ is valid address.
|
132
|
+
# @param [String] addr an address
|
133
|
+
# @return [Boolean] if valid address return true, otherwise false.
|
134
|
+
def valid_address?(addr)
|
135
|
+
begin
|
136
|
+
Bitcoin::Script.parse_from_addr(addr)
|
137
|
+
true
|
138
|
+
rescue Exception
|
139
|
+
false
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
131
143
|
end
|
132
144
|
|
133
145
|
end
|
data/lib/bitcoin/version.rb
CHANGED
data/lib/bitcoin/wallet/base.rb
CHANGED
data/lib/bitcoin/wallet/db.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bitcoinrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- azuchi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ecdsa
|
@@ -221,7 +221,7 @@ dependencies:
|
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: 5.2.3
|
223
223
|
- !ruby/object:Gem::Dependency
|
224
|
-
name: leveldb-
|
224
|
+
name: leveldb-native
|
225
225
|
requirement: !ruby/object:Gem::Requirement
|
226
226
|
requirements:
|
227
227
|
- - ">="
|