Skip to content

Commit

Permalink
Merge pull request #2387 from nervosnetwork/develop
Browse files Browse the repository at this point in the history
Deploy to testnet
  • Loading branch information
rabbitz authored Jan 3, 2025
2 parents cb3328c + 41f8817 commit 5b20dfa
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 41 deletions.
2 changes: 1 addition & 1 deletion app/models/bitcoin_statistic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ def self.refresh
#
# Indexes
#
# index_bitcoin_statistics_on_timestamp (timestamp) UNIQUE
# index_bitcoin_statistics_on_timestamp (timestamp)
#
33 changes: 16 additions & 17 deletions app/models/fiber_graph_channel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,22 @@ def funding_cell
#
# Table name: fiber_graph_channels
#
# id :bigint not null, primary key
# channel_outpoint :string
# funding_tx_block_number :bigint
# funding_tx_index :integer
# node1 :string
# node2 :string
# last_updated_timestamp :bigint
# created_timestamp :bigint
# node1_to_node2_fee_rate :decimal(30, ) default(0)
# node2_to_node1_fee_rate :decimal(30, ) default(0)
# capacity :decimal(64, 2) default(0.0)
# chain_hash :string
# created_at :datetime not null
# updated_at :datetime not null
# udt_id :bigint
# open_transaction_id :bigint
# closed_transaction_id :bigint
# id :bigint not null, primary key
# channel_outpoint :string
# node1 :string
# node2 :string
# created_timestamp :bigint
# capacity :decimal(64, 2) default(0.0)
# chain_hash :string
# created_at :datetime not null
# updated_at :datetime not null
# udt_id :bigint
# open_transaction_id :bigint
# closed_transaction_id :bigint
# last_updated_timestamp_of_node1 :bigint
# last_updated_timestamp_of_node2 :bigint
# fee_rate_of_node1 :decimal(30, ) default(0)
# fee_rate_of_node2 :decimal(30, ) default(0)
#
# Indexes
#
Expand Down
9 changes: 4 additions & 5 deletions app/views/api/v2/fiber/graph_channels/index.jbuilder
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
json.data do
json.fiber_graph_channels @channels do |channel|
json.(channel, :channel_outpoint, :node1, :node2, :chain_hash, :open_transaction_info, :closed_transaction_info)
json.funding_tx_block_number channel.funding_tx_block_number.to_s
json.funding_tx_index channel.funding_tx_index.to_s
json.last_updated_timestamp channel.last_updated_timestamp.to_s
json.last_updated_timestamp_of_node1 channel.last_updated_timestamp_of_node1.to_s
json.last_updated_timestamp_of_node2 channel.last_updated_timestamp_of_node2.to_s
json.created_timestamp channel.created_timestamp.to_s
json.node1_to_node2_fee_rate channel.node1_to_node2_fee_rate.to_s
json.node2_to_node1_fee_rate channel.node2_to_node1_fee_rate.to_s
json.fee_rate_of_node1 channel.fee_rate_of_node1.to_s
json.fee_rate_of_node2 channel.fee_rate_of_node2.to_s
json.capacity channel.capacity.to_s
json.udt_cfg_info channel.udt_info
end
Expand Down
9 changes: 4 additions & 5 deletions app/views/api/v2/fiber/graph_nodes/show.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ json.data do

json.fiber_graph_channels @graph_channels do |channel|
json.(channel, :channel_outpoint, :node1, :node2, :chain_hash, :open_transaction_info, :closed_transaction_info, :udt_info)
json.funding_tx_block_number channel.funding_tx_block_number.to_s
json.funding_tx_index channel.funding_tx_index.to_s
json.last_updated_timestamp channel.last_updated_timestamp.to_s
json.last_updated_timestamp_of_node1 channel.last_updated_timestamp_of_node1.to_s
json.last_updated_timestamp_of_node2 channel.last_updated_timestamp_of_node2.to_s
json.fee_rate_of_node1 channel.fee_rate_of_node1.to_s
json.fee_rate_of_node2 channel.fee_rate_of_node2.to_s
json.created_timestamp channel.created_timestamp.to_s
json.node1_to_node2_fee_rate channel.node1_to_node2_fee_rate.to_s
json.node2_to_node1_fee_rate channel.node2_to_node1_fee_rate.to_s
json.capacity channel.capacity.to_s
end
end
9 changes: 4 additions & 5 deletions app/workers/fiber_graph_detect_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,13 @@ def build_channel_attributes(channel)

