glueby 0.10.1 → 0.10.2
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71dfd0cca2e922f07b29b4839be2f7cff8c71f587ff043bb05eee6d8cac3435e
|
4
|
+
data.tar.gz: f3b4b8864d75be7eccad66c402bb56693949ade3c7dfa1b21e3f5abc5c6391b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 831aaf50ea027c47450ad167721b441a6253b9c439d1608179f7c0bf9244eaa5cc8bc5a1fc916b31411616389e4750ecdda9cda0497479b6810e8fba134a0fd8
|
7
|
+
data.tar.gz: 4f078178c9874c00e1ce36e11c13b7813972880ecfc3f7c8ee686040012b6e8ce0038376f2ec808027a99c3beb377e7a5e7493c2f78577533ed11403cd2928e9
|
@@ -11,6 +11,9 @@ module Glueby
|
|
11
11
|
|
12
12
|
belongs_to :prev, class_name: 'Glueby::Contract::AR::Timestamp', optional: true
|
13
13
|
|
14
|
+
validates :prev, uniqueness: true, allow_nil: true
|
15
|
+
validate :validate_prev
|
16
|
+
|
14
17
|
class << self
|
15
18
|
def digest_content(content, digest)
|
16
19
|
case digest&.downcase
|
@@ -130,17 +133,7 @@ module Glueby
|
|
130
133
|
builder = builder_class.new(wallet, fee_estimator)
|
131
134
|
|
132
135
|
if builder.instance_of?(Contract::Timestamp::TxBuilder::UpdatingTrackable)
|
133
|
-
|
134
|
-
message = "The previous timestamp(id: #{prev_id}) not found."
|
135
|
-
errors.add(:prev_id, message)
|
136
|
-
raise Errors::PrevTimestampNotFound, message
|
137
|
-
end
|
138
|
-
|
139
|
-
unless prev.trackable?
|
140
|
-
message = "The previous timestamp(id: #{prev_id}) type must be trackable"
|
141
|
-
errors.add(:prev_id, message)
|
142
|
-
raise Errors::PrevTimestampIsNotTrackable, message
|
143
|
-
end
|
136
|
+
validate_prev!
|
144
137
|
|
145
138
|
builder.set_prev_timestamp_info(
|
146
139
|
timestamp_utxo: prev.utxo,
|
@@ -177,6 +170,37 @@ module Glueby
|
|
177
170
|
def update_trackable?
|
178
171
|
trackable? && prev_id
|
179
172
|
end
|
173
|
+
|
174
|
+
def validate_prev
|
175
|
+
validate_prev!
|
176
|
+
true
|
177
|
+
rescue Errors::PrevTimestampNotFound,
|
178
|
+
Errors::PrevTimestampIsNotTrackable,
|
179
|
+
Errors::UnnecessaryPrevTimestamp
|
180
|
+
false
|
181
|
+
end
|
182
|
+
|
183
|
+
def validate_prev!
|
184
|
+
if simple? && prev_id
|
185
|
+
message = "The previous timestamp(id: #{prev_id}) must be nil in simple timestamp"
|
186
|
+
errors.add(:prev_id, message)
|
187
|
+
raise Errors::UnnecessaryPrevTimestamp, message
|
188
|
+
end
|
189
|
+
|
190
|
+
return unless update_trackable?
|
191
|
+
|
192
|
+
unless prev
|
193
|
+
message = "The previous timestamp(id: #{prev_id}) not found."
|
194
|
+
errors.add(:prev_id, message)
|
195
|
+
raise Errors::PrevTimestampNotFound, message
|
196
|
+
end
|
197
|
+
|
198
|
+
unless prev.trackable?
|
199
|
+
message = "The previous timestamp(id: #{prev_id}) type must be trackable"
|
200
|
+
errors.add(:prev_id, message)
|
201
|
+
raise Errors::PrevTimestampIsNotTrackable, message
|
202
|
+
end
|
203
|
+
end
|
180
204
|
end
|
181
205
|
end
|
182
206
|
end
|
@@ -20,7 +20,7 @@ module Glueby
|
|
20
20
|
tx.inputs.each.with_index do |input, index|
|
21
21
|
script_pubkey = script_for_input(input, prevtxs)
|
22
22
|
next unless script_pubkey
|
23
|
-
key =
|
23
|
+
key = keys.key_for_script(script_pubkey)
|
24
24
|
next unless key
|
25
25
|
sign_tx_for_p2pkh(tx, index, key, script_pubkey, sighashtype)
|
26
26
|
end
|
data/lib/glueby/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glueby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- azuchi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tapyrus
|