-
Notifications
You must be signed in to change notification settings - Fork 45
Orchard > Transparent transfers fail #2265
Description
Hey,
Seems like Sapling > transparent is good and transparent > transparent is also good but orchard > transparent is not working .,..
branch tested: dev
quicksend transparent address was failing:
error:
Sapling shard store checkpoint not found at anchor height 3279003.
I changed one file:
Modified File
/tmp/zingolib/zingolib/src/wallet/output.rs
The Change
In the spendable_notes() function (around line 240), I replaced the unconditional
checkpoint checks for both Orchard AND Sapling with a pool-specific check:
Before (lines 250-275):
1 // Checked BOTH checkpoints regardless of which pool was being queried
2 if self.shard_trees.orchard.store().get_checkpoint(&anchor_height).is_none() {
3 return Err(WalletError::CheckpointNotFound {
4 shielded_protocol: ShieldedProtocol::Orchard,
5 height: anchor_height,
6 });
7 }
8 if self.shard_trees.sapling.store().get_checkpoint(&anchor_height).is_none() {
9 return Err(WalletError::CheckpointNotFound {
10 shielded_protocol: ShieldedProtocol::Sapling,
11 height: anchor_height,
12 });
13 }
After:
1 // Only check the checkpoint for the specific pool type being queried
2 let checkpoint_exists = match N::SHIELDED_PROTOCOL {
3 ShieldedProtocol::Orchard => self
4 .shard_trees
5 .orchard
6 .store()
7 .get_checkpoint(&anchor_height)
8 .expect("infallible")
9 .is_some(),
10 ShieldedProtocol::Sapling => self
11 .shard_trees
12 .sapling
13 .store()
14 .get_checkpoint(&anchor_height)
15 .expect("infallible")
16 .is_some(),
17 }; 18 if !checkpoint_exists {
19 return Err(WalletError::CheckpointNotFound {
20 shielded_protocol: N::SHIELDED_PROTOCOL,
21 height: anchor_height,
22 });
23 }
Why This Works
The generic type N: NoteInterface has an associated constant SHIELDED_PROTOCOL that
tells us which pool we're querying. The fix uses this to check only the relevant
checkpoint, allowing spends from Orchard even if Sapling was never used (and vice
versa).