bigchaindb 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bigchaindb.rb +5 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 394219c2c4d68dfe7eb19aa74b69b56399a9b433
4
- data.tar.gz: 6af658bab0a25c9f84b9f6ace7a63847381b0482
3
+ metadata.gz: 42f74581b7a25c7fdd69625ee08687d014be2db5
4
+ data.tar.gz: 014f3adfe253af9c9cf3dff604594572e7e2475e
5
5
  SHA512:
6
- metadata.gz: 5eb5fa34e64e0946ad90a3d50835f10d0b50589c8c8f25695bde976a4a8ce0278353a06ba95555785a4098fa260c47659f55b141d3e1e81b9e5f02de520fb911
7
- data.tar.gz: 2cf305011df7d5c24a773aad2c2bf612e7d4ade3a86f8050c3aceb6a4c40b1e27645063f691634492046f10c3b832b39bf81c9726592a96f2dabba4e9f07ef40
6
+ metadata.gz: a5c99258face5419385bf5c934a5e5c7bed0761ee158f1f5b1352869de7f415c4663128c07198c593965e7edba310bf123d2d501e47fa7a50c36c259fb74adbe
7
+ data.tar.gz: c010cae549f1563d55abd492234e20b8c8ca397e2488e48e63273ff70e05c58d4b215685a5fe02983d889ec180dd98f63291cc4c9ae8c9409ce7986040e7a5c5
@@ -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.push(Bdb.spend(txn, [u["output_index"]]))
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bigchaindb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nilesh Trivedi