Closed slaweet closed 5 years ago
The reason behind this behavior is the following:
newBlock
event https://github.com/LiskHQ/lisk/blob/70ffe0ab6254f95d1ede44050c990c87730aebd1/modules/cache.js#L234blocks/change
event is emitted in broadcastBlock
event https://github.com/LiskHQ/lisk/blob/70ffe0ab6254f95d1ede44050c990c87730aebd1/modules/transport.js#L425processBlock
function, but broadcastBlock
is emitted way before newBlock
https://github.com/LiskHQ/lisk/blob/70ffe0ab6254f95d1ede44050c990c87730aebd1/modules/blocks/verify.js#L815 https://github.com/LiskHQ/lisk/blob/70ffe0ab6254f95d1ede44050c990c87730aebd1/modules/blocks/verify.js#L833@4miners thanks for the explanation.
So this it was changed between 0.9.X and 1.0.0 when blocks/change
is emitted? Is there a reason for that?
Is there something else I can listen to for notification when the new block is fully processed?
@slaweet Not really, this is an inconsistent behavior and should be considered as a bug in Lisk Core and fixed.
Steps to reproduce
wss://testnet.lisk.io/socket.io/?EIO=3&transport=websocket
'blocks/change'
socket event/api/accounts?address=<address_of_A_or_B>
Expected behavior
/api/accounts?address=<address_of_A_or_B>
should contain balance updated by transaction done in step 2.Actual behavior
/api/accounts?address=<address_of_A_or_B>
contains balance unchangedThe balance will be changed only several seconds later.
Which causes issues in Lisk Hub like this https://github.com/LiskHQ/lisk-hub/issues/1188
/api/transactions
has the same delay as/api/accounts
Another thing I noticed is that if the transaction in Step 2. is the first outgoing transaction of account A, then response in Step 4 already contains the publicKey, but still not the updated balance.
Which version(s) does this affect? (Environment, OS, etc...)
Lisk Core 1.0.0