Skip to content

Commit

Permalink
contract: add ContractStateRead::witness_info allowing wallets to acc…
Browse files Browse the repository at this point in the history
…ess mining status
  • Loading branch information
dr-orlovsky committed Sep 11, 2024
1 parent 0fc15c9 commit ef4679f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/persistence/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,11 @@ impl<M: Borrow<MemContractState>> ContractStateRead for MemContract<M> {
#[inline]
fn schema_id(&self) -> SchemaId { self.unfiltered.borrow().schema_id }

#[inline]
fn witness_info(&self, witness_id: XWitnessId) -> Option<WitnessOrd> {
self.filter.get(&witness_id).copied()
}

Check warning on line 1088 in src/persistence/memory.rs

View check run for this annotation

Codecov / codecov/patch

src/persistence/memory.rs#L1086-L1088

Added lines #L1086 - L1088 were not covered by tests

#[inline]
fn rights_all(&self) -> impl Iterator<Item = &OutputAssignment<VoidState>> {
self.unfiltered
Expand Down
1 change: 1 addition & 0 deletions src/persistence/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ pub trait StateWriteProvider: StoreTransaction<TransactionErr = Self::Error> {
pub trait ContractStateRead: ContractStateAccess {
fn contract_id(&self) -> ContractId;
fn schema_id(&self) -> SchemaId;
fn witness_info(&self, witness_id: XWitnessId) -> Option<WitnessOrd>;
fn rights_all(&self) -> impl Iterator<Item = &OutputAssignment<VoidState>>;
fn fungible_all(&self) -> impl Iterator<Item = &OutputAssignment<RevealedValue>>;
fn data_all(&self) -> impl Iterator<Item = &OutputAssignment<RevealedData>>;
Expand Down

0 comments on commit ef4679f

Please sign in to comment.