Private State is not populated properly for validation check in smart contract
Lets consider a private transaction between Node-A and Node-B.Node-A wants to transfer some amounts to Node-B. So,after end of the transaction --Node-A should have it's updated balance. --Node-B should have it's updated balance.
If we look the solidity code as below, we have two observation. Case 1. If we don't keep the require check for the balance, both the nodes display the updated balances. Case 2. However, if we keep the require check, updated balance is not populated at Node-B end.
So, one node state gets updated and another node state is not updated.
function transfer(address _to, uint _value) public returns (bool success) { //require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender] - _value; balances[_to] = balances[_to] + _value; Transfer(msg.sender, _to, _value); return true; }
Is it how these has been designed? If Yes, How validation check can be added within smart contract for private transaction?
As per my understanding, the same code gets executed at both the node end to produce the result. If this is so, then require can't be used or any validation can't be used within the smart contract code.
Please reopen if this is still an issue. Thanks.