btcruby 1.2.1 → 1.2.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 -1
- data/RELEASE_NOTES.md +6 -0
- data/lib/btcruby/script/p2sh_extension.rb +3 -0
- data/lib/btcruby/script/script_interpreter.rb +17 -7
- data/lib/btcruby/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: cefd4033ae3596836149bf235bb94b7f1b3d6963
|
4
|
+
data.tar.gz: 74ebe0b3428d48d91bda78772ec5c84743ce6723
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c268750c6b2707040f17dee13781809a8bd3e7a36241ceaa5027fe7bc24bfef4e8eec4a13db209fa49c23575550ad6edbfe27ca01591cc2a7d4c08065286c38f
|
7
|
+
data.tar.gz: 2c610aecba52ae7c9a5cf920e2aa6371b0950a1ee39afc95d9c78950a189273d2091c5c98f4cdadc74876b2178f83d5f0ab59a09e422f26ce7a501ef8a228bcf
|
data/README.md
CHANGED
data/RELEASE_NOTES.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
BTCRuby Release Notes
|
3
3
|
=====================
|
4
4
|
|
5
|
+
1.2.2 (November 12, 2015)
|
6
|
+
-----------------------
|
7
|
+
|
8
|
+
* Added support for inserting scripts during script execution in `BTC::ScriptInterpreter`.
|
9
|
+
|
10
|
+
|
5
11
|
1.2.1 (September 8, 2015)
|
6
12
|
-----------------------
|
7
13
|
|
@@ -25,6 +25,9 @@ module BTC
|
|
25
25
|
signature_script = @signature_script
|
26
26
|
@signature_script = nil
|
27
27
|
|
28
|
+
# NOTE: check for empty stack or "false" item happens
|
29
|
+
# in ScriptInterpreter before this callback is invoked.
|
30
|
+
|
28
31
|
# If output script is not P2SH, do nothing.
|
29
32
|
return true if !output_script.p2sh?
|
30
33
|
|
@@ -46,7 +46,7 @@ module BTC
|
|
46
46
|
integer_max_size: 4,
|
47
47
|
locktime_max_size: 5)
|
48
48
|
@flags = flags
|
49
|
-
@extensions
|
49
|
+
@extensions = extensions || []
|
50
50
|
@signature_checker = signature_checker
|
51
51
|
|
52
52
|
@raise_on_failure = raise_on_failure
|
@@ -142,7 +142,8 @@ module BTC
|
|
142
142
|
|
143
143
|
# Altstack is not shared between individual runs, but we still store it in ivar to make available to the extensions.
|
144
144
|
@altstack = []
|
145
|
-
|
145
|
+
@run_script_chunks = script.chunks.to_a.dup # can be modified by `insert_script`
|
146
|
+
|
146
147
|
number_zero = ScriptNumber.new(integer: 0)
|
147
148
|
number_one = ScriptNumber.new(integer: 1)
|
148
149
|
zero_value = "".b
|
@@ -153,8 +154,11 @@ module BTC
|
|
153
154
|
require_minimal = flag?(SCRIPT_VERIFY_MINIMALDATA)
|
154
155
|
condition_flags = []
|
155
156
|
index_after_codeseparator = 0
|
156
|
-
|
157
|
-
|
157
|
+
chunk_index = -1 # start with -1 because we increment it in the beginning of the loop.
|
158
|
+
|
159
|
+
while chunk = @run_script_chunks.shift
|
160
|
+
chunk_index += 1
|
161
|
+
|
158
162
|
opcode = chunk.opcode
|
159
163
|
should_execute = !condition_flags.include?(false)
|
160
164
|
|
@@ -652,8 +656,8 @@ module BTC
|
|
652
656
|
return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
|
653
657
|
end
|
654
658
|
|
655
|
-
sig
|
656
|
-
pubkey
|
659
|
+
sig = @stack[-2]
|
660
|
+
pubkey = @stack[-1]
|
657
661
|
|
658
662
|
# Subset of script starting at the most recent codeseparator
|
659
663
|
subscript = script.subscript(index_after_codeseparator..-1)
|
@@ -814,7 +818,13 @@ module BTC
|
|
814
818
|
rescue ScriptNumberError => e
|
815
819
|
return set_error(SCRIPT_ERR_UNKNOWN_ERROR, e.message)
|
816
820
|
end # run_script
|
817
|
-
|
821
|
+
|
822
|
+
|
823
|
+
# Inserts another script for execution within run_script call.
|
824
|
+
def insert_script(script)
|
825
|
+
@run_script_chunks = script.chunks.to_a + @run_script_chunks
|
826
|
+
end
|
827
|
+
|
818
828
|
|
819
829
|
def stack_pop
|
820
830
|
r = @stack.pop
|
data/lib/btcruby/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: btcruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleg Andreev
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-11-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi
|