-
Notifications
You must be signed in to change notification settings - Fork 219
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
feat(base-node): improve contract utxo scanning #4208
feat(base-node): improve contract utxo scanning #4208
Conversation
6d7d53f
to
fbe1051
Compare
… to contract_index
…act_outputs_for_block
…outputs_for_block
463a84b
to
10af53d
Compare
…ery is out of range
10af53d
to
4487c7b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loosely reviewed, but heavily tested.
@@ -97,6 +97,7 @@ impl DanNode { | |||
for output in outputs { | |||
if let Some(sidechain_features) = output.features.sidechain_features { | |||
let contract_id = sidechain_features.contract_id; | |||
// TODO: expect will crash the validator node if the base node misbehaves |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in next PR.
@@ -106,11 +106,16 @@ impl BaseNodeClient for GrpcBaseNodeClient { | |||
) -> Result<Vec<TransactionOutput>, DigitalAssetError> { | |||
let inner = self.connection().await?; | |||
let request = grpc::GetConstitutionsRequest { | |||
// TODO: pass in the last block hash that was scanned |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in next PR
Description
Motivation and Context
get_all_constitutions
is currently very inefficient and has to load the entire UTXO set. This PR adds a<block_hash, output_type, contract_id>
index to contract_index db that allows efficient loading of contract outputs optionally filtered by type contained in a block.The get_constitutions grpc method now takes in a start_block_hash and streams utxos starting from that hash.
How Has This Been Tested?
Additional unit tests
Manually, sync on igor