Skip to content

Commit

Permalink
Merge branch 'master' into issue949
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptoni9n authored Sep 5, 2024
2 parents 7436836 + 4d05253 commit ea5bb22
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
8 changes: 8 additions & 0 deletions src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,11 @@ pub struct SatInscriptions {
pub more: bool,
pub page: u64,
}

#[derive(Debug, PartialEq, Serialize, Deserialize)]
pub struct AddressInfo {
pub outputs: Vec<OutPoint>,
pub inscriptions: Vec<InscriptionId>,
pub sat_balance: u64,
pub runes_balances: Vec<(SpacedRune, Decimal, Option<char>)>,
}
12 changes: 12 additions & 0 deletions src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6700,4 +6700,16 @@ mod tests {
// zero
assert_eq!(Statistic::Schema.key(), 0);
}

#[test]
fn reminder_to_update_utxo_entry_type_name() {
// This test will break when the schema version is updated, and is a
// reminder to fix the type name in `impl redb::Value for &UtxoEntry`.
//
// The type name should be changed from `ord::index::utxo_entry::UtxoValue`
// to `ord::UtxoEntry`. I think it's probably best if we just name types
// `ord::NAME`, instead of including the full path, since the full path
// will change if we reorganize the code.
assert_eq!(SCHEMA_VERSION, 28);
}
}
9 changes: 1 addition & 8 deletions src/subcommand/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,6 @@ pub struct Server {
)]
pub(crate) polling_interval: humantime::Duration,
}
#[derive(Serialize)]
struct AddressResponse {
outputs: Vec<OutPoint>,
inscriptions: Vec<InscriptionId>,
sat_balance: u64,
runes_balances: Vec<(SpacedRune, Decimal, Option<char>)>,
}

impl Server {
pub fn run(self, settings: Settings, index: Arc<Index>, handle: Handle) -> SubcommandResult {
Expand Down Expand Up @@ -842,7 +835,7 @@ impl Server {
let runes_balances = index.get_aggregated_rune_balances_for_outputs(&outputs)?;

Ok(if accept_json {
Json(AddressResponse {
Json(api::AddressInfo {
sat_balance,
outputs,
inscriptions,
Expand Down

0 comments on commit ea5bb22

Please sign in to comment.