adshares / ads

ADS Blockchain
Other
21 stars 4 forks source link

get_log: incorrect balance after creating remote account #1

Closed PawelPodkalicki closed 6 years ago

PawelPodkalicki commented 6 years ago

Account was created remotely in node 2 by main account of first node (0001-00000000-9B6F)

{"run":"create_account", "node":"2"}

After creating account, there is incorrect sum in log of main account in remote node (node 2). Sum is incorrect because balance from account than sum of all events. Difference is equal 2000. Maybe error depends on last event:

{
            "time": "1528115812",
            "date": "2018-06-04 14:36:52",
            "type_no": "32785",
            "confirmed": "yes",
            "type": "bank_profit",
            "block_id": "5B153240",
            "profit_div": "0.00000000000",
            "profit_usr": "0.00000002000",
            "profit_get": "0.00000000000",
            "profit": "0.00000002000",
            "fee": "0.00000003000"
        }

Should profid_usr be subtracted from profit? In current version [of test] it is not subtracted.

Full log is available in file 20180604_1438_logs_incorrect_sum. Request was on 14:36:20.265

jzemlo commented 6 years ago

Related to #3

PawelPodkalicki commented 6 years ago

Successfully created remote node. Balance of all accounts were correct. Then I tried to create another remote account. Operation failed - based on log 10:08:00.128. Amount was returned. Balance of creator's account in correct, but balance of main account in remote node is not.

Below are events of creator (0001-00000000-9B6F)

...
10:08:00.283 [main] INFO  net.adshares.ads.qa.util.LogChecker -       create_account:-0.00220000000
...
10:08:00.284 [main] INFO  net.adshares.ads.qa.util.LogChecker -      account_created:0
...
10:08:00.284 [main] INFO  net.adshares.ads.qa.util.LogChecker -       create_account:-0.00220000000
...
10:08:00.284 [main] INFO  net.adshares.ads.qa.util.LogChecker -      account_created:0.00020000000

Below is event from remote node's main account log

10:08:02.406 [main] INFO  net.adshares.ads.qa.util.LogChecker -       create_account:0.00020000000

Amount of this event is equal to difference between balance from account.balance and sum from log. Below are details of that event.

{
    "time": "1528272452",
    "date": "2018-06-06 10:07:32",
    "type_no": "32774",
    "confirmed": "yes",
    "type": "create_account",
    "node": "1",
    "account": "0",
    "address": "0001-00000000-9B6F",
    "node_msid": "7",
    "node_mpos": "1",
    "account_msid": "2",
    "amount": "0.00020000000",
    "sender_balance": "19999999.99871814726",
    "sender_amount": "0.00020000000",
    "sender_fee": "0.00200000000",
    "sender_public_key_prefix_6": "A9C0D972D8AA",
    "sender_status": "0",
    "inout": "in",
    "id": "0001:00000007:0001"
}

Please, answer if this event should not be added to sum or some other event (with negative amount) is missing. Second question is: what is the reason that account was not created on the second attempt?

Full log is available in file 20180606_1009_logs_rem_node_inc_bal

jzemlo commented 6 years ago

You can only create one new remote account per node for one sender account. You need to change key on previously created remote account before creating next one.

PawelPodkalicki commented 6 years ago

Unexpected create_account event in main account log after creation failed is solved in c92a4f1d829ca817b823c0f45726dd7a666777c6

Small diff of 2000 clicks is still present. It exists when create_acount transaction is issued in one block and confirmed in next block.

PawelPodkalicki commented 6 years ago

In 6ffd4323924391f7c24dea8428c916abb8f26cc6 log of main account in remote node after create_account is correct.

Before closing issue I will try to create another account according to information:

You can only create one new remote account per node for one sender account. You need to change key on previously created remote account before creating next one.