XRPL-Labs / Xaman-App

Xaman (Formerly XUMM) for iOS and Android (React Native)
https://support.xumm.app
Other
104 stars 48 forks source link

Xahau PaymentChannel network fee not found #111

Closed desimmons closed 3 months ago

desimmons commented 3 months ago

Describe the bug When submitting a PaymentChannelCreate TX using MAINNET or TESTNET, the "PublicKey" field does not need specifying. For example:

{
        "TransactionType": "PaymentChannelCreate",
        "Amount": amount,
        "Destination": destinationAddress,
        "SettleDelay": 1209600
}

IIUC, this line does the job of injecting the PublicKey later.

However, if I do the same with XAHAU or XAHAUTESTNET, it is unable to load the network fee. The following VIDEO DEMO OF BUG highlights the behaviour.

Expected behavior I would expect PaymentChannelCreate to behave similarly across network types

Screenshots VIDEO DEMO OF BUG

Environment

What build of XUMM are you running? Please provide the full version (you can find it in Settings > Advanced).

What device are you running XUMM on?

Additional context

Attach crash logs if available. Please ensure that these files do not contain any personal information.

WietseWind commented 3 months ago

The problem seems to be the NetworkID is missing from the transaction payload. Which makes the network unable to determine the fee because it's invalid.

Did you add the NetworkID field to the payload?

desimmons commented 3 months ago

I'm using the "force_network" field:

{
    'txjson': <tx_json>,
    'options': {"pathfinding_fallback": false, "force_network": "XAHAU"},
}

or

{
    'txjson': <tx_json>,
    'options': {"pathfinding_fallback": false, "force_network": "XAHAUTESTNET"},
}

Scanning the QR code with a different network makes Xaman force me to change network type to Xahau, so I presume this suggests the NetworkID is being set.

The problem goes away if I add a "PublicKey" to the "PaymentChannelCreate" transaction (see VIDEO DEMO OF BUG)

WietseWind commented 3 months ago

Force network isn't the same. That's a layer two, software field.

NetworkID is the native mandatory field fo4 transactions. Please add it. It's required for a valid payload: https://docs.xahau.network/technical/protocol-reference/transactions/transaction-common-fields#networkid-field

Also, the PaymentChannelCreate transaction has a mandatory PublicKey field, it must be present for the payload to be valid.

To determine the network fee, the transaction must be complete and valid, otherwise the network can't determine the Fee and requires you to preset a fee.

For the network based Fee determination, the transaction MUST be complete otherwise the network can't determine the fee because it doesn't know the exact complete payload it is determining the fee for.

So it must have the NetworkID field.

And it must have the PublicKey field, otherwise the payload is incomplete and so: invalid, and so: the fee can't be determined by the nertwork, and so: you are getting the error.

If you don't want the error, either make sure the payload is complete, or don't ask the network to determine the Fee for you by setting one yourself :)