Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database: Add --txIndex to kaspad #2103

Open
wants to merge 56 commits into
base: dev
Choose a base branch
from

Conversation

D-Stacks
Copy link
Contributor

@D-Stacks D-Stacks commented Jun 21, 2022

closes #2092

This allows kaspads to be run with an optional --txindex flag. This stores TXIDs with the acceptingBlocHash. this allows for exaustive querying of tx associated data, which is useful to fledge out rpc commands, increase information available to the wallet, and to ease confirmation calculations, or even work them directly into kaspad rpc. the ability to query tx associated blockdata, is a much requested functionality from external developers, the latter of which specifically from exchanges.

it follows the example of the utxoindex.

Currently untested, and unintegrated, into kaspad's actual functioning through the rpc manager.

To Do

  • turn pruningpoint change into consensus event
    --> needed to prune txindex
  • integrate into the rpc manager
    --> bare minimum to update and reset the index accordingly
  • minimal rpc
    --> for minimal usecase and testing
  • implement proper removal logic into the txindex database.
  • tests
    • test for accurate dataretrival
    • test for txindex pruning
    • test logic (reorg & double spend cases)

@codecov
Copy link

codecov bot commented Jun 22, 2022

Codecov Report

Base: 58.95% // Head: 56.86% // Decreases project coverage by -2.08% ⚠️

Coverage data is based on head (e9f7169) compared to base (26c7db2).
Patch coverage: 6.16% of modified lines in pull request are covered.

❗ Current head e9f7169 differs from pull request most recent head a2c851f. Consider uploading reports for the commit a2c851f to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #2103      +/-   ##
==========================================
- Coverage   58.95%   56.86%   -2.09%     
==========================================
  Files         679      702      +23     
  Lines       33060    34376    +1316     
==========================================
+ Hits        19490    19548      +58     
- Misses      10736    11982    +1246     
- Partials     2834     2846      +12     
Impacted Files Coverage Δ
app/appmessage/message.go 71.42% <ø> (ø)
...appmessage/rpc_get_accepting_blockhashes_of_txs.go 0.00% <0.00%> (ø)
app/appmessage/rpc_get_txs.go 0.00% <0.00%> (ø)
app/appmessage/rpc_get_txs_confirmations.go 0.00% <0.00%> (ø)
...p/appmessage/rpc_modify_notifying_addresses_txs.go 0.00% <0.00%> (ø)
...e/rpc_modify_notifying_txs_confirmation_changed.go 0.00% <0.00%> (ø)
app/appmessage/rpc_notify_addresses_txs.go 0.00% <0.00%> (ø)
.../appmessage/rpc_notify_txs_confirmation_changed.go 0.00% <0.00%> (ø)
app/appmessage/rpc_submit_transaction.go 100.00% <ø> (ø)
app/rpc/rpc.go 63.88% <ø> (ø)
... and 37 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@D-Stacks D-Stacks marked this pull request as ready for review June 25, 2022 08:40
@D-Stacks
Copy link
Contributor Author

Converting back to draft. I will apply a notification stream and implement all testing which does not require dag params to be overwritten.

@D-Stacks D-Stacks marked this pull request as draft June 29, 2022 22:43
@D-Stacks D-Stacks marked this pull request as ready for review September 2, 2022 08:26
@@ -0,0 +1,43 @@
package appmessage
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't expose the including block to the user if it's different between kaspads

@@ -0,0 +1,41 @@
package appmessage
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't expose the including block to the user if it's different between kaspads.

@@ -0,0 +1,41 @@
package appmessage
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't expose the including block to the user if it's different between kaspads

@@ -0,0 +1,43 @@
package appmessage
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't expose the including block to the user if it's different between kaspads

@@ -0,0 +1,41 @@
package appmessage
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems redundant to have duplicate commands for multiple/single transactions (relevant for other commands as well)

}

// TXIncludingBlockHashes returns the including block hashes for for the given txI
func (ti *TXIndex) TXIncludingBlockHashes(txIDs []*externalapi.DomainTransactionID) (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant function

}

// TXIncludingBlocks returns the including block hashes for for the given txIDs
func (ti *TXIndex) TXIncludingBlocks(txIDs []*externalapi.DomainTransactionID) (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant function


go 1.18

//replace github.com/kaspanet/kaspad/domain/txindex => /home/ds/Coding/kaspad/kaspad/domain/txindex
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please unchange this file

@@ -139,6 +139,49 @@ message KaspadMessage {
GetMempoolEntriesByAddressesResponseMessage getMempoolEntriesByAddressesResponse = 1085;
GetCoinSupplyRequestMessage getCoinSupplyRequest = 1086;
GetCoinSupplyResponseMessage getCoinSupplyResponse= 1087;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember to remove from here as well all of the requested commands

@@ -666,6 +666,18 @@ message GetInfoResponseMessage{
RPCError error = 1000;
}


//Kaspad most be started with the `--txindex` flag for this Request to work.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

most -> must. And you should always add a space after //

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants