bytecoin icon indicating copy to clipboard operation
bytecoin copied to clipboard

Get Balance returning crazy high and unrealistic numbers.

Open d-waters opened this issue 7 years ago • 4 comments

Using curl to make a 'get_balance' request and the following response occurs.

{"id":"id","jsonrpc":"2.0","result":{"locked_or_unconfirmed":283400000000,"spendable":18446743888337551616,"spendable_dust":1149890047}}p

As much as I wish this were real, it's not, and it renders the wallet useless.

d-waters avatar May 16 '18 20:05 d-waters

Lawl this coin is like a drama TV with no plot

schultzmargaret avatar May 27 '18 06:05 schultzmargaret

I would like to setup Bytecoinpool in South Alabama USA Please email me [email protected] or message me on twitter @austinyeshua or facebook @yeshuaaustin Google sms 2512702872

qanon1111 avatar May 31 '18 15:05 qanon1111

Try to clear wallet cache...

4egod avatar Jun 25 '18 02:06 4egod

I've cleared wallet cache but I have the same issue...

It seems that the problem is that Amount is unsigned int (uint64_t). In these subtractions the result is less than zero... but why is it less than zero?

I think this problem occurs when there are several addresses in a wallet. The balance is wrong between addresses

struct Balance {
	Amount spendable             = 0;
	Amount spendable_dust        = 0;
	Amount locked_or_unconfirmed = 0;
	Amount total() const {
		return spendable + spendable_dust + locked_or_unconfirmed;
	}  // This fun serves as a documentation.
};

WalletState.cpp

static void combine_balance(api::Balance &balance, const api::Output &output, int locked_op, int spendable_op) {
	Amount &mod = output.dust ? balance.spendable_dust : balance.spendable;
	if (locked_op > 0)
		balance.locked_or_unconfirmed += output.amount;
	if (locked_op < 0)
		balance.locked_or_unconfirmed -= output.amount; ***(LESS THAN ZERO)
	if (spendable_op > 0)
		mod += output.amount;
	if (spendable_op < 0)
		mod -= output.amount; ***(LESS THAN ZERO)
}

ghost avatar Jul 31 '18 19:07 ghost