bigchaindb 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bigchaindb.rb +5 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42f74581b7a25c7fdd69625ee08687d014be2db5
|
4
|
+
data.tar.gz: 014f3adfe253af9c9cf3dff604594572e7e2475e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5c99258face5419385bf5c934a5e5c7bed0761ee158f1f5b1352869de7f415c4663128c07198c593965e7edba310bf123d2d501e47fa7a50c36c259fb74adbe
|
7
|
+
data.tar.gz: c010cae549f1563d55abd492234e20b8c8ca397e2488e48e63273ff70e05c58d4b215685a5fe02983d889ec180dd98f63291cc4c9ae8c9409ce7986040e7a5c5
|
data/lib/bigchaindb.rb
CHANGED
@@ -3,6 +3,7 @@ require 'shellwords'
|
|
3
3
|
require 'httparty'
|
4
4
|
|
5
5
|
module Bdb
|
6
|
+
ADDRESS_REGEXP = /\A[1-9A-Za-z]{43,45}\z/
|
6
7
|
def self.generate_keys
|
7
8
|
JSON.parse(`bdb generate_keys`)
|
8
9
|
# {"public"=> "x", "private"=> "y"} #Base58 256-bit numbers
|
@@ -26,6 +27,8 @@ module Bdb
|
|
26
27
|
end
|
27
28
|
|
28
29
|
def self.transfer_txn(inputs, outputs, asset, metadata = nil)
|
30
|
+
args = {inputs: inputs, outputs: outputs, asset: asset, metadata: metadata}
|
31
|
+
puts "In transfer_txn, args = #{args.inspect}"
|
29
32
|
if metadata
|
30
33
|
args = [inputs.to_json, outputs.to_json, asset.to_json, metadata.to_json]
|
31
34
|
else
|
@@ -72,9 +75,9 @@ module Bdb
|
|
72
75
|
end
|
73
76
|
unspent.each do |u|
|
74
77
|
txn = JSON.parse(Bdb.get_transaction_by_id(ipdb, u["transaction_id"]).body)
|
75
|
-
next unless txn["asset"]["id"] == asset_id
|
78
|
+
next unless ((txn["operation"] == "CREATE") && txn["id"] == asset_id) || ((txn["operation"] == "TRANSFER") && txn["asset"]["id"] == asset_id)
|
76
79
|
input_amount += txn["outputs"][u["output_index"]]["amount"].to_i
|
77
|
-
new_inputs
|
80
|
+
new_inputs += Bdb.spend(txn, [u["output_index"]])
|
78
81
|
end
|
79
82
|
else
|
80
83
|
# assume that every output for sender_pubkey in given inputs is unspent and can be used as input
|