Expose db change batches over control

This commit is contained in:
Eric Wendland 2026-05-17 20:32:36 +02:00
commit a44eef3126
8 changed files with 130 additions and 15 deletions

View file

@ -463,6 +463,44 @@ fn db_add_and_status_register_local_db_metadata() {
other => panic!("unexpected response: {other:?}"),
}
let response = geth_node::handle_request(
&node,
geth_control::ControlRequest::DbChanges {
name: "notes".to_owned(),
after_db_version: None,
limit: 10,
},
)
.expect("db changes");
match response {
geth_control::ControlResponse::DbChanges { db, batch } => {
assert_eq!(db.name, "notes");
assert_eq!(batch.changes.len(), 1);
assert_eq!(batch.max_db_version, Some(3));
assert_eq!(batch.changes[0].table_name, "notes");
assert_eq!(batch.changes[0].column_id, "body");
assert!(batch.schema_metadata.contains("schema_hash="));
}
other => panic!("unexpected response: {other:?}"),
}
let response = geth_node::handle_request(
&node,
geth_control::ControlRequest::DbChanges {
name: "notes".to_owned(),
after_db_version: Some(3),
limit: 10,
},
)
.expect("db changes after latest");
match response {
geth_control::ControlResponse::DbChanges { batch, .. } => {
assert!(batch.changes.is_empty());
assert_eq!(batch.max_db_version, None);
}
other => panic!("unexpected response: {other:?}"),
}
assert!(
geth_node::handle_request(
&node,