bc 0.1 → 0.1.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.
- data.tar.gz.sig +0 -0
- data/lib/bc.rb +19 -7
- metadata +4 -4
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/bc.rb
CHANGED
@@ -108,7 +108,7 @@ module Bitcoin
|
|
108
108
|
# It increases logarithmically in proportion to difficulty.
|
109
109
|
attr_reader :difficulty
|
110
110
|
|
111
|
-
# This is an Array of every Transaction
|
111
|
+
# This is an Array of every Transaction that is part of the block.
|
112
112
|
attr_reader :transactions
|
113
113
|
|
114
114
|
# This is a compact representation of the prefix this block was attempting
|
@@ -156,6 +156,8 @@ module Bitcoin
|
|
156
156
|
block_data[block_data_key.to_s].freeze
|
157
157
|
)
|
158
158
|
end
|
159
|
+
|
160
|
+
@transactions ||= [].freeze
|
159
161
|
end
|
160
162
|
|
161
163
|
# This is the Block created immediately after this one, or +nil+ if this is
|
@@ -588,16 +590,26 @@ module Bitcoin
|
|
588
590
|
@transactions[transaction_id] ||= Transaction.new(self, transaction_id)
|
589
591
|
end
|
590
592
|
|
591
|
-
#
|
592
|
-
# +block+
|
593
|
-
|
593
|
+
# Call the (Ruby) block passed for every transaction that has occurred since
|
594
|
+
# +block+ (which may be a Block, a block ID, or a block height). We return
|
595
|
+
# the last Block processed.
|
596
|
+
def each_transactions_since(block)
|
594
597
|
unless block.is_a?(Block)
|
595
598
|
block = get_block(block)
|
596
599
|
end
|
597
600
|
|
598
|
-
@jr.listsinceblock(block.block_id)
|
599
|
-
|
600
|
-
|
601
|
+
info = @jr.listsinceblock(block.block_id)
|
602
|
+
|
603
|
+
txes = info.fetch('transactions')
|
604
|
+
txes.map!{ |tx| tx.fetch('txid') }
|
605
|
+
txes.uniq!
|
606
|
+
|
607
|
+
txes.each do |txid|
|
608
|
+
transaction = get_transaction(txid)
|
609
|
+
yield(transaction)
|
610
|
+
end
|
611
|
+
|
612
|
+
get_block(info.fetch('lastblock'))
|
601
613
|
end
|
602
614
|
|
603
615
|
# Get an Array of every Transaction involving one of our addresses.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -54,7 +54,7 @@ date: 2012-03-05 00:00:00.000000000 Z
|
|
54
54
|
dependencies:
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: jr
|
57
|
-
requirement: &
|
57
|
+
requirement: &80146860 !ruby/object:Gem::Requirement
|
58
58
|
none: false
|
59
59
|
requirements:
|
60
60
|
- - ! '>='
|
@@ -62,7 +62,7 @@ dependencies:
|
|
62
62
|
version: '0'
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
|
-
version_requirements: *
|
65
|
+
version_requirements: *80146860
|
66
66
|
description: bc is a Ruby interface to bitcoind.
|
67
67
|
email: the.magical.kat@gmail.com
|
68
68
|
executables: []
|
@@ -95,6 +95,6 @@ rubyforge_project:
|
|
95
95
|
rubygems_version: 1.8.10
|
96
96
|
signing_key:
|
97
97
|
specification_version: 3
|
98
|
-
summary: Interface with
|
98
|
+
summary: Interface with bitcoind.
|
99
99
|
test_files: []
|
100
100
|
has_rdoc:
|
metadata.gz.sig
CHANGED
Binary file
|