chore: callback to foreign trait

This commit is contained in:
Matthew 2024-06-07 19:30:03 -05:00
parent b9128b0e6a
commit 53afd9c238
No known key found for this signature in database
GPG Key ID: 8D4FCD82DD54DDD2
2 changed files with 6 additions and 4 deletions

View File

@ -333,11 +333,13 @@ interface SyncRequest {
SyncRequest inspect_spks(SyncScriptInspector inspector);
};
callback interface SyncScriptInspector {
[Trait, WithForeign]
interface SyncScriptInspector {
void inspect(Script script, u64 total);
};
callback interface FullScanScriptInspector {
[Trait, WithForeign]
interface FullScanScriptInspector {
void inspect(KeychainKind keychain, u32 index, Script script);
};

View File

@ -127,7 +127,7 @@ pub struct SyncRequest(pub(crate) Mutex<Option<BdkSyncRequest>>);
impl SyncRequest {
pub fn inspect_spks(
&self,
inspector: Box<dyn SyncScriptInspector>,
inspector: Arc<dyn SyncScriptInspector>,
) -> Result<Arc<Self>, InspectError> {
let mut guard = self.0.lock().unwrap();
if let Some(sync_request) = guard.take() {
@ -145,7 +145,7 @@ impl SyncRequest {
impl FullScanRequest {
pub fn inspect_spks_for_all_keychains(
&self,
inspector: Box<dyn FullScanScriptInspector>,
inspector: Arc<dyn FullScanScriptInspector>,
) -> Result<Arc<Self>, InspectError> {
let mut guard = self.0.lock().unwrap();
if let Some(full_scan_request) = guard.take() {