Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Dunitrust
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
nodes
rust
Dunitrust
Merge requests
!221
WIP: Resolve "Fail to revert block with transactions"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
WIP: Resolve "Fail to revert block with transactions"
elois/172-fail-to-revert-block-with-transactions
into
dev
Overview
0
Commits
12
Pipelines
0
Changes
3
Merged
Éloïs
requested to merge
elois/172-fail-to-revert-block-with-transactions
into
dev
5 years ago
Overview
0
Commits
12
Pipelines
0
Changes
3
Closes
#172 (closed)
0
0
Merge request reports
Viewing commit
cbd58dcd
Prev
Next
Show latest version
3 files
+
241
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
cbd58dcd
[tests] bc: create TI revert_blocks
· cbd58dcd
Éloïs
authored
5 years ago
lib/modules/blockchain/blockchain/tests/common.rs
0 → 100644
+
77
−
0
View file @ cbd58dcd
Edit in single-file editor
Open in Web IDE
// Copyright (C) 2017-2019 The AXIOM TEAM Association.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use
dubp_currency_params
::
genesis_block_params
::
v10
::
BlockV10Parameters
;
use
dubp_currency_params
::{
CurrencyName
,
CurrencyParameters
};
use
durs_bc_db_writer
::
WotsV10DBs
;
use
durs_blockchain
::
BlockchainModule
;
use
durs_message
::
DursMsg
;
use
durs_module
::
RouterThreadMessage
;
use
std
::
path
::{
Path
,
PathBuf
};
use
std
::
sync
::
mpsc
::
Sender
;
use
std
::
thread
::
JoinHandle
;
use
tempfile
::
TempDir
;
pub
static
TEST_CURRENCY
:
&
str
=
"test_currency"
;
/// Init logger and user datas directory
pub
fn
init
()
->
PathBuf
{
durs_common_tests_tools
::
logger
::
init_logger_stdout
(
vec!
[]);
TempDir
::
new
()
.expect
(
"Fail to create tmp dir."
)
.into_path
()
}
/// Stop and clear test
pub
fn
stop_and_clean
(
bc_sender
:
Sender
<
DursMsg
>
,
handle
:
JoinHandle
<
()
>
,
tmp_profile_path
:
PathBuf
,
)
{
// Send STOP signal to blockchain module
bc_sender
.send
(
DursMsg
::
Stop
)
.expect
(
"Fail to send stop signal to blockchain module."
);
handle
.join
()
.expect
(
"Blockchain module fail to stop correctly."
);
// Clear user datas
std
::
fs
::
remove_dir_all
(
tmp_profile_path
)
.expect
(
"Fail to remove tmp dir."
);
}
/// Initialize a BlockchainModule with empty blockchain
pub
fn
init_bc_module
(
fake_router_sender
:
Sender
<
RouterThreadMessage
<
DursMsg
>>
,
genesis_block_parameters
:
BlockV10Parameters
,
tmp_path
:
&
Path
,
)
->
BlockchainModule
{
let
currency_name
=
CurrencyName
(
TEST_CURRENCY
.to_owned
());
//let profile_path = tmp_profile_path.to_owned();
//let dbs_path = durs_conf::get_blockchain_db_path(profile_path.clone());
let
db
=
durs_bc_db_writer
::
open_db
(
tmp_path
)
.expect
(
"Fail to open blockchain DB."
);
BlockchainModule
::
new
(
fake_router_sender
,
tmp_path
.to_owned
(),
Some
(
currency_name
.clone
()),
Some
(
CurrencyParameters
::
from
((
&
currency_name
,
genesis_block_parameters
,
))),
db
,
WotsV10DBs
::
open
(
None
),
)
.expect
(
"Fail to init BlockchainModule with empty blockchain."
)
}
Loading