polkaj icon indicating copy to clipboard operation
polkaj copied to clipboard

The balance does not correspond to the blockchain

Open zhangkaiqiu opened this issue 5 years ago • 1 comments

Thank you for sharing the project. When I was using it, I found that it might not match the current version of polkadot node. When I got the balance, I found that the balance did not correspond. So I modified the source code, and finally it was matched. , The following is where I modified.

AccountInfo.java

public class AccountInfo {

    private Long nonce;
    /**
     * Integer --> Long
     */
    private Long refcount;
    private AccountData data;
}

AccountInfoReader.java

public class AccountInfoReader implements ScaleReader<AccountInfo> {

    @Override
    public AccountInfo read(ScaleCodecReader rdr) {
        AccountInfo result = new AccountInfo();
        result.setNonce(rdr.readUint32());
        /**
         * rdr.readUByte()  --> rdr.readUint32()
         */
        result.setRefcount(rdr.readUint32());
        result.setData(rdr.read(new AccountDataReader()));
        return result;
    }
}

zhangkaiqiu avatar Oct 15 '20 03:10 zhangkaiqiu

Thank you! Can you make it as a Pull Request? Ideally with the test data, i.e. you encoded value which was failing to decode

splix avatar Oct 15 '20 03:10 splix