Skip to content

Credit withdrawal doesn't calculate Core fee/byte correctly #2233

Open
@thephez

Description

@thephez

Expected Behavior

A withdrawal can be done simply by running something like:

client.platform.identities.withdrawCredits(identity, withdrawalAmount, { toAddress });

Current Behavior

This error is returned:
StateTransitionBroadcastError: Core fee per byte 0 must be part of fibonacci sequence and not less than 1]

Possible Solution

The following appears to work:

client.wallet.storage.getDefaultChainStore().state.fees.minRelay = 1000
client.platform.identities.withdrawCredits(identity, withdrawalAmount, { toAddress });

It appears minRelay in at least some cases is 0 (actually -0). This results in a value of -1 being returned as the coreFeePerByte here: https://github.com/dashpay/platform/blob/v1.4-dev/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/creditWithdrawal.ts#L89-L94

Steps to Reproduce (for bugs)

Run this with a valid identity, amount, and address:

client.platform.identities.withdrawCredits(identity, withdrawalAmount, { toAddress });

Context

Your Environment

  • Version used: JS SDK 1.4-dev.8 against testnet
  • Environment name and version (e.g. Chrome 39, node.js 5.4): Node 20.10
  • Operating System and version (desktop, server, or mobile): Ubuntu 22

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingjs-sdkJS Dash SDK related

Type

No type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions