Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Correctly encode sc close txns
Browse files Browse the repository at this point in the history
  • Loading branch information
vihu committed Mar 11, 2020
1 parent baf0b06 commit dcbbdbb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/blockchain_api/committer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,10 @@ defmodule BlockchainAPI.Committer do
)

:blockchain_txn_oui_v1 ->
insert_transaction(:blockchain_txn_oui_v1, txn, height)
insert_transaction(:blockchain_txn_oui_v1, txn, height)

:blockchain_txn_state_channel_open_v1 ->
insert_transaction(:blockchain_txn_state_channel_open_v1, txn, height)
insert_transaction(:blockchain_txn_state_channel_open_v1, txn, height)

:blockchain_txn_state_channel_close_v1 ->
insert_transaction(:blockchain_txn_state_channel_close_v1, txn, height)
Expand Down
8 changes: 6 additions & 2 deletions lib/blockchain_api/schema/state_channel_close.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ defmodule BlockchainAPI.Schema.StateChannel do
use Ecto.Schema
import Ecto.Changeset

@derive Jason.Encoder
@fields [:id, :owner, :credits, :nonce, :balances, :root_hash, :state, :expire_at_block]

@derive {Jason.Encoder, only: @fields}
@primary_key false
embedded_schema do
field :id, :string, null: false
Expand All @@ -27,7 +29,9 @@ defmodule BlockchainAPI.Schema.StateChannel.Balance do
use Ecto.Schema
import Ecto.Changeset

@derive Jason.Encoder
@fields [:hotspot, :num_bytes]

