chore: callback to foreign trait
This commit is contained in:
parent
b9128b0e6a
commit
53afd9c238
@ -333,11 +333,13 @@ interface SyncRequest {
|
|||||||
SyncRequest inspect_spks(SyncScriptInspector inspector);
|
SyncRequest inspect_spks(SyncScriptInspector inspector);
|
||||||
};
|
};
|
||||||
|
|
||||||
callback interface SyncScriptInspector {
|
[Trait, WithForeign]
|
||||||
|
interface SyncScriptInspector {
|
||||||
void inspect(Script script, u64 total);
|
void inspect(Script script, u64 total);
|
||||||
};
|
};
|
||||||
|
|
||||||
callback interface FullScanScriptInspector {
|
[Trait, WithForeign]
|
||||||
|
interface FullScanScriptInspector {
|
||||||
void inspect(KeychainKind keychain, u32 index, Script script);
|
void inspect(KeychainKind keychain, u32 index, Script script);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ pub struct SyncRequest(pub(crate) Mutex<Option<BdkSyncRequest>>);
|
|||||||
impl SyncRequest {
|
impl SyncRequest {
|
||||||
pub fn inspect_spks(
|
pub fn inspect_spks(
|
||||||
&self,
|
&self,
|
||||||
inspector: Box<dyn SyncScriptInspector>,
|
inspector: Arc<dyn SyncScriptInspector>,
|
||||||
) -> Result<Arc<Self>, InspectError> {
|
) -> Result<Arc<Self>, InspectError> {
|
||||||
let mut guard = self.0.lock().unwrap();
|
let mut guard = self.0.lock().unwrap();
|
||||||
if let Some(sync_request) = guard.take() {
|
if let Some(sync_request) = guard.take() {
|
||||||
@ -145,7 +145,7 @@ impl SyncRequest {
|
|||||||
impl FullScanRequest {
|
impl FullScanRequest {
|
||||||
pub fn inspect_spks_for_all_keychains(
|
pub fn inspect_spks_for_all_keychains(
|
||||||
&self,
|
&self,
|
||||||
inspector: Box<dyn FullScanScriptInspector>,
|
inspector: Arc<dyn FullScanScriptInspector>,
|
||||||
) -> Result<Arc<Self>, InspectError> {
|
) -> Result<Arc<Self>, InspectError> {
|
||||||
let mut guard = self.0.lock().unwrap();
|
let mut guard = self.0.lock().unwrap();
|
||||||
if let Some(full_scan_request) = guard.take() {
|
if let Some(full_scan_request) = guard.take() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user