Skip to content

Commit

Permalink
Merge pull request #2171 from nervosnetwork/testnet
Browse files Browse the repository at this point in the history
Deploy to mainnet
  • Loading branch information
zmcNotafraid authored Sep 2, 2024
2 parents deeee75 + d5c4fc9 commit 02bb515
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 161 deletions.
2 changes: 1 addition & 1 deletion app/jobs/commit_block_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def perform(block)
# reject all the other cell output that is consumed by
# transactions in current block

# collect all the previous cell outupts
# collect all the previous cell outputs
# select related cell inputs which are not in current block
# mark the transaction contains these cell input to be rejected

Expand Down
2 changes: 1 addition & 1 deletion app/models/bitcoin_transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def confirmations
raw_transaction = rpc.getrawtransaction(txid, 2)
raw_transaction.dig("result", "confirmations")
rescue StandardError => e
Rails.logger.error "get #{txid} confirmations faild: #{e.message}"
Rails.logger.error "get #{txid} confirmations failed: #{e.message}"
0
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/block.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Block < ApplicationRecord
belongs_to :parent_block, class_name: "Block", foreign_key: "parent_hash", primary_key: "block_hash", optional: true,
inverse_of: :subsequent_blocks

# one block can have serveral different subsequent blocks, and only one can be included on chain
# one block can have several different subsequent blocks, and only one can be included on chain
has_many :subsequent_blocks, class_name: "Block", foreign_key: "parent_hash", primary_key: "block_hash",
inverse_of: :parent_block
belongs_to :epoch_statistic, primary_key: :epoch_number, foreign_key: :epoch, optional: true
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20240902025657_drop_cell_outputs_old.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class DropCellOutputsOld < ActiveRecord::Migration[7.0]
def change
drop_table :cell_outputs_old, if_exists: true
end
end
159 changes: 2 additions & 157 deletions db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1212,56 +1212,6 @@ CREATE TABLE public.cell_outputs_live (
);


--
-- Name: cell_outputs_old; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.cell_outputs_old (
id bigint NOT NULL,
capacity numeric(64,2),
data bytea,
ckb_transaction_id bigint,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
status smallint DEFAULT 0,
address_id numeric(30,0),
block_id numeric(30,0),
tx_hash bytea,
cell_index integer,
consumed_by_id numeric(30,0),
cell_type integer DEFAULT 0,
data_size integer,
occupied_capacity numeric(30,0),
block_timestamp numeric(30,0),
consumed_block_timestamp numeric(30,0),
type_hash character varying,
udt_amount numeric(40,0),
dao character varying,
lock_script_id bigint,
type_script_id bigint,
data_hash bytea
);


--
-- Name: cell_outputs_old_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE public.cell_outputs_old_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;


--
-- Name: cell_outputs_old_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE public.cell_outputs_old_id_seq OWNED BY public.cell_outputs_old.id;


--
-- Name: cell_outputs_pending; Type: TABLE; Schema: public; Owner: -
--
Expand Down Expand Up @@ -3059,13 +3009,6 @@ ALTER TABLE ONLY public.cell_inputs ALTER COLUMN id SET DEFAULT nextval('public.
ALTER TABLE ONLY public.cell_outputs ALTER COLUMN id SET DEFAULT nextval('public.cell_outputs_id_seq'::regclass);


--
-- Name: cell_outputs_old id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.cell_outputs_old ALTER COLUMN id SET DEFAULT nextval('public.cell_outputs_old_id_seq'::regclass);


--
-- Name: ckb_transactions id; Type: DEFAULT; Schema: public; Owner: -
--
Expand Down Expand Up @@ -3502,14 +3445,6 @@ ALTER TABLE ONLY public.cell_outputs_live
ADD CONSTRAINT cell_outputs_live_pkey PRIMARY KEY (id, status);


--
-- Name: cell_outputs_old cell_outputs_old_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.cell_outputs_old
ADD CONSTRAINT cell_outputs_old_pkey PRIMARY KEY (id);


--
-- Name: cell_outputs_pending cell_outputs_pending_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
Expand Down Expand Up @@ -4702,97 +4637,6 @@ CREATE INDEX index_cell_dependencies_on_script_id ON public.cell_dependencies US
CREATE UNIQUE INDEX index_cell_inputs_on_ckb_transaction_id_and_index ON public.cell_inputs USING btree (ckb_transaction_id, index);


--
-- Name: index_cell_outputs_old_on_address_id_and_status; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX index_cell_outputs_old_on_address_id_and_status ON public.cell_outputs_old USING btree (address_id, status);


--
-- Name: index_cell_outputs_old_on_block_id; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX index_cell_outputs_old_on_block_id ON public.cell_outputs_old USING btree (block_id);


--
-- Name: index_cell_outputs_old_on_block_timestamp; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX index_cell_outputs_old_on_block_timestamp ON public.cell_outputs_old USING btree (block_timestamp);


--
-- Name: index_cell_outputs_old_on_cell_type; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX index_cell_outputs_old_on_cell_type ON public.cell_outputs_old USING btree (cell_type);


--
-- Name: index_cell_outputs_old_on_ckb_transaction_id_and_cell_index; Type: INDEX; Schema: public; Owner: -
--

CREATE UNIQUE INDEX index_cell_outputs_old_on_ckb_transaction_id_and_cell_index ON public.cell_outputs_old USING btree (ckb_transaction_id, cell_index);


--
-- Name: index_cell_outputs_old_on_consumed_block_timestamp; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX index_cell_outputs_old_on_consumed_block_timestamp ON public.cell_outputs_old USING btree (consumed_block_timestamp);


--
-- Name: index_cell_outputs_old_on_consumed_by_id; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX index_cell_outputs_old_on_consumed_by_id ON public.cell_outputs_old USING btree (consumed_by_id);


--
-- Name: index_cell_outputs_old_on_data_hash; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX index_cell_outputs_old_on_data_hash ON public.cell_outputs_old USING hash (data_hash);


--
-- Name: index_cell_outputs_old_on_lock_script_id; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX index_cell_outputs_old_on_lock_script_id ON public.cell_outputs_old USING btree (lock_script_id);


--
-- Name: index_cell_outputs_old_on_status; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX index_cell_outputs_old_on_status ON public.cell_outputs_old USING btree (status);


--
-- Name: index_cell_outputs_old_on_tx_hash_and_cell_index; Type: INDEX; Schema: public; Owner: -
--

CREATE UNIQUE INDEX index_cell_outputs_old_on_tx_hash_and_cell_index ON public.cell_outputs_old USING btree (tx_hash, cell_index);


--
-- Name: index_cell_outputs_old_on_type_script_id; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX index_cell_outputs_old_on_type_script_id ON public.cell_outputs_old USING btree (type_script_id);


--
-- Name: index_cell_outputs_old_on_type_script_id_and_id; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX index_cell_outputs_old_on_type_script_id_and_id ON public.cell_outputs_old USING btree (type_script_id, id);


--
-- Name: index_contracts_on_code_hash; Type: INDEX; Schema: public; Owner: -
--
Expand Down Expand Up @@ -6097,6 +5941,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20240709131132'),
('20240709131713'),
('20240709142013'),
('20240822024448');
('20240822024448'),
('20240902025657');


2 changes: 1 addition & 1 deletion test/utils/ckb_utils_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ class CkbUtilsTest < ActiveSupport::TestCase
end
end

test ".parse_dao should return nil whne dao is blank" do
test ".parse_dao should return nil when dao is blank" do
assert_nil CkbUtils.parse_dao(nil)
end

Expand Down

0 comments on commit 02bb515

Please sign in to comment.