@derive {Jason.Encoder, only: @fields}
@primary_key false
schema "balances" do
field :hotspot, :string
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ defmodule BlockchainAPI.MixProject do
# blockchain requirements
{:blockchain,
git: "[email protected]:helium/blockchain-core.git",
branch: "macpie/ch5377/data-credits-state-channels"},
branch: "rg/sc-debug"},
{:cuttlefish,
git: "https://github.com/helium/cuttlefish.git", branch: "develop", override: true},
{:h3, git: "https://github.com/helium/erlang-h3.git", branch: "master"},
Expand Down
6 changes: 3 additions & 3 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"artificery": {:hex, :artificery, "0.4.2", "3ded6e29e13113af52811c72f414d1e88f711410cac1b619ab3a2666bbd7efd4", [:mix], [], "hexpm", "514586f4312ef3709a3ccbd8e55f69455add235c1729656687bb781d10d0afdb"},
"backoff": {:hex, :backoff, "1.1.6", "83b72ed2108ba1ee8f7d1c22e0b4a00cfe3593a67dbc792799e8cce9f42f796b", [:rebar3], [], "hexpm", "cf0cfff8995fb20562f822e5cc47d8ccf664c5ecdc26a684cbe85c225f9d7c39"},
"base32": {:hex, :base32, "0.1.0", "044f6dc95709727ca2176f3e97a41ddaa76b5bc690d3536908618c0cb32616a2", [:rebar3], [], "hexpm", "10a73951d857d8cb1eceea8eb96c6941f6a76e105947ad09c2b73977dee07638"},
"blockchain": {:git, "[email protected]:helium/blockchain-core.git", "bc11ef0a032b7bea0abb5018e4b8b6dbd4ac196e", [branch: "macpie/ch5377/data-credits-state-channels"]},
"blockchain": {:git, "[email protected]:helium/blockchain-core.git", "4e3d29e68af14a8b34bb60c48ed1c2051c500f0a", [branch: "rg/sc-debug"]},
"certifi": {:hex, :certifi, "2.5.1", "867ce347f7c7d78563450a18a6a28a8090331e77fa02380b4a21962a65d36ee5", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm", "805abd97539caf89ec6d4732c91e62ba9da0cda51ac462380bbd28ee697a8c42"},
"clique": {:git, "https://github.com/helium/clique.git", "e4be0dae150061bec080502ed530091672880867", [branch: "develop"]},
"combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [:mix], [], "hexpm", "1b1dbc1790073076580d0d1d64e42eae2366583e7aecd455d1215b0d16f2451b"},
Expand Down Expand Up @@ -32,7 +32,7 @@
"gpb": {:hex, :gpb, "4.2.1", "3ae57fdfa1b78c155ea27d86886eb248002180c447d8b450d276a908da272509", [:make, :rebar], [], "hexpm", "2f9a93e506ce2939a861b4e27d38e6d9172aeb69257df9b3a18a7594a8a3eb11"},
"h3": {:git, "https://github.com/helium/erlang-h3.git", "6389f8bdd67e93a8d1b5cccbc50a82f86858cf79", [branch: "master"]},
"hackney": {:hex, :hackney, "1.15.2", "07e33c794f8f8964ee86cebec1a8ed88db5070e52e904b8f12209773c1036085", [:rebar3], [{:certifi, "2.5.1", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "6.0.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.5", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm", "e0100f8ef7d1124222c11ad362c857d3df7cb5f4204054f9f0f4a728666591fc"},
"helium_proto": {:git, "https://github.com/helium/proto.git", "bf0e168928fd9f3a415a1cf9d5712a87465053ce", [branch: "macpie/ch5377/data-credits-state-channels"]},
"helium_proto": {:git, "https://github.com/helium/proto.git", "d135fdc0bf7eb31348c8df03f9d5ba5a4a3353cb", [branch: "macpie/ch5377/data-credits-state-channels"]},
"honeydew": {:hex, :honeydew, "1.4.5", "03818730602274ef0119652d664b92ddf733256e857d29899ce6841e01345bd1", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: true]}], "hexpm", "62633858ce7e82f67689b4d2b4024bd87fa00dc6a11a227614b816d868a1529d"},
"httpoison": {:hex, :httpoison, "1.6.2", "ace7c8d3a361cebccbed19c283c349b3d26991eff73a1eaaa8abae2e3c8089b6", [:mix], [{:hackney, "~> 1.15 and >= 1.15.2", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "aa2c74bd271af34239a3948779612f87df2422c2fdcfdbcec28d9c105f0773fe"},
"idna": {:hex, :idna, "6.0.0", "689c46cbcdf3524c44d5f3dde8001f364cd7608a99556d8fbd8239a5798d4c10", [:rebar3], [{:unicode_util_compat, "0.4.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "4bdd305eb64e18b0273864920695cb18d7a2021f31a11b9c5fbcd9a253f936e2"},
Expand All @@ -43,7 +43,7 @@
"jason": {:hex, :jason, "1.1.2", "b03dedea67a99223a2eaf9f1264ce37154564de899fd3d8b9a21b1a6fd64afe7", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fdf843bca858203ae1de16da2ee206f53416bbda5dc8c9e78f43243de4bc3afe"},
"jumper": {:hex, :jumper, "1.0.1", "3c00542ef1a83532b72269fab9f0f0c82bf23a35e27d278bfd9ed0865cecabff", [:mix], [], "hexpm"},
"lager": {:hex, :lager, "3.6.7", "2fbf823944caa0fc10df5ec13f3f047524a249bb32f0d801b7900c9610264286", [:rebar3], [{:goldrush, "0.1.9", [hex: :goldrush, repo: "hexpm", optional: false]}], "hexpm", "beaee45f128b341273364abac428bc051a1d95734b97047141bea52e8ae604ca"},
"libp2p": {:git, "https://github.com/helium/erlang-libp2p.git", "a0e036ad3f0bb40b97fb117bda0f95cd83cf1c8b", [branch: "master"]},
"libp2p": {:git, "https://github.com/helium/erlang-libp2p.git", "43bd014f21014a27f2ed8c150084775ec0ba1a9a", [branch: "master"]},
"libp2p_crypto": {:hex, :libp2p_crypto, "1.0.1", "0d7071a07cbba012c049c06067874969a6a2fe765ccd33b9dbb582580e62929f", [:rebar3], [{:ecc_compact, "1.0.4", [hex: :ecc_compact, repo: "hexpm", optional: false]}, {:enacl, "0.17.2", [hex: :enacl, repo: "hexpm", optional: false]}, {:erl_base58, "0.0.1", [hex: :erl_base58, repo: "hexpm", optional: false]}, {:multiaddr, "1.1.3", [hex: :multiaddr, repo: "hexpm", optional: false]}], "hexpm", "37789c6b1ddf0fb6f8c2f6e1e8297a728ca1f0e365f259a06a931a52e8c42140"},
"logger_file_backend": {:hex, :logger_file_backend, "0.0.11", "3bbc5f31d3669e8d09d7a9443e86056fae7fc18e45c6f748c33b8c79a7e147a1", [:mix], [], "hexpm", "62be826f04644c62b0a2bc98a13e2e7ae52c0a4eda020f4c59d7287356d5e445"},
"merkerl": {:git, "https://github.com/helium/merkerl.git", "23c7384f30c1e6731fa40c74ce042562ad802385", [branch: "master"]},
Expand Down

0 comments on commit dcbbdbb

Please sign in to comment.