monero-ts icon indicating copy to clipboard operation
monero-ts copied to clipboard

Error - Imported outputs omit more outputs that we know of

Open will-yjn opened this issue 2 years ago • 1 comments

The view-only wallet by default exports outputs since the last export. But if I create a new offline wallet (createWalletFull), and then sign a transaction, it will throw an error: offlineWallet.signTx Error: Error - Imported outputs omit more outputs that we know of.

async function signTx(params){

    const offlineWallet = await createWalletFull({
        networkType: MoneroNetworkType.MAINNET,
        privateSpendKey: privateKey,
        primaryAddress: from,
        password: "password",
        accountLookahead: accountLookahead === undefined ? 1 : accountLookahead,
        subaddressLookahead: subaddressLookahead === undefined ? 50000 : subaddressLookahead,
    });

    await offlineWallet.importOutputs(outputsHex);

    let signedTxHex;
    try{
        signedTxHex = await offlineWallet.signTxs(unsignedHex);
    }catch(error: any){
        throw Error("offlineWallet.signTx Error: " + (error || error.msg));
    }

    return signedTxHex;
}

Of course I could export all outputs, but what if there are too many outputs and the output_hex is too large. One http request could only carry so much data. Why can't a offline wallet sign a transaction based on the outputs since the last export and their respective unsignedHex?

will-yjn avatar Sep 07 '22 09:09 will-yjn

This question is better suited for monero-project devs (#monero-dev) since the library is a straight passthrough.

but what if there are too many outputs and the output_hex is too large.

There's an effort to export outputs in chunks to avoid too much data: https://github.com/monero-project/monero/pull/8513

woodser avatar Sep 09 '22 06:09 woodser