{
channel_outpoint:,
funding_tx_block_number: channel["funding_tx_block_number"].to_i(16),
funding_tx_index: channel["funding_tx_index"].to_i(16),
node1: channel["node1"],
node2: channel["node2"],
last_updated_timestamp: channel["last_updated_timestamp"].to_i(16),
created_timestamp: channel["created_timestamp"],
node1_to_node2_fee_rate: channel["node1_to_node2_fee_rate"].to_i(16),
node2_to_node1_fee_rate: channel["node2_to_node1_fee_rate"].to_i(16),
last_updated_timestamp_of_node1: channel["last_updated_timestamp_of_node1"].to_i(16),
last_updated_timestamp_of_node2: channel["last_updated_timestamp_of_node2"].to_i(16),
fee_rate_of_node1: channel["fee_rate_of_node1"].to_i(16),
fee_rate_of_node2: channel["fee_rate_of_node2"].to_i(16),
capacity: channel["capacity"].to_i(16),
chain_hash: channel["chain_hash"],
open_transaction_id: open_transaction&.id,
Expand Down
14 changes: 14 additions & 0 deletions db/migrate/20250103072945_update_fiber_graph_channels.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class UpdateFiberGraphChannels < ActiveRecord::Migration[7.0]
def change
remove_column :fiber_graph_channels, :funding_tx_block_number, :bigint
remove_column :fiber_graph_channels, :funding_tx_index, :integer
remove_column :fiber_graph_channels, :last_updated_timestamp, :bigint
remove_column :fiber_graph_channels, :node1_to_node2_fee_rate, :decimal, precision: 30, default: 0.0
remove_column :fiber_graph_channels, :node2_to_node1_fee_rate, :decimal, precision: 30, default: 0.0

add_column :fiber_graph_channels, :last_updated_timestamp_of_node1, :bigint
add_column :fiber_graph_channels, :last_updated_timestamp_of_node2, :bigint
add_column :fiber_graph_channels, :fee_rate_of_node1, :decimal, precision: 30, default: 0.0
add_column :fiber_graph_channels, :fee_rate_of_node2, :decimal, precision: 30, default: 0.0
end
end
16 changes: 8 additions & 8 deletions db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1755,21 +1755,20 @@ ALTER SEQUENCE public.fiber_channels_id_seq OWNED BY public.fiber_channels.id;
CREATE TABLE public.fiber_graph_channels (
id bigint NOT NULL,
channel_outpoint character varying,
funding_tx_block_number bigint,
funding_tx_index integer,
node1 character varying,
node2 character varying,
last_updated_timestamp bigint,
created_timestamp bigint,
node1_to_node2_fee_rate numeric(30,0) DEFAULT 0.0,
node2_to_node1_fee_rate numeric(30,0) DEFAULT 0.0,
capacity numeric(64,2) DEFAULT 0.0,
chain_hash character varying,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL,
udt_id bigint,
open_transaction_id bigint,
closed_transaction_id bigint
closed_transaction_id bigint,
last_updated_timestamp_of_node1 bigint,
last_updated_timestamp_of_node2 bigint,
fee_rate_of_node1 numeric(30,0) DEFAULT 0.0,
fee_rate_of_node2 numeric(30,0) DEFAULT 0.0
);


Expand Down Expand Up @@ -4747,7 +4746,7 @@ CREATE UNIQUE INDEX index_bitcoin_annotations_on_ckb_transaction_id ON public.bi
-- Name: index_bitcoin_statistics_on_timestamp; Type: INDEX; Schema: public; Owner: -
--

CREATE UNIQUE INDEX index_bitcoin_statistics_on_timestamp ON public.bitcoin_statistics USING btree ("timestamp");
CREATE INDEX index_bitcoin_statistics_on_timestamp ON public.bitcoin_statistics USING btree ("timestamp");


--
Expand Down Expand Up @@ -6317,6 +6316,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20241223023654'),
('20241223060331'),
('20241225045757'),
('20241231022644');
('20241231022644'),
('20250103072945');


0 comments on commit 5b20dfa

Please sign in to comment.