blockchain-lite 1.3.0 → 1.3.1
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ccf43eee1725688110917d1fa4f252448b08c10f
|
4
|
+
data.tar.gz: 56476b389bcdf4abdb42b623485e303686f32f34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d069c0c8a7c2d58268cb2c56a5fae5126f36bd10f75238f3ccefdff32c90599467465c9683bc0c56e3d748f81e364d7b568b7b09a105faba34ee51f91fce3a9
|
7
|
+
data.tar.gz: c9d6579d3b24560fb709631b2682afd37ae8fd4af9bc8202db278011a4ca711ec836f37e61ea5932313ec6f5ecfb0163b9d672f8c48ba3d95166c694e5a1b094
|
@@ -38,25 +38,25 @@ class Block
|
|
38
38
|
|
39
39
|
|
40
40
|
|
41
|
-
def self.first( *
|
41
|
+
def self.first( *args ) # create genesis (big bang! first) block
|
42
42
|
## note: allow/support splat-* for now for convenience (auto-wraps args into array)
|
43
|
-
if
|
44
|
-
|
43
|
+
if args.size == 1 && args[0].is_a?( Array )
|
44
|
+
transactions = args[0] ## "unwrap" array in array
|
45
45
|
else
|
46
|
-
|
46
|
+
transactions = args ## use "auto-wrapped" splat array
|
47
47
|
end
|
48
48
|
## uses index zero (0) and arbitrary previous_hash ('0')
|
49
|
-
Block.new( 0,
|
49
|
+
Block.new( 0, transactions, '0' )
|
50
50
|
end
|
51
51
|
|
52
|
-
def self.next( previous, *
|
52
|
+
def self.next( previous, *args )
|
53
53
|
## note: allow/support splat-* for now for convenience (auto-wraps args into array)
|
54
|
-
if
|
55
|
-
|
54
|
+
if args.size == 1 && args[0].is_a?( Array )
|
55
|
+
transactions = args[0] ## "unwrap" array in array
|
56
56
|
else
|
57
|
-
|
57
|
+
transactions = args ## use "auto-wrapped" splat array
|
58
58
|
end
|
59
|
-
Block.new( previous.index+1,
|
59
|
+
Block.new( previous.index+1, transactions, previous.hash )
|
60
60
|
end
|
61
61
|
|
62
62
|
end # class Block
|
@@ -45,7 +45,7 @@ class Blockchain
|
|
45
45
|
## must be added by to make sure proper block_class is always used - why? why not??
|
46
46
|
|
47
47
|
def <<( arg )
|
48
|
-
if arg.is_a? Array ## assume its (just) data
|
48
|
+
if arg.is_a?( Array ) ## assume its (just) data
|
49
49
|
data = arg
|
50
50
|
bl = @chain.last
|
51
51
|
b = @block_class.next( bl, data )
|
@@ -45,26 +45,26 @@ class Block
|
|
45
45
|
|
46
46
|
|
47
47
|
|
48
|
-
def self.first( *
|
48
|
+
def self.first( *args, **opts ) # create genesis (big bang! first) block
|
49
49
|
## note: allow/support splat-* for now for convenience (auto-wraps args into array)
|
50
|
-
if
|
51
|
-
|
50
|
+
if args.size == 1 && args[0].is_a?( Array )
|
51
|
+
transactions = args[0] ## "unwrap" array in array
|
52
52
|
else
|
53
|
-
|
53
|
+
transactions = args ## use "auto-wrapped" splat array
|
54
54
|
end
|
55
55
|
## uses index zero (0) and arbitrary previous_hash ('0')
|
56
56
|
## note: pass along (optional) custom timestamp (e.g. used for 1637 etc.)
|
57
|
-
Block.new( 0,
|
57
|
+
Block.new( 0, transactions, '0', timestamp: opts[:timestamp] )
|
58
58
|
end
|
59
59
|
|
60
|
-
def self.next( previous, *
|
60
|
+
def self.next( previous, *args, **opts )
|
61
61
|
## note: allow/support splat-* for now for convenience (auto-wraps args into array)
|
62
|
-
if
|
63
|
-
|
62
|
+
if args.size == 1 && args[0].is_a?( Array )
|
63
|
+
transactions = args[0] ## "unwrap" array in array
|
64
64
|
else
|
65
|
-
|
65
|
+
transactions = args ## use "auto-wrapped" splat array
|
66
66
|
end
|
67
|
-
Block.new( previous.index+1,
|
67
|
+
Block.new( previous.index+1, transactions, previous.hash, timestamp: opts[:timestamp] )
|
68
68
|
end
|
69
69
|
|
70
70
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blockchain-lite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: merkletree
|