Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libdap-chain-net
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
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
cellframe
libdap-chain-net
Commits
94ff5a32
Commit
94ff5a32
authored
5 years ago
by
Dmitriy A. Gerasimov
Browse files
Options
Downloads
Patches
Plain Diff
[+] Single tx search function
parent
c285d7ca
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dap_chain_net.c
+39
-0
39 additions, 0 deletions
dap_chain_net.c
dap_chain_net.h
+15
-0
15 additions, 0 deletions
dap_chain_net.h
with
54 additions
and
0 deletions
dap_chain_net.c
+
39
−
0
View file @
94ff5a32
...
@@ -1617,3 +1617,42 @@ void dap_chain_net_proc_datapool (dap_chain_net_t * a_net)
...
@@ -1617,3 +1617,42 @@ void dap_chain_net_proc_datapool (dap_chain_net_t * a_net)
{
{
}
}
/**
* @brief dap_chain_net_tx_get_by_hash
* @param a_net
* @param a_tx_hash
* @param a_search_type
* @return
*/
dap_chain_datum_tx_t
*
dap_chain_net_get_tx_by_hash
(
dap_chain_net_t
*
a_net
,
dap_chain_hash_fast_t
*
a_tx_hash
,
dap_chain_net_tx_search_type_t
a_search_type
)
{
dap_ledger_t
*
l_ledger
=
dap_chain_ledger_by_net_name
(
a_net
->
pub
.
name
);
dap_chain_datum_tx_t
*
l_tx
=
NULL
;
switch
(
a_search_type
)
{
case
TX_SEARCH_TYPE_NET
:
case
TX_SEARCH_TYPE_CELL
:
case
TX_SEARCH_TYPE_LOCAL
:{
if
(
!
l_tx
){
// pass all chains
for
(
dap_chain_t
*
l_chain
=
a_net
->
pub
.
chains
;
l_chain
;
l_chain
=
l_chain
->
next
){
if
(
l_chain
->
callback_tx_find_by_hash
){
// try to find transaction in chain ( inside shard )
l_tx
=
l_chain
->
callback_tx_find_by_hash
(
l_chain
,
a_tx_hash
);
if
(
l_tx
)
break
;
}
}
}
}
break
;
case
TX_SEARCH_TYPE_NET_UNSPENT
:
case
TX_SEARCH_TYPE_CELL_UNSPENT
:{
l_tx
=
dap_chain_ledger_tx_find_by_hash
(
l_ledger
,
a_tx_hash
);
}
break
;
}
return
l_tx
;
}
This diff is collapsed.
Click to expand it.
dap_chain_net.h
+
15
−
0
View file @
94ff5a32
...
@@ -108,6 +108,21 @@ dap_chain_cell_id_t * dap_chain_net_get_cur_cell( dap_chain_net_t * l_net);
...
@@ -108,6 +108,21 @@ dap_chain_cell_id_t * dap_chain_net_get_cur_cell( dap_chain_net_t * l_net);
void
dap_chain_net_links_connect
(
dap_chain_net_t
*
a_net
);
void
dap_chain_net_links_connect
(
dap_chain_net_t
*
a_net
);
typedef
enum
dap_chain_net_tx_search_type
{
/// Search local, in memory, possible load data from drive to memory
TX_SEARCH_TYPE_LOCAL
,
/// Do the request to the network if its not full node, search inside shard
TX_SEARCH_TYPE_CELL
,
/// Do the request for unspent txs in cell
TX_SEARCH_TYPE_CELL_UNSPENT
,
/// Do the search in whole network and request tx from others cells if need
TX_SEARCH_TYPE_NET
,
/// Do the search in whole network but search only unspent
TX_SEARCH_TYPE_NET_UNSPENT
}
dap_chain_net_tx_search_type_t
;
dap_chain_datum_tx_t
*
dap_chain_net_get_tx_by_hash
(
dap_chain_net_t
*
a_net
,
dap_chain_hash_fast_t
*
a_tx_hash
,
dap_chain_net_tx_search_type_t
a_search_type
);
/**
/**
* @brief dap_chain_net_get_gdb_group_mempool
* @brief dap_chain_net_get_gdb_group_mempool
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment