zcash-android-wallet-sdk icon indicating copy to clipboard operation
zcash-android-wallet-sdk copied to clipboard

SDK does not distinguish "failed to communicate with lightwalletd" from "lightwalletd returned an error"

Open str4d opened this issue 7 months ago • 0 comments

See https://github.com/Electric-Coin-Company/zashi-android/issues/1422 as an example:

CompactBlockProcessor.emit(): Syncing process starts for batch: BlockBatch(order=1, range=BlockHeight(value=419201)..BlockHeight(value=419300), blocks=null)
                            main                           CompactBlockProcessor.fetchTreeStateForHeight$zcash_android_sdk_2_1_2_release(): Starting to fetch tree state for height 419200
app_time_stats: avg=3437.46ms min=3437.46ms max=3437.46ms count=1
Networking error: UNKNOWN: zcashd did not return treestate
                            main                           CompactBlockProcessor.fetchTreeStateForHeight$zcash_android_sdk_2_1_2_release(): Tree state fetch failed (Ask Gemini)
java.lang.Throwable: Communication failure with details: 2: zcashd did not return treestate

zcashd did not return treestate is an error that lightwalletd can return from the GetTreeState method: https://github.com/zcash/lightwalletd/blob/6e3816b5834583c492c37ce05b0faaf9fe12c87f/frontend/service.go#L288-L290

If this error is received, it means we successfully communicated with lightwalletd, i.e. there was no networking error.

The SDK should have a separate error type for lightwalletd errors, so that downstream SDK users are not misled into thinking this is an issue with the client phone's networking.

str4d avatar Jul 03 '24 13:07 str4d